diff options
| author | Shawn O. Pearce <spearce@spearce.org> | 2008-10-09 10:18:32 -0700 |
|---|---|---|
| committer | Shawn O. Pearce <spearce@spearce.org> | 2008-10-09 10:18:32 -0700 |
| commit | 635536488c3efcf8495333b6a94e3e33c36fc055 (patch) | |
| tree | dbe59109f95a57e008933d56ab28e72c7ae410ec /git-stash.sh | |
| parent | 749bc58c5eab5b6947d2c01e02d12320005eba99 (diff) | |
| parent | 44c33a5b9603fba7c9556512a72e4e392ba4ae2d (diff) | |
| download | git-635536488c3efcf8495333b6a94e3e33c36fc055.tar.gz | |
Merge branch 'maint'
* maint:
builtin-apply: fix typo leading to stack corruption
git-stash.sh: fix flawed fix of invalid ref handling (commit da65e7c1)
builtin-merge.c: allocate correct amount of memory
Makefile: do not set NEEDS_LIBICONV for Solaris 8
rebase -i: remove leftover debugging
rebase -i: proper prepare-commit-msg hook argument when squashing
Diffstat (limited to 'git-stash.sh')
| -rwxr-xr-x | git-stash.sh | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/git-stash.sh b/git-stash.sh index 42f626f9d5..b9ace99704 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -145,16 +145,8 @@ show_stash () { flags=--stat fi - 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^") && + w_commit=$(git rev-parse --verify --default $ref_stash "$@") && + b_commit=$(git rev-parse --verify "$w_commit^") && git diff $flags $b_commit $w_commit } @@ -170,19 +162,13 @@ apply_stash () { 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 "$@") && + s=$(git rev-parse --verify --default $ref_stash "$@") && w_tree=$(git rev-parse --verify "$s:") && b_tree=$(git rev-parse --verify "$s^1:") && i_tree=$(git rev-parse --verify "$s^2:") || @@ -242,7 +228,7 @@ drop_stash () { shift fi # Verify supplied argument looks like a stash entry - s=$(git rev-parse --revs-only --no-flags "$@") && + s=$(git rev-parse --verify "$@") && git rev-parse --verify "$s:" > /dev/null 2>&1 && git rev-parse --verify "$s^1:" > /dev/null 2>&1 && git rev-parse --verify "$s^2:" > /dev/null 2>&1 || |
