From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: [PATCH] Detect misspelled pathspec to git-add
Date: Wed, 15 Feb 2006 01:14:54 -0800 [thread overview]
Message-ID: <7v1wy5m19t.fsf@assigned-by-dhcp.cox.net> (raw)
This is in the same spirit as an earlier patch for git-commit.
It does an extra ls-files to avoid complaining when a fully
tracked directory name is given on the command line (otherwise
--others restriction would say the pathspec does not match).
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
* I noticed this when I accidentally said "git add /a/b/c"
when I meant "git add a/b/c", and I did not notice it until
I said "git commit" which said "Nothing to commit."
It does one extra ls-files only if any pathspec is given; I
am hoping this slight performance hit is tolerated. I think
people who does "git add ." all the time to mean "add
everything I added anywhere since I did git add last time"
deserve it ;-).
Comments?
git-add.sh | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
ca28a7e03232b9a3b66df8519d9ee827882c83c1
diff --git a/git-add.sh b/git-add.sh
index f719b4b..13fad82 100755
--- a/git-add.sh
+++ b/git-add.sh
@@ -24,6 +24,17 @@ while : ; do
shift
done
+# Check misspelled pathspec
+case "$#" in
+0) ;;
+*)
+ git-ls-files --error-unmatch --others --cached -- "$@" >/dev/null || {
+ echo >&2 "Maybe you misspelled it?"
+ exit 1
+ }
+ ;;
+esac
+
if test -f "$GIT_DIR/info/exclude"
then
git-ls-files -z \
--
1.2.0.gcfba7
next reply other threads:[~2006-02-15 9:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-15 9:14 Junio C Hamano [this message]
2006-02-15 10:45 ` [PATCH] Detect misspelled pathspec to git-add Johannes Schindelin
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=7v1wy5m19t.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.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