Skip to content

Commit 9a31591

Browse files
committed
Clarify intent of ours & theirs ref labels used in merge conflict markers
1 parent 4406021 commit 9a31591

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

transcrypt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,16 +327,16 @@ save_helper_scripts() {
327327
#!/usr/bin/env bash
328328
329329
# Look up name of local branch/ref to which changes are being merged
330-
TARGET_NAME=$(git rev-parse --abbrev-ref HEAD)
330+
OURS_LABEL=$(git rev-parse --abbrev-ref HEAD)
331331
332-
# Look up name of remote branch/ref from which changes are being merged
332+
# Look up name of the incoming "theirs" branch/ref being merged in.
333333
# TODO There must be a better way of doing this than relying on this reflog
334334
# action environment variable, but I don't know what it is
335335
if [[ "$GIT_REFLOG_ACTION" = "merge "* ]]; then
336-
REMOTE_NAME=$(echo $GIT_REFLOG_ACTION | awk '{print $2}')
336+
THEIRS_LABEL=$(echo $GIT_REFLOG_ACTION | awk '{print $2}')
337337
fi
338-
if [[ ! "$REMOTE_NAME" ]]; then
339-
REMOTE_NAME="remote"
338+
if [[ ! "$THEIRS_LABEL" ]]; then
339+
THEIRS_LABEL="theirs"
340340
fi
341341
342342
# Decrypt BASE, LOCAL, and REMOTE versions of file being merged
@@ -348,7 +348,7 @@ save_helper_scripts() {
348348
# We must redirect stdout to $5 here instead of letting merge-file write to
349349
# $2 as it would by default, because we need $5 to contain the final result
350350
# content so a later crypt `clean` generates the correct hash salt value
351-
git merge-file --stdout --marker-size=$4 -L $TARGET_NAME -L base -L $REMOTE_NAME $2 $1 $3 > $5
351+
git merge-file --stdout --marker-size=$4 -L $OURS_LABEL -L base -L $THEIRS_LABEL $2 $1 $3 > $5
352352
353353
if [[ "$?" == "0" ]]; then
354354
# If the merge was successful (no conflicts) re-encrypt the merged working

0 commit comments

Comments
 (0)