@matheusbsbs / matheus-bagliano / commits / 45e48120bb
Fork 0

Detect misspelled pathspec to git-add

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>

Junio C Hamano committed Feb 15, 2006 at 01:05 UTC 45e48120bb591b9ef156026ae7498ebd6a144962
1 file changed +11
git-add.sh
+11
@@ -24,6 +24,17 @@ while : ; do
24 shift
25 done
26
27 +# Check misspelled pathspec
28 +case "$#" in
29 +0) ;;
30 +*)
31 + git-ls-files --error-unmatch --others --cached -- "$@" >/dev/null || {
32 + echo >&2 "Maybe you misspelled it?"
33 + exit 1
34 + }
35 + ;;
36 +esac
37 +
38 if test -f "$GIT_DIR/info/exclude"
39 then
40 git-ls-files -z \