commit - 601f05cdbeb8a43249702cafae41b9dee4811bd6
commit + e4e80ba431438f463a867e2d2d80b264faa19b07
blob - f3a3dc7d1991a6544fc58a1b0d83a5ac5b04b8dd
blob + cdfcbf919035db7b57b79f083ae2ad1157d8b9d9
--- regress/cmdline/diff.sh
+++ regress/cmdline/diff.sh
ret=$?
if [ $ret -ne 0 ]; then
diff -u $testroot/stdout.expected $testroot/stdout
+ fi
+ test_done "$testroot" "$ret"
+}
+
+test_diff_file_to_dir() {
+ local testroot=`test_init diff_file_to_dir`
+ local commit_id0=`git_show_head $testroot/repo`
+
+ got checkout $testroot/repo $testroot/wt > /dev/null
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ git_rm $testroot/repo alpha
+ mkdir $testroot/repo/alpha
+ echo eta > $testroot/repo/alpha/eta
+ (cd $testroot/repo && git add alpha/eta)
+ git_commit $testroot/repo -m "changed alpha into directory"
+ local commit_id1=`git_show_head $testroot/repo`
+
+ echo "diff $commit_id0 $commit_id1" > $testroot/stdout.expected
+ echo "commit - $commit_id0" >> $testroot/stdout.expected
+ echo "commit + $commit_id1" >> $testroot/stdout.expected
+ got diff -r $testroot/repo $commit_id0 $commit_id1 > $testroot/stdout
+ # Diff should not be empty
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret=$?
+ if [ $ret -eq 0 ]; then
+ ret="xfail file to directory"
fi
test_done "$testroot" "$ret"
}
run_test test_diff_worktree_newfile_xbit
run_test test_diff_commit_diffstat
run_test test_diff_worktree_diffstat
+run_test test_diff_file_to_dir