X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-add.sh;h=d6a4bc7d092f619d3c9dd20507c6659e13f82a3c;hb=fb18a2edf7f3d1585b6330b7dde110b992d3b97c;hp=fdec86d1a41af847f9d737a2c058e2d2027f32fe;hpb=423325a2d24638ddcc82ce47be5e40be550f4507;p=git.git diff --git a/git-add.sh b/git-add.sh index fdec86d1..d6a4bc7d 100755 --- a/git-add.sh +++ b/git-add.sh @@ -1,13 +1,8 @@ #!/bin/sh -die () { - echo >&2 "$*" - exit 1 -} - -usage() { - die "usage: git add [-n] [-v] ..." -} +USAGE='[-n] [-v] ...' +SUBDIRECTORY_OK='Yes' +. git-sh-setup show_only= verbose= @@ -19,6 +14,10 @@ while : ; do -v) verbose=--verbose ;; + --) + shift + break + ;; -*) usage ;; @@ -29,7 +28,16 @@ while : ; do shift done -GIT_DIR=$(git-rev-parse --git-dir) || exit +# 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