Skip to content

Commit 22c687c

Browse files
committed
Improve extracting diff formatting
1 parent 972a138 commit 22c687c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

git-fmt-diff

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,15 @@ git_changes_formatted () (
265265

266266
fmtcng="$tempdir"/fmtcng
267267
merge --their "$old" "$old_fmt" "$cur_fmt" > "$fmtcng"
268-
merge --our "$old" "$old_fmt" "$cur" > "$temp"
269268

270-
if git diff -s "$fmtcng" "$temp"; then
271-
cat "$cur"
272-
else
269+
merge --our "$fmtcng" "$old" "$cur" > "$temp"
270+
if ! git diff -s "$fmtcng" "$temp"; then
271+
merge --their "$cur" "$fmtcng" "$cur_fmt" > "$temp"
272+
merge --their "$cur" "$temp" "$cur_fmt" > "$fmtcng"
273+
fi
274+
275+
merge --our "$old" "$old_fmt" "$cur" > "$temp"
276+
if ! git diff -s "$fmtcng" "$temp"; then
273277
cat "$fmtcng"
274278
fi
275279

0 commit comments

Comments
 (0)