Re: [PATCH 7/8] setup_tree_pathspec(): interpret '^' as negative pathspec
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Sep 14, 2010, 22:41 UTC
- Message-ID
- <AANLkTi=i4P=Xa+PPxp1aLdJOSA7cTptA+KnMsQwjSth1@mail.gmail.com>
- In-Reply-To
- <7viq288g2z.fsf@alter.siamese.dyndns.org>
2010/9/15 Junio C Hamano <gitster@pobox.com>:
Show 14 quoted lines
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes: > >> This patch does preparation work for tree exclusion in >> tree_entry_interesting(). '^' has similar meaning to '!' in >> gitexcludes. '!' is not used because bash does not like arguments with >> a leading '!'. > > Do not even mention gitexcludes as you have to make awkward excuse like > this. > > Instead say something like > > '^' works exactly like prefix '^' for revs (e.g. "log ^maint master") > to mark what is prefixed is excluded.
It was not thought through. The way this patch does means get_pathspec() will need to be updated to handle the case "(in subdir)$ git diff ^foo", which has to be turned to "(in toplevel)$ git diff ^subdir/foo", not "(in toplevel)$ git diff subdir/^foo".
A better approach would be separate "^" out as an argument by itself, i.e. "git diff ^ foo". Less work in get_pathspec(), and tab-comletion on path also works. But now as '^' stands alone, '!' can be used too (no more bash history expansion). And I think '!' is more intuitive than '^'.
-- Duy