summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dc4179f)
raw | patch | inline | side by side (parent: dc4179f)
author | Brandon Casey <casey@nrlssc.navy.mil> | |
Tue, 23 Sep 2008 23:57:09 +0000 (18:57 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 24 Sep 2008 16:24:20 +0000 (09:24 -0700) |
apply_stash() and show_stash() each call rev-parse with
'--default refs/stash' as an argument. This option causes rev-parse to
operate on refs/stash if it is not able to successfully operate on any
element of the command line. This includes failure to supply a "valid"
revision. This has the effect of causing 'stash apply' and 'stash show'
to operate as if stash@{0} had been supplied when an invalid revision is
supplied.
e.g. 'git stash apply stash@{1}' would fall back to
'git stash apply stash@{0}'
This patch modifies these two functions so that they avoid using the
--default option of rev-parse.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
'--default refs/stash' as an argument. This option causes rev-parse to
operate on refs/stash if it is not able to successfully operate on any
element of the command line. This includes failure to supply a "valid"
revision. This has the effect of causing 'stash apply' and 'stash show'
to operate as if stash@{0} had been supplied when an invalid revision is
supplied.
e.g. 'git stash apply stash@{1}' would fall back to
'git stash apply stash@{0}'
This patch modifies these two functions so that they avoid using the
--default option of rev-parse.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-stash.sh | patch | blob | history |
diff --git a/git-stash.sh b/git-stash.sh
index d799c763788ecd64b2508668f04c329b2de0c391..6bd2572f7745cbd35fb59c3449b84f1929d9ab08 100755 (executable)
--- a/git-stash.sh
+++ b/git-stash.sh
then
flags=--stat
fi
- s=$(git rev-parse --revs-only --no-flags --default $ref_stash "$@")
+
+ if test $# = 0
+ then
+ set x "$ref_stash@{0}"
+ shift
+ fi
+
+ s=$(git rev-parse --revs-only --no-flags "$@")
w_commit=$(git rev-parse --verify "$s") &&
b_commit=$(git rev-parse --verify "$s^") &&
shift
esac
+ if test $# = 0
+ then
+ set x "$ref_stash@{0}"
+ shift
+ fi
+
# current index state
c_tree=$(git write-tree) ||
die 'Cannot apply a stash in the middle of a merge'
# stash records the work tree, and is a merge between the
# base commit (first parent) and the index tree (second parent).
- s=$(git rev-parse --revs-only --no-flags --default $ref_stash "$@") &&
+ s=$(git rev-parse --revs-only --no-flags "$@") &&
w_tree=$(git rev-parse --verify "$s:") &&
b_tree=$(git rev-parse --verify "$s^1:") &&
i_tree=$(git rev-parse --verify "$s^2:") ||