summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f276872)
raw | patch | inline | side by side (parent: f276872)
author | Jon Seymour <jon.seymour@gmail.com> | |
Sat, 21 Aug 2010 04:09:01 +0000 (14:09 +1000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 22 Aug 2010 06:51:21 +0000 (23:51 -0700) |
This patch teaches git stash branch to tolerate stash-like arguments.
In particular, a stash is only required if an argument isn't specified
and the stash is only dropped if a stash entry reference was
specified or implied.
The implementation has been simplified by taking advantage of
assert_stash_like() and the variables established by
parse_flags_and_rev().
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In particular, a stash is only required if an argument isn't specified
and the stash is only dropped if a stash entry reference was
specified or implied.
The implementation has been simplified by taking advantage of
assert_stash_like() and the variables established by
parse_flags_and_rev().
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-stash.sh | patch | blob | history |
diff --git a/git-stash.sh b/git-stash.sh
index ac4c0f69cf4ede9ab1cfadcbd09f3114f08ab9d3..ff1edc918bbd9d014695a9a447059391483867de 100755 (executable)
--- a/git-stash.sh
+++ b/git-stash.sh
}
apply_to_branch () {
- have_stash || die 'Nothing to apply'
-
test -n "$1" || die 'No branch name specified'
branch=$1
+ shift 1
- if test -z "$2"
- then
- set x "$ref_stash@{0}"
- fi
- stash=$2
+ set -- --index "$@"
+ assert_stash_like "$@"
+
+ git checkout -b $branch $REV^ &&
+ apply_stash "$@"
- git checkout -b $branch $stash^ &&
- apply_stash --index $stash &&
- drop_stash $stash
+ test -z "$IS_STASH_REF" || drop_stash "$@"
}
PARSE_CACHE='--not-parsed'