Document new --date=<format>
[gitweb.git] / git-stash.sh
index 5c63ca5bce1180a6a6182a73ec5a75b7580580ab..de13dd1812170ca76eb5706aefb7f59d22be6d48 100755 (executable)
@@ -3,6 +3,7 @@
 
 USAGE='[ | list | show | apply | clear]'
 
+SUBDIRECTORY_OK=Yes
 . git-sh-setup
 require_work_tree
 
@@ -57,11 +58,11 @@ save_stash () {
 
        # state of the working tree
        w_tree=$( (
+               rm -f "$TMP-index" &&
+               cp -p ${GIT_INDEX_FILE-"$GIT_DIR/index"} "$TMP-index" &&
                GIT_INDEX_FILE="$TMP-index" &&
                export GIT_INDEX_FILE &&
-
-               rm -f "$TMP-index" &&
-               git read-tree $i_tree &&
+               git read-tree -m $i_tree &&
                git add -u &&
                git write-tree &&
                rm -f "$TMP-index"