summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1e72a40)
raw | patch | inline | side by side (parent: 1e72a40)
author | Junio C Hamano <gitster@pobox.com> | |
Thu, 29 Nov 2007 00:15:04 +0000 (16:15 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 29 Nov 2007 00:41:18 +0000 (16:41 -0800) |
When you have a file called HEAD in your work tree, many commands that
our scripts feed "HEAD" to would complain about the rev vs path
ambiguity. A solution is to form command line more carefully by
appending -- to them, which makes it clear that we mean HEAD rev not
HEAD file.
This patch would apply to maint.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
our scripts feed "HEAD" to would complain about the rev vs path
ambiguity. A solution is to form command line more carefully by
appending -- to them, which makes it clear that we mean HEAD rev not
HEAD file.
This patch would apply to maint.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/git-am.sh b/git-am.sh
index 32c46d7ed4b26220f4c9e7fc778bb240c85dae1c..5792631d848b0658a6a1a81093ee4eddabf1eea6 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
case "$resolved" in
'')
- files=$(git diff-index --cached --name-only HEAD) || exit
+ files=$(git diff-index --cached --name-only HEAD --) || exit
if [ "$files" ]; then
echo "Dirty index: cannot apply patches (dirty: $files)" >&2
exit 1
case "$resolved$interactive" in
tt)
# This is used only for interactive view option.
- git diff-index -p --cached HEAD >"$dotest/patch"
+ git diff-index -p --cached HEAD -- >"$dotest/patch"
;;
esac
esac
# trust what the user has in the index file and the
# working tree.
resolved=
- git diff-index --quiet --cached HEAD && {
+ git diff-index --quiet --cached HEAD -- && {
echo "No changes - did you forget to use 'git add'?"
stop_here_user_resolve $this
}
then
# Applying the patch to an earlier tree and merging the
# result may have produced the same tree as ours.
- git diff-index --quiet --cached HEAD && {
+ git diff-index --quiet --cached HEAD -- && {
echo No changes -- Patch already applied.
go_next
continue
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index ffcc408ee5217d7a8f6179a0404ffe387e0dab0f..dbab1a9a4ab91caae34f2baecd2439a7b15d11af 100755 (executable)
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
. git-sh-setup
git diff-files --quiet &&
- git diff-index --cached --quiet HEAD ||
+ git diff-index --cached --quiet HEAD -- ||
die "Cannot rewrite branch(es) with a dirty working directory."
tempdir=.git-rewrite
diff --git a/git-merge-ours.sh b/git-merge-ours.sh
index c81a790aa60ea08144dd0899d1aee2ec334a1825..29dba4ba3a57c15bd430bd23c1cebe78e6dc03be 100755 (executable)
--- a/git-merge-ours.sh
+++ b/git-merge-ours.sh
# because the current index is what we will be committing as the
# merge result.
-git diff-index --quiet --cached HEAD || exit 2
+git diff-index --quiet --cached HEAD -- || exit 2
exit 0
index d65df2cb8037f715bfaf016ee323bd810b041460..ff38a22edfa60a759c5e68d9e6968d11531e72d1 100755 (executable)
git rev-parse --verify HEAD > /dev/null &&
git update-index --refresh &&
git diff-files --quiet &&
- git diff-index --cached --quiet HEAD ||
+ git diff-index --cached --quiet HEAD -- ||
die "Working tree is dirty"
}
git rev-parse --verify HEAD > /dev/null &&
git update-index --refresh &&
git diff-files --quiet &&
- ! git diff-index --cached --quiet HEAD &&
+ ! git diff-index --cached --quiet HEAD -- &&
. "$DOTEST"/author-script &&
export GIT_AUTHOR_NAME GIT_AUTHOR_NAME GIT_AUTHOR_DATE &&
git commit -F "$DOTEST"/message -e
diff --git a/git-rebase.sh b/git-rebase.sh
index b0c8ac1c8de8f72ad4ba341777513cf5dab7a935..c9b284c751b2a81e482b2b6bdecb2fecaf68ac52 100755 (executable)
--- a/git-rebase.sh
+++ b/git-rebase.sh
fi
cmt=`cat "$dotest/current"`
- if ! git diff-index --quiet HEAD
+ if ! git diff-index --quiet HEAD --
then
if ! git-commit -C "$cmt"
then
# The tree must be really really clean.
git update-index --refresh || exit
-diff=$(git diff-index --cached --name-status -r HEAD)
+diff=$(git diff-index --cached --name-status -r HEAD --)
case "$diff" in
?*) echo "cannot rebase: your index is not up-to-date"
echo "$diff"
diff --git a/git-stash.sh b/git-stash.sh
index 5bbda47b7b6e286e7e8e5d002d7ed461a831b579..77c94210b7f6532674c654274f41aa6733d67b8d 100755 (executable)
--- a/git-stash.sh
+++ b/git-stash.sh
ref_stash=refs/stash
no_changes () {
- git diff-index --quiet --cached HEAD &&
+ git diff-index --quiet --cached HEAD -- &&
git diff-files --quiet
}