Code

Teach git-add and git-commit to handle filenames starting with '-'.
authorJunio C Hamano <junkio@cox.net>
Tue, 18 Oct 2005 07:27:50 +0000 (00:27 -0700)
committerJunio C Hamano <junkio@cox.net>
Tue, 18 Oct 2005 07:27:50 +0000 (00:27 -0700)
Recent '--' fixes to "git diff" by Linus made it possible to specify
filenames that start with '-'.  But in order to do that, you need to
be able to add and commit such file to begin with.

Teach git-add and git-commit to honor the same '--' convention.

Signed-off-by: Junio C Hamano <junkio@cox.net>
git-add.sh
git-commit.sh

index a8498c729ab3188bd21dd6a54ddc77d4c34ac48a..4bf41281d5554f9b1da103b0360eebc411a435eb 100755 (executable)
@@ -23,10 +23,10 @@ if test -f "$GIT_DIR/info/exclude"
 then
        git-ls-files -z \
        --exclude-from="$GIT_DIR/info/exclude" \
-       --others --exclude-per-directory=.gitignore "$@"
+       --others --exclude-per-directory=.gitignore -- "$@"
 else
        git-ls-files -z \
-       --others --exclude-per-directory=.gitignore "$@"
+       --others --exclude-per-directory=.gitignore -- "$@"
 fi |
 case "$show_only" in
 true)
index 5bdee54a46b5012d7d5623040cb4c0eab9d7c7ce..96a884f3bcc67563f2e7e1cc3054d24ca51125dd 100755 (executable)
@@ -99,7 +99,7 @@ t,*)
 ,0)
        ;;
 *)
-       git-diff-files --name-only -z "$@" |
+       git-diff-files --name-only -z -- "$@" |
        git-update-index --remove -z --stdin
        ;;
 esac || exit 1