xdiff/xhistogram: move index allocation into find_lcs
[gitweb.git] / git-stash.sh
index 1d5ba7a4f935fd08572c235b7c5d4390eb8d6528..826af183d489d06468f03ee8002e05da0d7ffd34 100755 (executable)
@@ -15,7 +15,6 @@ SUBDIRECTORY_OK=Yes
 OPTIONS_SPEC=
 START_DIR=$(pwd)
 . git-sh-setup
-. git-sh-i18n
 require_work_tree
 cd_to_toplevel
 
@@ -185,7 +184,7 @@ store_stash () {
 
        git update-ref --create-reflog -m "$stash_msg" $ref_stash $w_commit
        ret=$?
-       test $ret != 0 && test -z $quiet &&
+       test $ret != 0 && test -z "$quiet" &&
        die "$(eval_gettext "Cannot update \$ref_stash with \$w_commit")"
        return $ret
 }
@@ -266,7 +265,7 @@ save_stash () {
        create_stash "$stash_msg" $untracked
        store_stash -m "$stash_msg" -q $w_commit ||
        die "$(gettext "Cannot save the current status")"
-       say Saved working directory and index state "$stash_msg"
+       say "$(eval_gettext "Saved working directory and index state \$stash_msg")"
 
        if test -z "$patch_mode"
        then
@@ -277,7 +276,7 @@ save_stash () {
                        git clean --force --quiet -d $CLEAN_X_OPTION
                fi
 
-               if test "$keep_index" = "t" && test -n $i_tree
+               if test "$keep_index" = "t" && test -n "$i_tree"
                then
                        git read-tree --reset -u $i_tree
                fi
@@ -305,7 +304,25 @@ show_stash () {
        ALLOW_UNKNOWN_FLAGS=t
        assert_stash_like "$@"
 
-       git diff ${FLAGS:---stat} $b_commit $w_commit
+       if test -z "$FLAGS"
+       then
+               if test "$(git config --bool stash.showStat || echo true)" = "true"
+               then
+                       FLAGS=--stat
+               fi
+
+               if test "$(git config --bool stash.showPatch || echo false)" = "true"
+               then
+                       FLAGS=${FLAGS}${FLAGS:+ }-p
+               fi
+
+               if test -z "$FLAGS"
+               then
+                       return 0
+               fi
+       fi
+
+       git diff ${FLAGS} $b_commit $w_commit
 }
 
 show_help () {
@@ -531,7 +548,7 @@ pop_stash() {
                drop_stash "$@"
        else
                status=$?
-               say "The stash is kept in case you need it again."
+               say "$(gettext "The stash is kept in case you need it again.")"
                exit $status
        fi
 }