Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Documentation/git-difftool.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ OPTIONS
This is the default behaviour; the option is provided to
override any configuration settings.

--rotate-to=<file>::
Start showing the diff for the given path,
the paths before it will move to end and output.

--skip-to=<file>::
Start showing the diff for the given path, skipping all
the paths before it.

-t <tool>::
--tool=<tool>::
Use the diff tool specified by <tool>. Valid values include
Expand Down
32 changes: 32 additions & 0 deletions t/t7800-difftool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -762,4 +762,36 @@ test_expect_success 'difftool --gui, --tool and --extcmd are mutually exclusive'
test_must_fail git difftool --gui --tool=test-tool --extcmd=cat
'

test_expect_success 'difftool --rotate-to' '
difftool_test_setup &&
test_when_finished git reset --hard &&
echo 1 >1 &&
echo 2 >2 &&
echo 4 >4 &&
git add 1 2 4 &&
git commit -a -m "124" &&
git difftool --no-prompt --extcmd=cat --rotate-to="2" HEAD^ >output&&
cat >expect <<-\EOF &&
2
4
1
EOF
test_cmp output expect
'

test_expect_success 'difftool --skip-to' '
difftool_test_setup &&
test_when_finished git reset --hard &&
git difftool --no-prompt --extcmd=cat --skip-to="2" HEAD^ >output &&
cat >expect <<-\EOF &&
2
4
EOF
test_cmp output expect
'

test_expect_success 'difftool --rotate/skip-to error condition' '
test_must_fail git difftool --no-prompt --extcmd=cat --rotate-to="3" HEAD^ &&
test_must_fail git difftool --no-prompt --extcmd=cat --skip-to="3" HEAD^
'
test_done