Skip to content

Commit

Permalink
git-stash clear: refuse to work with extra parameter for now
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Jan 7, 2008
1 parent 7c390d9 commit 3023dc6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ no_changes () {
}

clear_stash () {
if test $# != 0
then
die "git stash clear with parameters is unimplemented"
fi
if current=$(git rev-parse --verify $ref_stash 2>/dev/null)
then
git update-ref -d $ref_stash $current
Expand Down Expand Up @@ -216,7 +220,8 @@ apply)
apply_stash "$@"
;;
clear)
clear_stash
shift
clear_stash "$@"
;;
create)
if test $# -gt 0 && test "$1" = create
Expand Down

0 comments on commit 3023dc6

Please sign in to comment.