Web lists-archives.com

[PATCH v3 0/6] difftool and mergetool improvements




Thanks for the review, Junio.

I hadn't thought about using the return code for `get_merge_tool` so
thanks for that suggestion. It should be a lot cleaner now.

---

Changes since v2:

* Unsuppress output in t7610
* Make `get_merge_tool` return 1 on guessed so we don't have to deal
  with parsing '$guessed:$merge_tool'

Changes since v1:

* Introduce get_merge_tool_guessed function instead of changing
  get_merge_tool
* Remove unnecessary if-tower in mutual exclusivity logic

Denton Liu (6):
  t7610: unsuppress output
  t7610: add mergetool --gui tests
  mergetool: use get_merge_tool function
  mergetool: fallback to tool when guitool unavailable
  difftool: make --gui, --tool and --extcmd mutually exclusive
  difftool: fallback on merge.guitool

 Documentation/git-difftool.txt       |   4 +-
 Documentation/git-mergetool--lib.txt |   4 +-
 Documentation/git-mergetool.txt      |   4 +-
 builtin/difftool.c                   |  13 +--
 git-difftool--helper.sh              |   2 +-
 git-mergetool--lib.sh                |  32 ++++--
 git-mergetool.sh                     |  12 +-
 t/t7610-mergetool.sh                 | 163 +++++++++++++++++----------
 t/t7800-difftool.sh                  |  24 ++++
 9 files changed, 167 insertions(+), 91 deletions(-)

Range-diff against v2:
-:  ---------- > 1:  9f9922cab3 t7610: unsuppress output
1:  c436765684 ! 2:  0f632ca6bf t7610: add mergetool --gui tests
    @@ -23,14 +23,14 @@
     +	test_when_finished "git reset --hard" &&
     +	git checkout -b test$test_count branch1 &&
     +	git submodule update -N &&
    -+	test_must_fail git merge master >/dev/null 2>&1 &&
    -+	( yes "" | git mergetool --gui both >/dev/null 2>&1 ) &&
    ++	test_must_fail git merge master &&
    ++	( yes "" | git mergetool --gui both ) &&
     +	( yes "" | git mergetool -g file1 file1 ) &&
    -+	( yes "" | git mergetool --gui file2 "spaced name" >/dev/null 2>&1 ) &&
    -+	( yes "" | git mergetool --gui subdir/file3 >/dev/null 2>&1 ) &&
    -+	( yes "d" | git mergetool --gui file11 >/dev/null 2>&1 ) &&
    -+	( yes "d" | git mergetool --gui file12 >/dev/null 2>&1 ) &&
    -+	( yes "l" | git mergetool --gui submod >/dev/null 2>&1 ) &&
    ++	( yes "" | git mergetool --gui file2 "spaced name" ) &&
    ++	( yes "" | git mergetool --gui subdir/file3 ) &&
    ++	( yes "d" | git mergetool --gui file11 ) &&
    ++	( yes "d" | git mergetool --gui file12 ) &&
    ++	( yes "l" | git mergetool --gui submod ) &&
     +	test "$(cat file1)" = "gui master updated" &&
     +	test "$(cat file2)" = "gui master new" &&
     +	test "$(cat subdir/file3)" = "gui master new sub" &&
2:  9f8e76a421 < -:  ---------- mergetool: use get_merge_tool_guessed function
-:  ---------- > 3:  ff83d25ff2 mergetool: use get_merge_tool function
3:  4847e64e46 ! 4:  e975fe4a8b mergetool: fallback to tool when guitool unavailable
    @@ -81,18 +81,18 @@
      	git commit -m "branch1 resolved with mergetool"
      '
      
    -+test_expect_success 'gui mergetool without merge.guitool set fallsback to merge.tool' '
    ++test_expect_success 'gui mergetool without merge.guitool set falls back to merge.tool' '
     +	test_when_finished "git reset --hard" &&
     +	git checkout -b test$test_count branch1 &&
     +	git submodule update -N &&
    -+	test_must_fail git merge master >/dev/null 2>&1 &&
    -+	( yes "" | git mergetool --gui both >/dev/null 2>&1 ) &&
    ++	test_must_fail git merge master &&
    ++	( yes "" | git mergetool --gui both ) &&
     +	( yes "" | git mergetool -g file1 file1 ) &&
    -+	( yes "" | git mergetool --gui file2 "spaced name" >/dev/null 2>&1 ) &&
    -+	( yes "" | git mergetool --gui subdir/file3 >/dev/null 2>&1 ) &&
    -+	( yes "d" | git mergetool --gui file11 >/dev/null 2>&1 ) &&
    -+	( yes "d" | git mergetool --gui file12 >/dev/null 2>&1 ) &&
    -+	( yes "l" | git mergetool --gui submod >/dev/null 2>&1 ) &&
    ++	( yes "" | git mergetool --gui file2 "spaced name" ) &&
    ++	( yes "" | git mergetool --gui subdir/file3 ) &&
    ++	( yes "d" | git mergetool --gui file11 ) &&
    ++	( yes "d" | git mergetool --gui file12 ) &&
    ++	( yes "l" | git mergetool --gui submod ) &&
     +	test "$(cat file1)" = "master updated" &&
     +	test "$(cat file2)" = "master new" &&
     +	test "$(cat subdir/file3)" = "master new sub" &&
4:  bc8cadaf55 = 5:  bc3e229171 difftool: make --gui, --tool and --extcmd mutually exclusive
5:  e5e4dc3dd2 = 6:  f39b15efbd difftool: fallback on merge.guitool
-- 
2.21.0.1000.g7817e26e80