Thread (1 message) 1 message, 1 author, 2018-05-08

Re: [PATCH v6 05/13] git.c: convert --list-* to --list-cmds=*

From: Junio C Hamano <hidden>
Date: 2018-05-08 03:50:43

Nguyễn Thái Ngọc Duy  [off-list ref] writes:
Even if these are hidden options, let's make them a bit more generic
since we're introducing more listing types shortly. The code is
structured to allow combining multiple listing types together because
we will soon add more types the 'builtins'.

'parseopt' remains separate because it has separate (SPC) to match
git-completion.bash needs and will not combine with others.
---
Missing sign-off.
+static int list_cmds(const char *spec)
+{
+	while (*spec) {
+		const char *sep = strchrnul(spec, ',');
+		int len = sep - spec;
+
+		if (len == 8 && !strncmp(spec, "builtins", 8))
+			list_builtins(0, '\n');
This is the origin of ugliness we see in later steps that follow the
same

	if (len == strlen(constS) && !strncmp(spec, constS, strlen(constS))

pattern added here.  Could we have a small helper that takes len,
spec, and constS to abstract "8" away?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help