#!/bin/sh
# Copyright (c) 2007, Nanako Shiraishi
-USAGE='[ | save | list | show | apply | clear | drop | create ]'
+USAGE='[ | save | list | show | apply | clear | drop | pop | create ]'
SUBDIRECTORY_OK=Yes
OPTIONS_SPEC=
ref_stash=refs/stash
no_changes () {
- git diff-index --quiet --cached HEAD -- &&
- git diff-files --quiet
+ git diff-index --quiet --cached HEAD --ignore-submodules -- &&
+ git diff-files --quiet --ignore-submodules
}
clear_stash () {
}
apply_stash () {
- git diff-files --quiet ||
+ git diff-files --quiet --ignore-submodules ||
die 'Cannot restore on top of a dirty state'
unstash_index=
shift
drop_stash "$@"
;;
+pop)
+ shift
+ if apply_stash "$@"
+ then
+ test -z "$unstash_index" || shift
+ drop_stash "$@"
+ fi
+ ;;
*)
if test $# -eq 0
then