diff options
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-x | git-stash.sh | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/git-stash.sh b/git-stash.sh index e7b85932d6..4b74951440 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -43,9 +43,16 @@ no_changes () { } untracked_files () { + if test "$1" = "-z" + then + shift + z=-z + else + z= + fi excl_opt=--exclude-standard test "$untracked" = "all" && excl_opt= - git ls-files -o -z $excl_opt -- "$@" + git ls-files -o $z $excl_opt -- "$@" } clear_stash () { @@ -114,7 +121,7 @@ create_stash () { # Untracked files are stored by themselves in a parentless commit, for # ease of unpacking later. u_commit=$( - untracked_files "$@" | ( + untracked_files -z "$@" | ( GIT_INDEX_FILE="$TMPindex" && export GIT_INDEX_FILE && rm -f "$TMPindex" && @@ -253,18 +260,7 @@ push_stash () { ;; -*) option="$1" - # TRANSLATORS: $option is an invalid option, like - # `--blah-blah'. The 7 spaces at the beginning of the - # second line correspond to "error: ". So you should line - # up the second line with however many characters the - # translation of "error: " takes in your language. E.g. in - # English this is: - # - # $ git stash save --blah-blah 2>&1 | head -n 2 - # error: unknown option for 'stash save': --blah-blah - # To provide a message, use git stash save -- '--blah-blah' - eval_gettextln "error: unknown option for 'stash save': \$option - To provide a message, use git stash save -- '\$option'" + eval_gettextln "error: unknown option for 'stash push': \$option" usage ;; *) @@ -300,6 +296,12 @@ push_stash () { if test -z "$patch_mode" then + test "$untracked" = "all" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION= + if test -n "$untracked" + then + git clean --force --quiet -d $CLEAN_X_OPTION -- "$@" + fi + if test $# != 0 then git reset -q -- "$@" @@ -309,11 +311,6 @@ push_stash () { else git reset --hard -q fi - test "$untracked" = "all" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION= - if test -n "$untracked" - then - git clean --force --quiet -d $CLEAN_X_OPTION -- "$@" - fi if test "$keep_index" = "t" && test -n "$i_tree" then @@ -484,7 +481,7 @@ parse_flags_and_rev() case $# in 0) - have_stash || die "$(gettext "No stash found.")" + have_stash || die "$(gettext "No stash entries found.")" set -- ${ref_stash}@{0} ;; 1) @@ -573,10 +570,10 @@ apply_stash () { if test -n "$u_tree" then - GIT_INDEX_FILE="$TMPindex" git-read-tree "$u_tree" && + GIT_INDEX_FILE="$TMPindex" git read-tree "$u_tree" && GIT_INDEX_FILE="$TMPindex" git checkout-index --all && rm -f "$TMPindex" || - die "$(gettext "Could not restore untracked files from stash")" + die "$(gettext "Could not restore untracked files from stash entry")" fi eval " @@ -630,7 +627,7 @@ pop_stash() { drop_stash "$@" else status=$? - say "$(gettext "The stash is kept in case you need it again.")" + say "$(gettext "The stash entry is kept in case you need it again.")" exit $status fi } |