* [PATCH] rev-list: make "struct rev_list_info" static to the only user
@ 2025-07-18 23:58 Junio C Hamano
2025-07-19 6:35 ` Jeff King
2025-07-21 22:46 ` [PATCH] rev-list: update a NEEDSWORK comment Junio C Hamano
0 siblings, 2 replies; 9+ messages in thread
From: Junio C Hamano @ 2025-07-18 23:58 UTC (permalink / raw)
To: git
The structure has nothing to do with what "git bisect" does; as
nobody other than "git rev-list" implementation uses it, move it
as a private data type to builtin/rev-list.c
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* https://lore.kernel.org/git/xmqq1qdptffk.fsf@gitster.g/ had this
#leftoverbits tangent.
bisect.h | 8 --------
builtin/rev-list.c | 10 +++++++++-
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/bisect.h b/bisect.h
index 944439bfac..8621460f93 100644
--- a/bisect.h
+++ b/bisect.h
@@ -27,14 +27,6 @@ struct commit_list *filter_skipped(struct commit_list *list,
#define FIND_BISECTION_ALL (1u<<0)
#define FIND_BISECTION_FIRST_PARENT_ONLY (1u<<1)
-struct rev_list_info {
- struct rev_info *revs;
- int flags;
- int show_timestamp;
- int hdr_termination;
- const char *header_prefix;
-};
-
/*
* enum bisect_error represents the following return codes:
* BISECT_OK: success code. Internally, it means that next
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 0984b607bf..0a89f4cbf7 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -28,6 +28,14 @@
#include "quote.h"
#include "strbuf.h"
+struct rev_list_info {
+ struct rev_info *revs;
+ int flags;
+ int show_timestamp;
+ int hdr_termination;
+ const char *header_prefix;
+};
+
static const char rev_list_usage[] =
"git rev-list [<options>] <commit>... [--] [<path>...]\n"
"\n"
@@ -652,7 +660,7 @@ int cmd_rev_list(int argc,
*/
/*
* NEEDSWORK: These loops that attempt to find presence of
- * options without understanding that the options they are
+ * options without understanding the options they are
* skipping are broken (e.g., it would not know "--grep
* --exclude-promisor-objects" is not triggering
* "--exclude-promisor-objects" option). We really need
--
2.50.1-446-g8227aac02a
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] rev-list: make "struct rev_list_info" static to the only user
2025-07-18 23:58 [PATCH] rev-list: make "struct rev_list_info" static to the only user Junio C Hamano
@ 2025-07-19 6:35 ` Jeff King
2025-07-19 12:36 ` René Scharfe
2025-07-21 22:46 ` [PATCH] rev-list: update a NEEDSWORK comment Junio C Hamano
1 sibling, 1 reply; 9+ messages in thread
From: Jeff King @ 2025-07-19 6:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Fri, Jul 18, 2025 at 04:58:03PM -0700, Junio C Hamano wrote:
> The structure has nothing to do with what "git bisect" does; as
> nobody other than "git rev-list" implementation uses it, move it
> as a private data type to builtin/rev-list.c
Nice improvement.
> @@ -652,7 +660,7 @@ int cmd_rev_list(int argc,
> */
> /*
> * NEEDSWORK: These loops that attempt to find presence of
> - * options without understanding that the options they are
> + * options without understanding the options they are
> * skipping are broken (e.g., it would not know "--grep
> * --exclude-promisor-objects" is not triggering
> * "--exclude-promisor-objects" option). We really need
This tacked-on bit seems funny to me. Isn't the original more correct?
The loops do not understand that the options are broken.
-Peff
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rev-list: make "struct rev_list_info" static to the only user
2025-07-19 6:35 ` Jeff King
@ 2025-07-19 12:36 ` René Scharfe
2025-07-20 0:04 ` Jeff King
2025-07-20 0:41 ` Junio C Hamano
0 siblings, 2 replies; 9+ messages in thread
From: René Scharfe @ 2025-07-19 12:36 UTC (permalink / raw)
To: Jeff King, Junio C Hamano; +Cc: git
On 7/19/25 8:35 AM, Jeff King wrote:
> On Fri, Jul 18, 2025 at 04:58:03PM -0700, Junio C Hamano wrote:
>
>> The structure has nothing to do with what "git bisect" does; as
>> nobody other than "git rev-list" implementation uses it, move it
>> as a private data type to builtin/rev-list.c
>
> Nice improvement.
*nod*
>> @@ -652,7 +660,7 @@ int cmd_rev_list(int argc,
>> */
>> /*
>> * NEEDSWORK: These loops that attempt to find presence of
>> - * options without understanding that the options they are
>> + * options without understanding the options they are
>> * skipping are broken (e.g., it would not know "--grep
>> * --exclude-promisor-objects" is not triggering
>> * "--exclude-promisor-objects" option). We really need
>
> This tacked-on bit seems funny to me. Isn't the original more correct?
> The loops do not understand that the options are broken.
No, the options are fine, but the loops are broken -- they cannot tell
what they are looking at is an option or an argument of a preceding
option, yet they ignore that latter possibility. So the word "that"
is best left out. I also don't see a connection to the struct move,
though.
René
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rev-list: make "struct rev_list_info" static to the only user
2025-07-19 12:36 ` René Scharfe
@ 2025-07-20 0:04 ` Jeff King
2025-07-20 0:41 ` Junio C Hamano
1 sibling, 0 replies; 9+ messages in thread
From: Jeff King @ 2025-07-20 0:04 UTC (permalink / raw)
To: René Scharfe; +Cc: Junio C Hamano, git
On Sat, Jul 19, 2025 at 02:36:04PM +0200, René Scharfe wrote:
> >> @@ -652,7 +660,7 @@ int cmd_rev_list(int argc,
> >> */
> >> /*
> >> * NEEDSWORK: These loops that attempt to find presence of
> >> - * options without understanding that the options they are
> >> + * options without understanding the options they are
> >> * skipping are broken (e.g., it would not know "--grep
> >> * --exclude-promisor-objects" is not triggering
> >> * "--exclude-promisor-objects" option). We really need
> >
> > This tacked-on bit seems funny to me. Isn't the original more correct?
> > The loops do not understand that the options are broken.
>
> No, the options are fine, but the loops are broken -- they cannot tell
> what they are looking at is an option or an argument of a preceding
> option, yet they ignore that latter possibility. So the word "that"
> is best left out. I also don't see a connection to the struct move,
> though.
Ah, yeah, that makes more sense. It is an awkward sentence either way. :)
-Peff
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rev-list: make "struct rev_list_info" static to the only user
2025-07-19 12:36 ` René Scharfe
2025-07-20 0:04 ` Jeff King
@ 2025-07-20 0:41 ` Junio C Hamano
1 sibling, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2025-07-20 0:41 UTC (permalink / raw)
To: René Scharfe; +Cc: Jeff King, git
René Scharfe <l.s.r@web.de> writes:
>>> * NEEDSWORK: These loops that attempt to find presence of
>>> - * options without understanding that the options they are
>>> + * options without understanding the options they are
>>> * skipping are broken (e.g., it would not know "--grep
>>> * --exclude-promisor-objects" is not triggering
>>> * "--exclude-promisor-objects" option). We really need
>>
>> This tacked-on bit seems funny to me. Isn't the original more correct?
>> The loops do not understand that the options are broken.
>
> No, the options are fine, but the loops are broken -- they cannot tell
> what they are looking at is an option or an argument of a preceding
> option, yet they ignore that latter possibility. So the word "that"
> is best left out.
Or "... understanding the options, which they are skipping, are
broken", perhaps.
> I also don't see a connection to the struct move,
> though.
True, this has nothing to do with the main theme of the patch.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] rev-list: update a NEEDSWORK comment
2025-07-18 23:58 [PATCH] rev-list: make "struct rev_list_info" static to the only user Junio C Hamano
2025-07-19 6:35 ` Jeff King
@ 2025-07-21 22:46 ` Junio C Hamano
2025-07-22 8:16 ` Jeff King
2025-07-22 8:41 ` Kristoffer Haugsbakk
1 sibling, 2 replies; 9+ messages in thread
From: Junio C Hamano @ 2025-07-21 22:46 UTC (permalink / raw)
To: git
The comment was poorly phrased and it wasn't clear what it wanted to
say. Strongly discourage this broken pattern to be copied and
pasted to other code paths.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Obviously, fixing this broken code is left as an exercise for
readers, as a #leftoverbits item.
builtin/rev-list.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git c/builtin/rev-list.c w/builtin/rev-list.c
index 2bb6360ec1..7549114635 100644
--- c/builtin/rev-list.c
+++ w/builtin/rev-list.c
@@ -658,17 +658,21 @@ int cmd_rev_list(int argc,
*
* Let "--missing" to conditionally set fetch_if_missing.
*/
+
/*
- * NEEDSWORK: These loops that attempt to find presence of
- * options without understanding that the options they are
- * skipping are broken (e.g., it would not know "--grep
+ * NEEDSWORK: The next loop is utterly broken. It tries to
+ * notice an option is used, but without understanding if each
+ * option takes an argument, which fundamentally would not
+ * work. It would not know "--grep
* --exclude-promisor-objects" is not triggering
- * "--exclude-promisor-objects" option). We really need
- * setup_revisions() to have a mechanism to allow and disallow
- * some sets of options for different commands (like rev-list,
- * replay, etc). Such a mechanism should do an early parsing
- * of options and be able to manage the `--missing=...` and
- * `--exclude-promisor-objects` options below.
+ * "--exclude-promisor-objects" option, for example.
+ *
+ * We really need setup_revisions() to have a mechanism to
+ * allow and disallow some sets of options for different
+ * commands (like rev-list, replay, etc). Such a mechanism
+ * should do an early parsing of options and be able to manage
+ * the `--missing=...` and `--exclude-promisor-objects`
+ * options below.
*/
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] rev-list: update a NEEDSWORK comment
2025-07-21 22:46 ` [PATCH] rev-list: update a NEEDSWORK comment Junio C Hamano
@ 2025-07-22 8:16 ` Jeff King
2025-07-22 8:41 ` Kristoffer Haugsbakk
1 sibling, 0 replies; 9+ messages in thread
From: Jeff King @ 2025-07-22 8:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Mon, Jul 21, 2025 at 03:46:42PM -0700, Junio C Hamano wrote:
> The comment was poorly phrased and it wasn't clear what it wanted to
> say. Strongly discourage this broken pattern to be copied and
> pasted to other code paths.
Thanks, I was much less confused after your re-wording.
-Peff
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rev-list: update a NEEDSWORK comment
2025-07-21 22:46 ` [PATCH] rev-list: update a NEEDSWORK comment Junio C Hamano
2025-07-22 8:16 ` Jeff King
@ 2025-07-22 8:41 ` Kristoffer Haugsbakk
2025-07-22 13:18 ` Junio C Hamano
1 sibling, 1 reply; 9+ messages in thread
From: Kristoffer Haugsbakk @ 2025-07-22 8:41 UTC (permalink / raw)
To: Junio C Hamano, git
On Tue, Jul 22, 2025, at 00:46, Junio C Hamano wrote:
> The comment was poorly phrased and it wasn't clear what it wanted to
> say. Strongly discourage this broken pattern to be copied and
> pasted to other code paths.
Why “was”? Shouldn’t it be “The comment is poorly phrased ... so
[change it]”. According to SubmittingPatches, “present-tense”.
/nitpick
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rev-list: update a NEEDSWORK comment
2025-07-22 8:41 ` Kristoffer Haugsbakk
@ 2025-07-22 13:18 ` Junio C Hamano
0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2025-07-22 13:18 UTC (permalink / raw)
To: Kristoffer Haugsbakk; +Cc: git
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:
> On Tue, Jul 22, 2025, at 00:46, Junio C Hamano wrote:
>> The comment was poorly phrased and it wasn't clear what it wanted to
>> say. Strongly discourage this broken pattern to be copied and
>> pasted to other code paths.
>
> Why “was”? Shouldn’t it be “The comment is poorly phrased ... so
> [change it]”. According to SubmittingPatches, “present-tense”.
True. Thanks for spotting.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-07-22 13:18 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-18 23:58 [PATCH] rev-list: make "struct rev_list_info" static to the only user Junio C Hamano
2025-07-19 6:35 ` Jeff King
2025-07-19 12:36 ` René Scharfe
2025-07-20 0:04 ` Jeff King
2025-07-20 0:41 ` Junio C Hamano
2025-07-21 22:46 ` [PATCH] rev-list: update a NEEDSWORK comment Junio C Hamano
2025-07-22 8:16 ` Jeff King
2025-07-22 8:41 ` Kristoffer Haugsbakk
2025-07-22 13:18 ` Junio C Hamano
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).