Revert "checkout: retire --ignore-other-worktrees in favor of --force"
[gitweb.git] / git-stash.sh
index d4cf818be9488f1b94fdf4766a8f73db6bfd1029..6846b18dbc007a8b08c6f5a77fe568fb8625c28f 100755 (executable)
@@ -20,7 +20,7 @@ require_work_tree
 cd_to_toplevel
 
 TMP="$GIT_DIR/.git-stash.$$"
-TMPindex=${GIT_INDEX_FILE-"$GIT_DIR/index"}.stash.$$
+TMPindex=${GIT_INDEX_FILE-"$(git rev-parse --git-path index)"}.stash.$$
 trap 'rm -f "$TMP-"* "$TMPindex"' 0
 
 ref_stash=refs/stash
@@ -184,7 +184,7 @@ store_stash () {
        fi
 
        # Make sure the reflog for stash is kept.
-       : >>"$GIT_DIR/logs/$ref_stash"
+       : >>"$(git rev-parse --git-path logs/$ref_stash)"
        git update-ref -m "$stash_msg" $ref_stash $w_commit
        ret=$?
        test $ret != 0 && test -z $quiet &&
@@ -259,7 +259,7 @@ save_stash () {
                say "$(gettext "No local changes to save")"
                exit 0
        fi
-       test -f "$GIT_DIR/logs/$ref_stash" ||
+       test -f "$(git rev-parse --git-path logs/$ref_stash)" ||
                clear_stash || die "$(gettext "Cannot initialize stash")"
 
        create_stash "$stash_msg" $untracked