From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
Jiang Xin <zhiyou.jx@alibaba-inc.com>,
Emily Shaffer <emilyshaffer@google.com>,
Jonathan Tan <jonathantanmy@google.com>,
Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH v3 4/4] pack-objects.c: make use of REV_INFO_STDIN_LINE_PROCESS
Date: Thu, 08 Jul 2021 15:21:43 -0700 [thread overview]
Message-ID: <xmqqmtqwa1l4.fsf@gitster.g> (raw)
In-Reply-To: <patch-4.4-34750ab81cf-20210621T150651Z-avarab@gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Mon, 21 Jun 2021 17:10:16 +0200")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> @@ -3758,28 +3758,25 @@ static void mark_bitmap_preferred_tips(void)
> static enum rev_info_stdin_line get_object_list_handle_stdin_line(
> struct rev_info *revs, struct strbuf *line_sb, void *stdin_line_priv)
> {
> - int *flags = stdin_line_priv;
> char *line = line_sb->buf;
>
> - if (*line == '-') {
> - if (!strcmp(line, "--not")) {
> - *flags ^= UNINTERESTING;
> - write_bitmap_index = 0;
> - return REV_INFO_STDIN_LINE_CONTINUE;
> - }
> - if (starts_with(line, "--shallow ")) {
> - struct object_id oid;
> - if (get_oid_hex(line + 10, &oid))
> - die("not an object name '%s'", line + 10);
> - register_shallow(the_repository, &oid);
> - use_bitmap_index = 0;
> - return REV_INFO_STDIN_LINE_CONTINUE;
> - }
> + if (*line != '-')
> + return REV_INFO_STDIN_LINE_PROCESS;
> +
> + if (!strcmp(line, "--not")) {
> + revs->revarg_flags ^= UNINTERESTING;
> + write_bitmap_index = 0;
> + return REV_INFO_STDIN_LINE_CONTINUE;
> + } else if (starts_with(line, "--shallow ")) {
> + struct object_id oid;
> + if (get_oid_hex(line + 10, &oid))
> + die("not an object name '%s'", line + 10);
> + register_shallow(the_repository, &oid);
> + use_bitmap_index = 0;
> + return REV_INFO_STDIN_LINE_CONTINUE;
> + } else {
> die(_("not a rev '%s'"), line);
> }
> - if (handle_revision_arg(line, revs, *flags, REVARG_CANNOT_BE_FILENAME))
> - die(_("bad revision '%s'"), line);
> - return REV_INFO_STDIN_LINE_CONTINUE;
> }
Now, this does make things slightly more modular (specifically, it
no longer is necessary for handle_revision_arg() to be visible
outside revision.c).
Having said that, it is not immediately obvious if the amount of
code churn by 3/4 and 4/4 is justified. This still looks more like
"we can add a new API, so we added it" than "we needed a new API for
such and such reasons---now we can do this more easily then before".
It's not wrong per-se, but I am not all that impressed. Sorry.
next prev parent reply other threads:[~2021-07-08 22:21 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 12:16 [PATCH 0/4] pack-objects: use revision.c's --stdin parsing Ævar Arnfjörð Bjarmason
2021-06-08 12:16 ` [PATCH 1/4] upload-pack: run is_repository_shallow() before setup_revisions() Ævar Arnfjörð Bjarmason
2021-06-08 12:16 ` [PATCH 2/4] revision.h: unify "disable_stdin" and "read_from_stdin" Ævar Arnfjörð Bjarmason
2021-06-08 12:16 ` [PATCH 3/4] pack-objects.c: do stdin parsing via revision.c's API Ævar Arnfjörð Bjarmason
2021-06-09 8:10 ` Junio C Hamano
2021-06-08 12:16 ` [PATCH 4/4] pack-objects.c: make use of REV_INFO_STDIN_LINE_PROCESS Ævar Arnfjörð Bjarmason
2021-06-17 10:57 ` [PATCH v2 0/4] pack-objects: use revision.c's --stdin parsing Ævar Arnfjörð Bjarmason
2021-06-17 10:57 ` [PATCH v2 1/4] upload-pack: run is_repository_shallow() before setup_revisions() Ævar Arnfjörð Bjarmason
2021-06-17 10:57 ` [PATCH v2 2/4] revision.h: unify "disable_stdin" and "read_from_stdin" Ævar Arnfjörð Bjarmason
2021-06-17 23:44 ` Emily Shaffer
2021-06-18 17:54 ` Jonathan Tan
2021-06-17 10:57 ` [PATCH v2 3/4] pack-objects.c: do stdin parsing via revision.c's API Ævar Arnfjörð Bjarmason
2021-06-18 18:57 ` Jonathan Tan
2021-06-17 10:57 ` [PATCH v2 4/4] pack-objects.c: make use of REV_INFO_STDIN_LINE_PROCESS Ævar Arnfjörð Bjarmason
2021-06-21 15:10 ` [PATCH v3 0/4] pack-objects: use revision.c's --stdin parsing Ævar Arnfjörð Bjarmason
2021-06-21 15:10 ` [PATCH v3 1/4] upload-pack: run is_repository_shallow() before setup_revisions() Ævar Arnfjörð Bjarmason
2021-06-21 15:10 ` [PATCH v3 2/4] revision.h: refactor "disable_stdin" and "read_from_stdin" Ævar Arnfjörð Bjarmason
2021-07-08 22:10 ` Junio C Hamano
2021-06-21 15:10 ` [PATCH v3 3/4] pack-objects.c: do stdin parsing via revision.c's API Ævar Arnfjörð Bjarmason
2021-07-08 22:21 ` Junio C Hamano
2021-06-21 15:10 ` [PATCH v3 4/4] pack-objects.c: make use of REV_INFO_STDIN_LINE_PROCESS Ævar Arnfjörð Bjarmason
2021-07-08 22:21 ` Junio C Hamano [this message]
2021-07-09 11:06 ` [PATCH v4 0/5] revision.[ch]: add --stdin parsing API, use in pack-objects Ævar Arnfjörð Bjarmason
2021-07-09 11:06 ` [PATCH v4 1/5] upload-pack: run is_repository_shallow() before setup_revisions() Ævar Arnfjörð Bjarmason
2021-07-09 11:06 ` [PATCH v4 2/5] revision.h: refactor "disable_stdin" and "read_from_stdin" Ævar Arnfjörð Bjarmason
2021-07-09 20:17 ` Junio C Hamano
2021-07-09 11:06 ` [PATCH v4 3/5] revision.[ch]: add a "handle_stdin_line" API Ævar Arnfjörð Bjarmason
2021-07-09 11:06 ` [PATCH v4 4/5] pack-objects.c: do stdin parsing via revision.c's API Ævar Arnfjörð Bjarmason
2021-07-09 11:06 ` [PATCH v4 5/5] pack-objects.c: make use of REV_INFO_STDIN_LINE_PROCESS Ævar Arnfjörð Bjarmason
2021-07-26 12:46 ` [PATCH v5 0/5] add --stdin parsing API, use in pack-objects Ævar Arnfjörð Bjarmason
2021-07-26 12:46 ` [PATCH v5 1/5] upload-pack: run is_repository_shallow() before setup_revisions() Ævar Arnfjörð Bjarmason
2021-07-26 12:46 ` [PATCH v5 2/5] revision.h: refactor "disable_stdin" and "read_from_stdin" Ævar Arnfjörð Bjarmason
2021-07-26 12:46 ` [PATCH v5 3/5] revision.[ch]: add a "handle_stdin_line" API Ævar Arnfjörð Bjarmason
2021-07-26 12:46 ` [PATCH v5 4/5] pack-objects.c: do stdin parsing via revision.c's API Ævar Arnfjörð Bjarmason
2021-07-26 12:46 ` [PATCH v5 5/5] pack-objects.c: make use of REV_INFO_STDIN_LINE_PROCESS Ævar Arnfjörð Bjarmason
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=xmqqmtqwa1l4.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=emilyshaffer@google.com \
--cc=git@vger.kernel.org \
--cc=jonathantanmy@google.com \
--cc=me@ttaylorr.com \
--cc=peff@peff.net \
--cc=zhiyou.jx@alibaba-inc.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).