git:perm-stash: Use stash's ancestor as commit_ref

The stash does not necessarily apply to HEAD.
This commit is contained in:
2023-07-18 14:33:55 +02:00
parent d38ee159ed
commit 50eecf7e01

View File

@@ -11,7 +11,7 @@ git rev-parse
idx="${1:-0}"
stash_ref="$(git rev-parse stash@{$idx} | cut -c-$REF_LEN)"
commit_ref="$(git rev-parse HEAD | cut -c-$REF_LEN)"
commit_ref="$(git rev-parse stash@{$idx}~ | cut -c-$REF_LEN)"
git stash show -up "$idx" > \
"${2:-$DIR}/${PWD//\//__}__${commit_ref}__$stash_ref.diff"