View Ticket
Not logged in
Ticket UUID: 5a13dbd275acf6b5f73c86c735eb7f415cbc8cbd
Title: add and ci/commit are inconsistent wrt "*" handling
Status: Open Type: Code_Defect
Severity: Important Priority:
Subsystem: Resolution: Open
Last Modified: 2010-05-12 11:52:06
Version Found In: bc857ecd92
Description & Comments:
fossil add * will happily add all files in current dir, and subdirs if present.Subsequent fossil commit * will fail on the subdirectories, though, saying they're not part of the repo.

There is no file_isdir() handling in the ci/commit code, and even more confusingly, the object-types and style seem different between the two (add and ci/commit) blocks.

Could these share a common function that recurses into dirs and returns strings/objects that are the files? Could fossil ci * be made to behave same as fossil add *?


drh added on 2009-02-16 12:55:35:
Simply omit the "*" and "fossil commit" automatically commits everything. Why do you want to include "*" syntax?


bharder added on 2009-02-16 14:45:03:
If I have a logical group of commits in a single dir, and don't want to commit every single outstanding commit, then "*" is useful.


kkinnell added on 2009-02-20 22:54:17:
On a Unix or GNU box you can do this if

  • You're not trying to recurse
  • There aren't any 'extra' files in the directory
  • You get the full path from the root of the checkout.

That last is as easy as starting at the checkout root, and
    fossil commit path/to/the/checkins/*

You may not even need the "full" path—but it never hurts to over-specify a path.

A short Perl (or some lesser language ;) script can clean and commit a particular directory in one swell foop.


anonymous added on 2009-03-14 23:45:46:
You can fix all kinds of problems by wrapping them in Perl, ultimately down to the point of writing an entire SCM in it. I don't think asking for consistency in behavior is that unrealistic a request.


stephan added on 2009-11-30 14:44:18:
Keep in mind that the '*' is parsed by the SHELL, and NOT by fossil. What fossil gets as input is whatever the shell expanded '*' to be.


anonymous added on 2010-05-12 11:52:06:
A patch to src/checkin.c to accomplish this:

@@ -448,11 +448,10 @@

/* ** Populate the Global.aCommitFile[] based on the command line arguments ** to a [commit] command. Global.aCommitFile is an array of integers -** sized at (N+1), where N is the number of arguments passed to [commit]. -** The contents are the [id] values from the vfile table corresponding -** to the filenames passed as arguments. +** statically sized at 2000. The contents are the [id] values from the +** vfile table corresponding to the filenames passed as arguments. ** ** The last element of aCommitFile[] is always 0 - indicating the end ** of the array. ** @@ -461,24 +460,37 @@ ** to mean "all files". */ void select_commit_files(void){ if( g.argc>2 ){ - int ii; + int ii, iIn; + Stmt q; Blob b; + char *zPath; blob_zero(&b); - g.aCommitFile = malloc(sizeof(int)*(g.argc-1)); - + g.aCommitFile = malloc(sizeof(int)*2000); + + iIn = 0; for(ii=2; ii<g.argc; ii++){ int iId; file_tree_name(g.argv[ii], &b, 1); - iId = db_int(-1, "SELECT id FROM vfile WHERE pathname=%Q", blob_str(&b)); + + zPath = blob_str(&b); + db_prepare(&q, "SELECT id FROM vfile WHERE pathname=%Q OR (pathname LIKE '%q/%%' AND chnged = 1)", zPath, zPath); + iId = -1; + while( db_step(&q)==SQLITE_ROW ){ + if( iIn>=2000 ){ + fossil_fatal("too many files: max 2000"); + } + + iId = db_column_int(&q, 0); + g.aCommitFile[iIn++] = iId; + } if( iId<0 ){ fossil_fatal("fossil knows nothing about: %s", g.argv[ii]); } - g.aCommitFile[ii-2] = iId; blob_reset(&b); } - g.aCommitFile[ii-2] = 0; + g.aCommitFile[iIn] = 0; } }

/*