From: Junio C Hamano <gitster@pobox.com>
To: Gerrit Pape <pape@smarden.org>
Cc: git@vger.kernel.org
Subject: Re: git-commit: if run with <file> arguments, include files removed through git rm
Date: Tue, 04 Sep 2007 09:00:13 -0700 [thread overview]
Message-ID: <7vabs2pgj6.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20070904144304.5920.qmail@42e302a26078dc.315fe32.mid.smarden.org> (Gerrit Pape's message of "Tue, 4 Sep 2007 14:43:04 +0000")
Gerrit Pape <pape@smarden.org> writes:
> This patch lets it additionally use git ls-tree to look for the files in
> the HEAD tree, but I guess there's a smarter way to fix this.
You raised a good issue, but this also needs other parts of the
system to be adjusted.
> commit_only=`git ls-files --error-unmatch -- "$@"` || exit
> + commit_only="$commit_only "`git ls-tree -r --name-only HEAD -- "$@"` || exit
The arguments to git-commit are *NOT* "<file> arguments". They
are file patterns and 'ls-files --error-unmatch -- "$@"' is
there to allow you to say something like:
$ git commit 'p*/*.c'
Alas, ls-tree does not grok globbing yet. Try this in git.git
repository (surrounding quotes are essential):
$ git ls-files 'p*/*.c'
$ git ls-tree -r HEAD 'p*/*.c'
Currently we have two semantics of "pathspec", and unifying
these semantics is one of the items with somewhat higher
priority on my TODO list for the 1.5.4 cycle (I started looking
at diff-tree and log last night):
* ls-files, diff-files, diff-index and grep understand both
"leading directory prefix" and "glob pattern"; you can say:
$ git ls-files -- arm/ 'p*/*.c'
$ git grep int -- arm/ 'p*/*.c'
and they do what you would expect them to do.
* diff-tree, log family and ls-tree understand only "leading
directory prefix" and not "glob pattern"; you cannot say:
$ git log -- 'p*/*.c'
So your patch is a definite improvement for normal ("non
pattern" but "exact pathname") case, but needs the updates to
pathspec semantics to be the correct fix.
next prev parent reply other threads:[~2007-09-04 16:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-04 14:43 git-commit: if run with <file> arguments, include files removed through git rm Gerrit Pape
2007-09-04 16:00 ` Junio C Hamano [this message]
2007-09-05 10:20 ` Gerrit Pape
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vabs2pgj6.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=pape@smarden.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).