On Sat, Mar 13, 2010 at 10:34:34PM -0800, Junio C Hamano wrote: > Jeff King <peff@xxxxxxxx> writes: > > > Another option is to declare the current behavior wrong. Letting the > > shell glob produces different results for obvious reasons: > > > > $ git add b* ;# will fail, because we see individual pathspecs > > > > but perhaps that is the "feature" of letting add glob itself. Personally > > I have never asked "git add" to glob on my behalf, so I don't know why > > people would do it. > > I know of one reason: > > $ git add '*.[ch]' > > will add a/b.c and c/d/f.h for you. Hrm, that makes handling globs with ignores a bit trickier. If I have: $ touch root.c $ mkdir subdir && touch subdir/file.c $ echo subdir >.gitignore $ git add '*.[ch]' what should happen? I would say it should probably not generate an error, but just add 'root.c'. In which case, I think we perhaps actively _don't_ want to complain about ignored globs at all. If they match nothing except excluded files, we will already complain that the pathspec was useless. And if they do match some other files, we will silently except. The only "downside" versus handling globs in the ignore code is that for the no-matches case we say "pathspec did not match" and not "it _could_ have matched, but these files were ignored, and you need -f to add them". But I don't think that latter message even makes sense for a glob. If you show me just the glob, then it isn't helpful; I don't know which ignored files matched the glob. And if you show me the list of files, it is likely to contain unhelpful cruft like "build/generated.c". So I won't just repeat my command with "-f" anyway; I will find the ignored file I was interested in adding and specify it explicitly. So if that reasoning is sound, I think we want to just leave git-add's behavior as it is currently (with my patch from earlier in this thread applied, of course). You get different error messages for "git add *.c" and "git add '*.c'", but that is only natural. You also get different _behavior_, and that is intentional. Other callers of COLLECT_IGNORED could conceivably want different globbing behavior, but right now git-add is the only caller. So it's certainly not worth caring about at this point. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html