* What should mergetool do with --no-prompt?
@ 2012-08-14 7:07 David Aguilar
2012-08-14 7:18 ` Charles Bailey
0 siblings, 1 reply; 6+ messages in thread
From: David Aguilar @ 2012-08-14 7:07 UTC (permalink / raw)
To: Git Mailing List; +Cc: Charles Bailey, Tim Henigan
Right now there are two code paths, resolving deletion conflicts
and resolving symlink conflicts, in git-mergetool that do not
honor --no-prompt. They force user-interaction with the shell
even though the caller (such as a program) said that they do
not want to be prompted.
This was an oversight from when this option was first added.
I think a simple and sensible thing to do would be for mergetool
to skip over these entries when --no-prompt is supplied.
Does this sound like a good idea?
--
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What should mergetool do with --no-prompt?
2012-08-14 7:07 What should mergetool do with --no-prompt? David Aguilar
@ 2012-08-14 7:18 ` Charles Bailey
2012-08-14 15:06 ` Junio C Hamano
0 siblings, 1 reply; 6+ messages in thread
From: Charles Bailey @ 2012-08-14 7:18 UTC (permalink / raw)
To: David Aguilar; +Cc: Git Mailing List, Tim Henigan
On Tue, Aug 14, 2012 at 12:07:26AM -0700, David Aguilar wrote:
> Right now there are two code paths, resolving deletion conflicts
> and resolving symlink conflicts, in git-mergetool that do not
> honor --no-prompt. They force user-interaction with the shell
> even though the caller (such as a program) said that they do
> not want to be prompted.
>
> This was an oversight from when this option was first added.
>
> I think a simple and sensible thing to do would be for mergetool
> to skip over these entries when --no-prompt is supplied.
>
> Does this sound like a good idea?
--no-prompt is designed to remove the prompt before launching a
mergetool. This is because it is mostly pointless but does provide a
convenient point to interrupt (C-c) a large multifile conflict
resolution.
It was never supposed to be a batch mode switch. By it's very nature
mergetool is interactive so I don't see any advantage to pretending
otherwise.
If the documentation indicates otherwise then it's my opinion that
this is what needs to be fixed.
Charles.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What should mergetool do with --no-prompt?
2012-08-14 7:18 ` Charles Bailey
@ 2012-08-14 15:06 ` Junio C Hamano
2012-08-14 17:09 ` Charles Bailey
0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2012-08-14 15:06 UTC (permalink / raw)
To: Charles Bailey; +Cc: David Aguilar, Git Mailing List, Tim Henigan
Charles Bailey <charles@hashpling.org> writes:
> On Tue, Aug 14, 2012 at 12:07:26AM -0700, David Aguilar wrote:
>> Right now there are two code paths, resolving deletion conflicts
>> and resolving symlink conflicts, in git-mergetool that do not
>> honor --no-prompt. They force user-interaction with the shell
>> even though the caller (such as a program) said that they do
>> not want to be prompted.
>>
>> This was an oversight from when this option was first added.
>>
>> I think a simple and sensible thing to do would be for mergetool
>> to skip over these entries when --no-prompt is supplied.
>>
>> Does this sound like a good idea?
>
> --no-prompt is designed to remove the prompt before launching a
> mergetool. This is because it is mostly pointless but does provide a
> convenient point to interrupt (C-c) a large multifile conflict
> resolution.
>
> It was never supposed to be a batch mode switch. By it's very nature
> mergetool is interactive so I don't see any advantage to pretending
> otherwise.
Could it be that the calling user or script does not even have a
terminal but still can spawn the chosen mergetool backend and
interact with the user via its GUI? Or it may have a terminal that
is hard for the user to interact with, and the prompt and "read ans"
may get stuck.
In such an environment, the ideal behaviour for the "git mergetool"
frontend may be not to interact via the terminal at all and instead
run its interaction to choose the resolution using a matching GUI
interface. I see when "read ans" fails (e.g. the standard input to
the mergetool is closed), resolve_{symlink,deleted}_merge will not
get stuck but instead fail, so perhaps David's issue could be solved
by running "git mergetool --tool=... </dev/null" or something?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What should mergetool do with --no-prompt?
2012-08-14 15:06 ` Junio C Hamano
@ 2012-08-14 17:09 ` Charles Bailey
2012-08-14 17:23 ` Junio C Hamano
0 siblings, 1 reply; 6+ messages in thread
From: Charles Bailey @ 2012-08-14 17:09 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Aguilar, Git Mailing List, Tim Henigan
On Tue, Aug 14, 2012 at 08:06:56AM -0700, Junio C Hamano wrote:
>
> Could it be that the calling user or script does not even have a
> terminal but still can spawn the chosen mergetool backend and
> interact with the user via its GUI? Or it may have a terminal that
> is hard for the user to interact with, and the prompt and "read ans"
> may get stuck.
It could be, although this certainly wasn't considered in the original
design. I know that we removed explicit references to /dev/tty and
replaced them with exec n>&m juggling which made things generally more
robust and allowed some basic shell tests to work more reliably. I
don't object to handling non-interactive mode better but it feels
unsatisfactory to only be able to resolve some types of conflict and
have to skip others.
> In such an environment, the ideal behaviour for the "git mergetool"
> frontend may be not to interact via the terminal at all and instead
> run its interaction to choose the resolution using a matching GUI
> interface. I see when "read ans" fails (e.g. the standard input to
> the mergetool is closed), resolve_{symlink,deleted}_merge will not
> get stuck but instead fail, so perhaps David's issue could be solved
> by running "git mergetool --tool=... </dev/null" or something?
To be honest, I wasn't sure what David's issue was, other than "I
spotted this could/should it be fixed?". Is it a real world issue?
Charles.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What should mergetool do with --no-prompt?
2012-08-14 17:09 ` Charles Bailey
@ 2012-08-14 17:23 ` Junio C Hamano
2012-08-14 19:15 ` David Aguilar
0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2012-08-14 17:23 UTC (permalink / raw)
To: Charles Bailey; +Cc: David Aguilar, Git Mailing List, Tim Henigan
Charles Bailey <charles@hashpling.org> writes:
> On Tue, Aug 14, 2012 at 08:06:56AM -0700, Junio C Hamano wrote:
>>
>> Could it be that the calling user or script does not even have a
>> terminal but still can spawn the chosen mergetool backend and
>> interact with the user via its GUI? Or it may have a terminal that
>> is hard for the user to interact with, and the prompt and "read ans"
>> may get stuck.
>
> It could be, although this certainly wasn't considered in the original
> design. I know that we removed explicit references to /dev/tty and
> replaced them with exec n>&m juggling which made things generally more
> robust and allowed some basic shell tests to work more reliably. I
> don't object to handling non-interactive mode better but it feels
> unsatisfactory to only be able to resolve some types of conflict and
> have to skip others.
Exactly. The mention of "a matching GUI" below you quoted was a
suggestion to improve that "only resolve some but not others"
problem. The usual mergetool backend, e.g. meld, may not be capable
of resolving symlink conflicts, but "git mergetool" could run a GUI
dialog that gives the user "ours/theirs/fail" choice (or better yet
"merge result value" textbox in addition) for such a path. The same
for delete/modify conflicts.
>> In such an environment, the ideal behaviour for the "git mergetool"
>> frontend may be not to interact via the terminal at all and instead
>> run its interaction to choose the resolution using a matching GUI
>> interface.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What should mergetool do with --no-prompt?
2012-08-14 17:23 ` Junio C Hamano
@ 2012-08-14 19:15 ` David Aguilar
0 siblings, 0 replies; 6+ messages in thread
From: David Aguilar @ 2012-08-14 19:15 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Charles Bailey, Git Mailing List, Tim Henigan
On Tue, Aug 14, 2012 at 10:23 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Charles Bailey <charles@hashpling.org> writes:
>
>> On Tue, Aug 14, 2012 at 08:06:56AM -0700, Junio C Hamano wrote:
>>>
>>> Could it be that the calling user or script does not even have a
>>> terminal but still can spawn the chosen mergetool backend and
>>> interact with the user via its GUI? Or it may have a terminal that
>>> is hard for the user to interact with, and the prompt and "read ans"
>>> may get stuck.
>>
>> It could be, although this certainly wasn't considered in the original
>> design. I know that we removed explicit references to /dev/tty and
>> replaced them with exec n>&m juggling which made things generally more
>> robust and allowed some basic shell tests to work more reliably. I
>> don't object to handling non-interactive mode better but it feels
>> unsatisfactory to only be able to resolve some types of conflict and
>> have to skip others.
>
> Exactly. The mention of "a matching GUI" below you quoted was a
> suggestion to improve that "only resolve some but not others"
> problem. The usual mergetool backend, e.g. meld, may not be capable
> of resolving symlink conflicts, but "git mergetool" could run a GUI
> dialog that gives the user "ours/theirs/fail" choice (or better yet
> "merge result value" textbox in addition) for such a path. The same
> for delete/modify conflicts.
>
>>> In such an environment, the ideal behaviour for the "git mergetool"
>>> frontend may be not to interact via the terminal at all and instead
>>> run its interaction to choose the resolution using a matching GUI
>>> interface.
That makes sense. Perhaps a tcl/tk dialog could be used for these
when a special flag, e.g. "--interactive-gui" or something, is
supplied. I think that would be nice, and I can look into this when
I have some more tcl/tk hacking time.
I did have a real-world example -- a GUI that runs git-mergetool
on the user's behalf that (wrongly) assumed that "git mergetool -y"
would not block waiting for input. This is not a problem with the
documentation or with the implementation -- it was simply an oversight
on my part.
Due to backwards-compatibility concerns, the only way to do
this (and work across as many git versions as possible) is to
detect these special cases -- submodules, symlinks, and deletions
-- and handle it in the calling app instead of delegating to mergetool.
There is a part of me that thinks that "--no-prompt" should
really not prompt, and that the various choices could be supplied
on the command-line, e.g. "git mergetool --theirs --no-prompt <path>".
Flags like --ours and --theirs would be heavy hammers when run
without pathspecs. Nonetheless, would it would be helpful to have
these? I seems like it would be helpful when resolving these
special-case merge scenarios.
So I think I'll take the advice that the calling app should
special-case these for existing git versions, and then later
allow them to fall through to mergetool once we've had a chance
to add a matching GUI interface.
Thanks for the sanity check,
--
David
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-08-14 19:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-14 7:07 What should mergetool do with --no-prompt? David Aguilar
2012-08-14 7:18 ` Charles Bailey
2012-08-14 15:06 ` Junio C Hamano
2012-08-14 17:09 ` Charles Bailey
2012-08-14 17:23 ` Junio C Hamano
2012-08-14 19:15 ` David Aguilar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).