From: Charles Bailey <charles@hashpling.org>
To: Jonathan del Strother <jon.delStrother@bestbefore.tv>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] Offer to print changes while running git-mergetool
Date: Sun, 08 Feb 2009 01:24:38 +0000 [thread overview]
Message-ID: <498E3456.1080509@hashpling.org> (raw)
In-Reply-To: <57518fd10902070401x14cc7cacrfb8bc88bbf2999cd@mail.gmail.com>
Jonathan del Strother wrote:
> On Sat, Feb 7, 2009 at 8:11 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Jonathan del Strother <jon.delStrother@bestbefore.tv> writes:
>>
>>> Add a "Show changes" option to each prompt in mergetool. This prints the
>>> conflicted changes on the current file, using 'git log -p --merge
>>> <file>'
>> I think the patch should look like this, given the recent conversation I
>> had with you. It seems that the script thinks the unit of indentation is
>> 4-places, and case arms are indented from case/esac (neither of which is
>> the standard git shell script convention), and I tried to match that style
>> used in the existing code.
>>
>> No, I didn't test it.
>>
>> Charles volunteered to take over mergetool, so he is on the Cc: list.
At the moment, I'm slightly cool towards this patch, but perhaps I don't
really understand the underlying issue. I understand wanting to check
something (logs) in the middle of a mergetool run but I can't say that
I've ever wanted to specifically run 'git log -p --merge'. Perhaps some
users of mergetool - being visual people - would more naturally reach
for gitk?
Given that mergetool picks up from where it left off when run a second
time, what does this patch offer over Ctrl-c, run log tool of your
choice, re-run mergetool? Or just running git log in a different
terminal instance?
I've made couple of minor comments on the patch below.
Charles.
>> git-mergetool.sh | 60 ++++++++++++++++++++++++++++++++++++++++++-----------
>> 1 files changed, 47 insertions(+), 13 deletions(-)
>>
>> diff --git c/git-mergetool.sh w/git-mergetool.sh
>> index 87fa88a..b8604d6 100755
>> --- c/git-mergetool.sh
>> +++ w/git-mergetool.sh
>> @@ -14,6 +14,13 @@ OPTIONS_SPEC=
>> . git-sh-setup
>> require_work_tree
>>
>> +if test -f "$GIT_DIR/MERGE_HEAD"
>> +then
>> + in_merge=t show_changes=", (s)how changes"
>> +else
>> + in_merge=f show_changes=
>> +fi
>> +
>> # Returns true if the mode reflects a symlink
>> is_symlink () {
>> test "$1" = 120000
>> @@ -62,22 +69,28 @@ describe_file () {
>>
>> resolve_symlink_merge () {
>> while true; do
--- snip ---
>> ;;
>> - [aA]*)
>> + t,[sS]*)
>> + git log -p --merge "$MERGED"
>> + printf "\n"
>> + resolve_symlink_merge
>> + return
>> + ;;
Slightly unusual recursion, why not just drop out to the 'while true' loop?
>> esac
>> @@ -87,23 +100,29 @@ resolve_symlink_merge () {
>> resolve_deleted_merge () {
>> while true; do
--- snip ---
>> ;;
>> - [aA]*)
>> + t,[sS]*)
>> + git log -p --merge "$MERGED"
>> + printf "\n"
>> + resolve_deleted_merge
>> + return
>> + ;;
Resursion as above, but why not fall out to the 'while true' again?
>> @@ -184,8 +203,23 @@ merge_file () {
>> describe_file "$local_mode" "local" "$LOCAL"
>> describe_file "$remote_mode" "remote" "$REMOTE"
>> if "$prompt" = true; then
>> - printf "Hit return to start merge resolution tool (%s): " "$merge_tool"
>> - read ans
>> + while true; do
>> + case $in_merge in
>> + t) msg_head="(S)how changes, or h" ;;
>> + f) msg_head="H" ;;
>> + esac
>> + print "${msg_head}it return to start merge resolution tool (%s): " "$merge_tool"
>> + read ans
>> + case "$in_merge,$ans" in
>> + t,[sS]*)
>> + git log -p --merge "$MERGED"
>> + printf "\n"
>> + ;;
No recursion here, this feels a but more natural to me.
next prev parent reply other threads:[~2009-02-08 1:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-06 14:32 [PATCH] Offer to print changes while running git-mergetool Jonathan del Strother
2009-02-06 14:41 ` Jonathan del Strother
2009-02-06 17:47 ` Junio C Hamano
2009-02-06 19:08 ` Jonathan del Strother
2009-02-07 0:21 ` Junio C Hamano
2009-02-07 8:11 ` Junio C Hamano
2009-02-07 12:01 ` Jonathan del Strother
2009-02-08 1:24 ` Charles Bailey [this message]
2009-02-08 11:43 ` Jonathan del Strother
2009-02-08 12:38 ` Charles Bailey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=498E3456.1080509@hashpling.org \
--to=charles@hashpling.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jon.delStrother@bestbefore.tv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.