Skip to content

Commit f95e339

Browse files
authored
git-cp: continue to merge when merge.ff is only (tj#1070)
Signed-off-by: spacewander <[email protected]>
1 parent db71be5 commit f95e339

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bin/git-cp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ else
3838
exit 40
3939
fi
4040

41+
MERGE_OPT=
42+
ff=$(git config --get merge.ff)
43+
if [[ "$ff" == "only" ]]; then
44+
MERGE_OPT="--ff"
45+
fi
46+
4147
echo "Copying $CURRENT_FILENAME into $DESTINATION_FILENAME"
4248

4349
INTERMEDIATE_FILENAME="${CURRENT_FILENAME//\//__}-move-to-${DESTINATION_FILENAME//\//__}"
@@ -59,7 +65,8 @@ else
5965
git reset --hard HEAD^
6066

6167
# We keep both files
62-
git merge "${DESTINATION_SAVED}" "${INTERMEDIATE_SAVED}" -m "Duplicate ${CURRENT_FILENAME} history."
68+
# shellcheck disable=SC2086
69+
git merge $MERGE_OPT "${DESTINATION_SAVED}" "${INTERMEDIATE_SAVED}" -m "Duplicate ${CURRENT_FILENAME} history."
6370

6471
# We get back our original name
6572
git mv "${INTERMEDIATE_FILENAME}" "${CURRENT_FILENAME}"

0 commit comments

Comments
 (0)