What makes me tick.

Wednesday, November 04, 2009

Incremental Changes in Fossil-SCM Integration into Emacs

The --local flag was probably a bad idea.  So it's gone.  Now -n|--nochange implies that autosync is not performed.   Something else broke everything.  The file_tree_name errors out if the name of the directory which is the root of the checkout is passed in as the filename.  Here's the mod to make it return an empty
string if the root is passed in.  Without this, the call to get the tree at the root would fail with a "out of checkout tree" message.

--- src/file.c
+++ src/file.c
@@ -356,23 +356,26 @@
 ** false, then simply return 0.
 **
 ** The root of the tree is defined by the g.zLocalRoot variable.
 */
 int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){
-  int n;
+  int m,n;
   Blob full;
   db_must_be_within_tree();
   file_canonical_name(zOrigName, &full);
   n = strlen(g.zLocalRoot);
-  if( blob_size(&full)<=n || memcmp(g.zLocalRoot, blob_buffer(&full), n) ){
+  m = blob_size(&full);
+  if( m
     blob_reset(&full);
     if( errFatal ){
       fossil_fatal("file outside of checkout tree: %s", zOrigName);
     }
     return 0;
   }
   blob_zero(pOut);
+  if (m == n - 1)
+      return 1;
   blob_append(pOut, blob_buffer(&full)+n, blob_size(&full)-n);
   return 1;
 }

 

Followers