Skip to content

Commit

Permalink
Detect misspelled pathspec to git-add
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Feb 15, 2006
1 parent 6becd7d commit 45e4812
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions git-add.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 45e4812

Please sign in to comment.