# \[PATCH v6 16/32\] git-stash: avoid hardcoding $GIT\_DIR/logs/....

- From: Nguyễn Thái Ngọc Duy \<hidden\>
- Date: 2016-06-15 23:01:51 
- List: git
- Page: https://ratatoskr.run/git/2016/06/7636433
- Thread: https://ratatoskr.run/git/2016/06/7636417/t.md

```text
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 git-stash.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index 393e1ec..41f8f6b 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -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
-- 
1.9.1.346.ga2b5940
```
