Skip to content

Commit

Permalink
Clarify intent of ours & theirs ref labels used in merge conflict mar…
Browse files Browse the repository at this point in the history
…kers
  • Loading branch information
jmurty committed Apr 17, 2020
1 parent 4406021 commit 9a31591
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions transcrypt
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,16 @@ save_helper_scripts() {
#!/usr/bin/env bash
# Look up name of local branch/ref to which changes are being merged
TARGET_NAME=$(git rev-parse --abbrev-ref HEAD)
OURS_LABEL=$(git rev-parse --abbrev-ref HEAD)
# Look up name of remote branch/ref from which changes are being merged
# Look up name of the incoming "theirs" branch/ref being merged in.
# TODO There must be a better way of doing this than relying on this reflog
# action environment variable, but I don't know what it is
if [[ "$GIT_REFLOG_ACTION" = "merge "* ]]; then
REMOTE_NAME=$(echo $GIT_REFLOG_ACTION | awk '{print $2}')
THEIRS_LABEL=$(echo $GIT_REFLOG_ACTION | awk '{print $2}')
fi
if [[ ! "$REMOTE_NAME" ]]; then
REMOTE_NAME="remote"
if [[ ! "$THEIRS_LABEL" ]]; then
THEIRS_LABEL="theirs"
fi
# Decrypt BASE, LOCAL, and REMOTE versions of file being merged
Expand All @@ -348,7 +348,7 @@ save_helper_scripts() {
# We must redirect stdout to $5 here instead of letting merge-file write to
# $2 as it would by default, because we need $5 to contain the final result
# content so a later crypt `clean` generates the correct hash salt value
git merge-file --stdout --marker-size=$4 -L $TARGET_NAME -L base -L $REMOTE_NAME $2 $1 $3 > $5
git merge-file --stdout --marker-size=$4 -L $OURS_LABEL -L base -L $THEIRS_LABEL $2 $1 $3 > $5
if [[ "$?" == "0" ]]; then
# If the merge was successful (no conflicts) re-encrypt the merged working
Expand Down

0 comments on commit 9a31591

Please sign in to comment.