X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-add.sh;h=13fad820d4758a041222a9285719245f6c8bac18;hb=bbe0c9b8d82aa98aad2ae7e6554cc0b9e2836363;hp=fdec86d1a41af847f9d737a2c058e2d2027f32fe;hpb=423325a2d24638ddcc82ce47be5e40be550f4507;p=git.git diff --git a/git-add.sh b/git-add.sh index fdec86d1a..13fad820d 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= @@ -29,7 +24,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