Skip to content

Commit d5e3532

Browse files
committed
Merge branch 'jk/diff-release-filespec-fix'
Running "git diff" while allowing external diff in a state with unmerged paths used to segfault, which has been corrected. * jk/diff-release-filespec-fix: t7800: simplify difftool test diff: allow passing NULL to diff_free_filespec_data()
2 parents 0dd171f + d668518 commit d5e3532

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

diff.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4115,6 +4115,9 @@ void diff_free_filespec_blob(struct diff_filespec *s)
41154115

41164116
void diff_free_filespec_data(struct diff_filespec *s)
41174117
{
4118+
if (!s)
4119+
return;
4120+
41184121
diff_free_filespec_blob(s);
41194122
FREE_AND_NULL(s->cnt_data);
41204123
}

t/t7800-difftool.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,19 @@ test_expect_success 'add -N and difftool -d' '
728728
git difftool --dir-diff --extcmd ls
729729
'
730730

731+
test_expect_success 'difftool --cached with unmerged files' '
732+
test_when_finished git reset --hard &&
733+
734+
test_commit conflicting &&
735+
test_commit conflict-a conflict.t a &&
736+
git reset --hard conflicting &&
737+
test_commit conflict-b conflict.t b &&
738+
test_must_fail git merge conflict-a &&
739+
740+
git difftool --cached --no-prompt >output &&
741+
test_must_be_empty output
742+
'
743+
731744
test_expect_success 'outside worktree' '
732745
echo 1 >1 &&
733746
echo 2 >2 &&

0 commit comments

Comments
 (0)