Fossil SCM
add and ci/commit are inconsistent wrt "*" handling
5a13dbd275acf6b…
· opened 17 years, 1 month ago
- Type
- Code_Defect
- Priority
- —
- Severity
- Important
- Resolution
- Works_As_Designed
- Subsystem
- —
- Created
- Feb. 16, 2009 4:02 a.m.
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=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;
}
}
/*