mbox series

[RFC,v2,0/3] implement tabbed mode in difftools

Message ID 20210118210003.3071205-1-nicholas@guriev.su (mailing list archive)
Headers show
Series implement tabbed mode in difftools | expand

Message

Nicholas Guriev Jan. 18, 2021, 9 p.m. UTC
In this mode the "git difftool" command opens all compared files via single
invocation of an editor passing to it entire list of the changed files. I find
it useful, and it allows a user to switch easily forward and back between the
files. You will find some screenshots demonstrating the feature in my previous
message.

The patch series looks better now, and the two problems mentioned earlier have
been solved. I added a new static function, forget_tempfile, into the diff.c
file. It cleans diff_temp structures and do not remove the temporary files.
They anyway would be deleted in an atexit handler. In this way, I can collect
content of all changed files before running the editor.

For solving the second problem with spaces, I am separating file names with
line-feeds, '\n', that are less common. This restriction is the same with the
"git mergetool" command. I think it is acceptable at the present stage.

I have also repaired prompting in the tabbed mode. In such case, the command
asks a user only once right before starting the editor. And I have described
briefly the new changes to the best of my ability.

Alas, some other problems still remain. First, some automated tests failed that
related to the difftool.prompt setting. I have modified its behavior a bit and
it now contains a loop. Second, there are no new tests, yet I am going to add
them later. And third, the main remaining problem is the method of calling of
the difftool helper. I do not like that I have to write temporary files in the
helper code to store its state between invocations. But maybe, someone offer a
better solution that is easy to incorporate into the current architecture.

In conclusion, the patches are still not ready for merging, and any comments or
testing are welcome.


Nicholas Guriev (3):
  mergetools: support difftool.tabbed setting
  difftool-helper: conciliate difftool.tabbed and difftool.prompt
    settings
  doc: describe new difftool.tabbed feature

 Documentation/config/difftool.txt |  6 +++
 Documentation/git-difftool.txt    | 19 ++++++++--
 Documentation/git.txt             |  4 ++
 builtin/difftool.c                |  7 +++-
 diff.c                            | 10 ++++-
 git-difftool--helper.sh           | 39 ++++++++++++-------
 git-mergetool--lib.sh             | 62 ++++++++++++++++++++++++++++++-
 mergetools/meld                   |  4 ++
 mergetools/vimdiff                | 17 +++++++++
 9 files changed, 148 insertions(+), 20 deletions(-)