Skip to content

Commit 155808d

Browse files
committed
Fix unbound variable errors applying stash of secret file
The GIT_REFLOG_ACTION and THEIRS_LABEL environment variables are normally available when doing a merge with git, but are undefined when merging a stash. This change and the prior one avoids the `unbound variable` error when these variables are unset by defaulting to empty values, and falling back to "theirs" as the in-merge description of incoming changes from the stash.
1 parent bcc4669 commit 155808d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ The format is based on [Keep a Changelog][1], and this project adheres to
2222
- Compatibility fix for LibreSSL versions 3 (and above) especially for MacOS
2323
13 Ventura to more carefully apply a work-around required for OpenSSL 3+
2424
that isn't required for LibreSSL 3+ (#147 #133)
25+
- Fix errors applying a stash containing a secret file that needs to be merged
26+
with staged changes to the same file (#150)
2527

2628
## [2.2.0] - 2022-07-09
2729

transcrypt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ git_merge() {
264264
if [[ "${GIT_REFLOG_ACTION:-}" = "merge "* ]]; then
265265
THEIRS_LABEL=$(echo "$GIT_REFLOG_ACTION" | awk '{print $2}')
266266
fi
267-
if [[ ! "$THEIRS_LABEL" ]]; then
267+
if [[ ! "${THEIRS_LABEL:-}" ]]; then
268268
THEIRS_LABEL="theirs"
269269
fi
270270
# Decrypt BASE $1, LOCAL $2, and REMOTE $3 versions of file being merged

0 commit comments

Comments
 (0)