@matheusbsbs / matheus-bagliano / commits / 3023dc690f
Fork 0

git-stash clear: refuse to work with extra parameter for now

Because it is so tempting to expect "git stash clear stash@{4}" to remove the fourth element in the stash while leaving other elements intact, we should not blindly throw away everything upon seeing such a command. This may change when we start using "git reflog delete" to selectively nuke a single (or multiple, for that matter) stash entries with such a command line. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Jan 5, 2008 at 01:35 UTC 3023dc690f98f83b64cc6f2a9cc015bf2b01964a
1 file changed +6 -1
git-stash.sh
+6 -1
@@ -20,6 +20,10 @@ no_changes () {
20 }
21
22 clear_stash () {
23 + if test $# != 0
24 + then
25 + die "git stash clear with parameters is unimplemented"
26 + fi
27 if current=$(git rev-parse --verify $ref_stash 2>/dev/null)
28 then
29 git update-ref -d $ref_stash $current
@@ -216,7 +220,8 @@ apply)
220 apply_stash "$@"
221 ;;
222 clear)
219 - clear_stash
223 + shift
224 + clear_stash "$@"
225 ;;
226 create)
227 if test $# -gt 0 && test "$1" = create