From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Karthik Nayak <karthik.188@gmail.com>, git@vger.kernel.org, ps@pks.im
Subject: Re: [PATCH v2 0/6] update-ref: add symref support for --stdin
Date: Thu, 23 May 2024 14:46:24 -0700 [thread overview]
Message-ID: <xmqqbk4wrykv.fsf@gitster.g> (raw)
In-Reply-To: <CAPig+cT6_j80vh_HEjg6HWKXpkv-huggudShh_RgzLSKvV_bOA@mail.gmail.com> (Eric Sunshine's message of "Thu, 23 May 2024 13:59:43 -0400")
Eric Sunshine <sunshine@sunshineco.com> writes:
>> (and at the end of the patch for a single patch topic).
>
> This could indeed lead to less visual clutter for the single-patch topic.
So here is how such a change looks like. I actually have this as a
two-patch series in my tree, but here is in squashed-into-one form.
The log-tree.c:show_log() function has a logic to create inter/range
diff at its end. This function is called early by log_tree_diff(),
which is responsible for showing a single commit (log message,
auxiliary info like diffstat, and the patch, right before the
signature mark "-- " which is given by the format-patch itself).
We move that inter/range logic out into a helper function and call
it at the original place (which is [1/2] step of the two patch
series), which is a no-op refactoring.
In the second step, we remove the call out of show_log(), and
instead call it at the end of the log_tree_commit() after
log_tree_diff() did its thing. This removes the inter/range diff
out of the "auxiliary info" section between "---" and the patch and
moves it at the end of the patch text, still before the signature
mark "-- ". As this makes inter/range diff no longer part of the
runs of "commentary block"s, calls to next_commentary_block() is
removed from the show_diff_of_diff() helper.
As expected, this requires adjustment to t/t4014-format-patch.sh but
the fallout is surprisingly small. It may be either an indication
that our test coverage for the feature is sketchy, or the tests were
written robustly, anticipating that somebody someday may want to
move things around in the output this way.
log-tree.c | 7 +++----
t/t4014-format-patch.sh | 17 +++++++++++------
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git c/log-tree.c w/log-tree.c
index e7cd2c491f..f28c4d0bb0 100644
--- c/log-tree.c
+++ w/log-tree.c
@@ -684,7 +684,6 @@ static void show_diff_of_diff(struct rev_info *opt)
memcpy(&dq, &diff_queued_diff, sizeof(diff_queued_diff));
DIFF_QUEUE_CLEAR(&diff_queued_diff);
- next_commentary_block(opt, NULL);
fprintf_ln(opt->diffopt.file, "%s", opt->idiff_title);
show_interdiff(opt->idiff_oid1, opt->idiff_oid2, 2,
&opt->diffopt);
@@ -704,7 +703,6 @@ static void show_diff_of_diff(struct rev_info *opt)
memcpy(&dq, &diff_queued_diff, sizeof(diff_queued_diff));
DIFF_QUEUE_CLEAR(&diff_queued_diff);
- next_commentary_block(opt, NULL);
fprintf_ln(opt->diffopt.file, "%s", opt->rdiff_title);
/*
* Pass minimum required diff-options to range-diff; others
@@ -903,8 +901,6 @@ void show_log(struct rev_info *opt)
strbuf_release(&msgbuf);
free(ctx.notes_message);
free(ctx.after_subject);
-
- show_diff_of_diff(opt);
}
int log_tree_diff_flush(struct rev_info *opt)
@@ -1176,6 +1172,9 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
opt->loginfo = NULL;
maybe_flush_or_die(opt->diffopt.file, "stdout");
opt->diffopt.no_free = no_free;
+ if (shown)
+ show_diff_of_diff(opt);
+
diff_free(&opt->diffopt);
return shown;
}
diff --git c/t/t4014-format-patch.sh w/t/t4014-format-patch.sh
index ba85b582c5..c0c5eccb7c 100755
--- c/t/t4014-format-patch.sh
+++ w/t/t4014-format-patch.sh
@@ -2482,13 +2482,18 @@ test_expect_success 'interdiff: reroll-count with a integer' '
'
test_expect_success 'interdiff: solo-patch' '
- cat >expect <<-\EOF &&
- +fleep
-
- EOF
git format-patch --interdiff=boop~2 -1 boop &&
- test_grep "^Interdiff:$" 0001-fleep.patch &&
- sed "1,/^ @@ /d; /^$/q" 0001-fleep.patch >actual &&
+
+ # remove up to the last "patch" output line,
+ # and remove everything below the signature mark.
+ sed -e "1,/^+fleep\$/d" -e "/^-- /,\$d" 0001-fleep.patch >actual &&
+
+ # fabricate Interdiff output.
+ git diff boop~2 boop >inter &&
+ {
+ echo "Interdiff:" &&
+ sed -e "s/^/ /" inter
+ } >expect &&
test_cmp expect actual
'
next prev parent reply other threads:[~2024-05-23 21:46 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 12:44 [PATCH 0/6] update-ref: add symref support for --stdin Karthik Nayak
2024-05-14 12:44 ` [PATCH 1/6] refs: create and use `ref_update_ref_must_exist()` Karthik Nayak
2024-05-16 11:09 ` Patrick Steinhardt
2024-05-17 13:08 ` Karthik Nayak
2024-05-14 12:44 ` [PATCH 2/6] update-ref: add support for 'symref-verify' command Karthik Nayak
2024-05-16 11:09 ` Patrick Steinhardt
2024-05-17 16:21 ` Karthik Nayak
2024-05-21 6:41 ` Patrick Steinhardt
2024-05-14 12:44 ` [PATCH 3/6] update-ref: add support for 'symref-delete' command Karthik Nayak
2024-05-16 11:09 ` Patrick Steinhardt
2024-05-14 12:44 ` [PATCH 4/6] update-ref: add support for 'symref-create' command Karthik Nayak
2024-05-16 11:09 ` Patrick Steinhardt
2024-05-19 14:01 ` Karthik Nayak
2024-05-14 12:44 ` [PATCH 5/6] reftable: pick either 'oid' or 'target' for new updates Karthik Nayak
2024-05-14 12:44 ` [PATCH 6/6] update-ref: add support for 'symref-update' command Karthik Nayak
2024-05-16 11:09 ` Patrick Steinhardt
2024-05-21 9:49 ` Karthik Nayak
2024-05-22 7:59 ` Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 0/6] update-ref: add symref support for --stdin Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 1/6] refs: create and use `ref_update_expects_existing_old_ref()` Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 2/6] update-ref: add support for 'symref-verify' command Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 3/6] update-ref: add support for 'symref-delete' command Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 4/6] update-ref: add support for 'symref-create' command Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 5/6] reftable: pick either 'oid' or 'target' for new updates Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 6/6] update-ref: add support for 'symref-update' command Karthik Nayak
2024-05-25 23:00 ` Junio C Hamano
2024-05-29 8:29 ` Karthik Nayak
2024-05-23 15:02 ` [PATCH v2 0/6] update-ref: add symref support for --stdin Junio C Hamano
2024-05-23 15:52 ` Karthik Nayak
2024-05-23 16:29 ` Junio C Hamano
2024-05-23 17:50 ` Karthik Nayak
2024-05-23 17:59 ` Eric Sunshine
2024-05-23 18:08 ` Junio C Hamano
2024-05-23 18:50 ` Eric Sunshine
2024-05-23 19:06 ` Junio C Hamano
2024-05-23 21:46 ` Junio C Hamano [this message]
2024-05-23 16:03 ` Junio C Hamano
2024-05-30 12:09 ` [PATCH v3 " Karthik Nayak
2024-06-05 8:02 ` Patrick Steinhardt
2024-05-30 12:09 ` [PATCH v3 1/6] refs: create and use `ref_update_expects_existing_old_ref()` Karthik Nayak
2024-05-30 12:09 ` [PATCH v3 2/6] update-ref: add support for 'symref-verify' command Karthik Nayak
2024-05-30 12:09 ` [PATCH v3 3/6] update-ref: add support for 'symref-delete' command Karthik Nayak
2024-06-05 8:02 ` Patrick Steinhardt
2024-06-05 9:31 ` Karthik Nayak
2024-06-05 16:22 ` Junio C Hamano
2024-05-30 12:09 ` [PATCH v3 4/6] update-ref: add support for 'symref-create' command Karthik Nayak
2024-06-05 8:02 ` Patrick Steinhardt
2024-05-30 12:09 ` [PATCH v3 5/6] reftable: pick either 'oid' or 'target' for new updates Karthik Nayak
2024-05-30 12:09 ` [PATCH v3 6/6] update-ref: add support for 'symref-update' command Karthik Nayak
2024-06-05 8:02 ` Patrick Steinhardt
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=xmqqbk4wrykv.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=ps@pks.im \
--cc=sunshine@sunshineco.com \
/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 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).