Skip to contentSkip to conversation

bash-completions: add --[no-]graph-indent

PATCH In review Mirko Faina 5 participants 9 messages Oct 13 – Nov 9

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bash-completions: add --[no-]graph-indent

Add missing completion for "git log --graph-indent" and "git log --no-graph-indent".

---
 contrib/completion/git-completion.bash | 1 +
 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
index c3a49e2e22..2348a3cfb9 100644
@@ -2298,6 +2298,7 @@ __git_log_common_options="
 	--right-only --show-linear-break
 	--show-notes-by-default --show-pulls
 	--since-as-filter --single-worktree
+	--graph-indent --no-graph-indent
 "
 # Options that go well for log and gitk (not shortlog)
 __git_log_gitk_options="

base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd

Signature · 1 line
2.56.0
#1 lore raw

Cc'ing Pablo since he was the author of the topic related to "--graph-indent".

#2 lore raw
In reply to Mirko Faina

[Cc'd Toon because of the mention]

Quoted 13 lines · Mirko Faina

Add missing completion for "git log --graph-indent" and "git log --no-graph-indent".

---
 contrib/completion/git-completion.bash | 1 +
 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +0 -0
index c3a49e2e22..2348a3cfb9 100644

contrib/completion/git-completion.bash __git_log_common_options=" · line 2301

Quoted 4 lines
contrib/completion/git-completion.bash +1 -0
@@ -2298,6 +2298,7 @@ __git_log_common_options="
 	--right-only --show-linear-break
 	--show-notes-by-default --show-pulls
 	--since-as-filter --single-worktree
+	--graph-indent --no-graph-indent

Thanks for Cc'ing.

I didn't know about this so I completely forgot to add it, however from what I read, this is the __git_log_common_options and I'm not sure if this is a "common" opt, as I don't even see --graph here.

I searched where --graph is, and it's here:

l 2383-2409 'git-completion.bash'

	__gitcomp "
[more opts]
		--graph
[more opts]
		$merge
		$__git_diff_common_options
		"
	return
	;;

I think it would fit better here (not sure, I just quickly skimmed the file).

Also, I missed this for the --graph-lane-limit option so maybe it should be added too?

My main doubt is, both these options proposed (yours and --graph-lane-limit) are --graph dependent, which means if someone autocompletes them but doesn't use --graph, they will get an error saying that --graph is needed. I'd say we do what other --graph dependent options do, but AFAIK these two are the only ones.

From Toon's Git Merge talk, more options for --graph option will be developed so we should maybe think about how to do it in a way that doesn't autocomplete if it's going to error? (maybe that does exist, given the multiple options that depend on other options)

Quoted 5 lines
contrib/completion/git-completion.bash +0 -0
 "
 # Options that go well for log and gitk (not shortlog)
 __git_log_gitk_options="

base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd

Thanks,
Pablo

#3 lore raw
Quoted 26 lines · Pablo Sabater

[Cc'd Toon because of the mention]

Quoted 14 lines · Mirko Faina

Add missing completion for "git log --graph-indent" and "git log --no-graph-indent".

---
contrib/completion/git-completion.bash | 1 +

1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +0 -0
index c3a49e2e22..2348a3cfb9 100644

contrib/completion/git-completion.bash __git_log_common_options=" · line 2301

Quoted 4 lines
contrib/completion/git-completion.bash +1 -0
@@ -2298,6 +2298,7 @@ __git_log_common_options="
   --right-only --show-linear-break
   --show-notes-by-default --show-pulls
   --since-as-filter --single-worktree
+    --graph-indent --no-graph-indent

Thanks for Cc'ing.

Quoted 3 lines

I didn't know about this so I completely forgot to add it, however from what I read, this is the __git_log_common_options and I'm not sure if this is a "common" opt, as I don't even see --graph here.

From memory, I think « common » means « useful for multiple completions » (common to multiple commands), not
« commonly typed »?

Quoted 26 lines

I searched where --graph is, and it's here:

l 2383-2409 'git-completion.bash'

   __gitcomp "
[more opts]
       --graph
[more opts]
       $merge
       $__git_diff_common_options
       "

return
;;

I think it would fit better here (not sure, I just quickly skimmed the file).

Also, I missed this for the --graph-lane-limit option so maybe it should be added too?

My main doubt is, both these options proposed (yours and --graph-lane-limit) are --graph dependent, which means if someone autocompletes them but doesn't use --graph, they will get an error saying that --graph is needed. I'd say we do what other --graph dependent options do, but AFAIK these two are the only ones.

Quoted 4 lines

From Toon's Git Merge talk, more options for --graph option will be developed so we should maybe think about how to do it in a way that doesn't autocomplete if it's going to error? (maybe that does exist, given the multiple options that depend on other options)

Sounds reasonable, though I also wonder if these commands could eventually be taught to give their own completion help like all the parseopt users.

#4 lore raw
In reply to Pablo Sabater
Quoted 18 lines · Pablo Sabater

I didn't know about this so I completely forgot to add it, however from what I read, this is the __git_log_common_options and I'm not sure if this is a "common" opt, as I don't even see --graph here.

I searched where --graph is, and it's here:

l 2383-2409 'git-completion.bash'

	__gitcomp "
[more opts]
		--graph
[more opts]
		$merge
		$__git_diff_common_options
		"
	return
	;;
Quoted 2 lines

I think it would fit better here (not sure, I just quickly skimmed the file).

Yes, you're right. I was on automatic mode when choosing where to place it and defaulted to the place where I put an option of mine that worked for log. Since this is specific to "git log" I'll place it where you suggested.

Quoted 2 lines

Also, I missed this for the --graph-lane-limit option so maybe it should be added too?

Not familiar with the option but will look into it, might as well add it.

Quoted 10 lines

My main doubt is, both these options proposed (yours and --graph-lane-limit) are --graph dependent, which means if someone autocompletes them but doesn't use --graph, they will get an error saying that --graph is needed. I'd say we do what other --graph dependent options do, but AFAIK these two are the only ones.

From Toon's Git Merge talk, more options for --graph option will be developed so we should maybe think about how to do it in a way that doesn't autocomplete if it's going to error? (maybe that does exist, given the multiple options that depend on other options)

From what I can tell the only reason we options through bash-completions is because these options are not handled by the parse-options.h machinery. Ideally we'd want to port these options to that? I'm assuming the reason it wasn't was because of the common options.

With the parse-options.h machinery you can't tell which option depends on which other, so it just shows every option available for a command when autocompleting. I'm not sure it's worth it to implement such a feature with bash-completions when the parse-options.h machinery doesn't.

Thank you for the review, will reroll.
Mirko Faina

#5 lore raw
Quoted 49 lines · Mirko Faina
Quoted 18 lines · Pablo Sabater

I didn't know about this so I completely forgot to add it, however from what I read, this is the __git_log_common_options and I'm not sure if this is a "common" opt, as I don't even see --graph here.

I searched where --graph is, and it's here:

l 2383-2409 'git-completion.bash'

	__gitcomp "
[more opts]
		--graph
[more opts]
		$merge
		$__git_diff_common_options
		"
	return
	;;
Quoted 2 lines

I think it would fit better here (not sure, I just quickly skimmed the file).

Yes, you're right. I was on automatic mode when choosing where to place it and defaulted to the place where I put an option of mine that worked for log. Since this is specific to "git log" I'll place it where you suggested.

Quoted 2 lines

Also, I missed this for the --graph-lane-limit option so maybe it should be added too?

Not familiar with the option but will look into it, might as well add it.

Quoted 10 lines

My main doubt is, both these options proposed (yours and --graph-lane-limit) are --graph dependent, which means if someone autocompletes them but doesn't use --graph, they will get an error saying that --graph is needed. I'd say we do what other --graph dependent options do, but AFAIK these two are the only ones.

From Toon's Git Merge talk, more options for --graph option will be developed so we should maybe think about how to do it in a way that doesn't autocomplete if it's going to error? (maybe that does exist, given the multiple options that depend on other options)

From what I can tell the only reason we options through bash-completions is because these options are not handled by the parse-options.h machinery. Ideally we'd want to port these options to that? I'm assuming the reason it wasn't was because of the common options.

Quoted 5 lines

With the parse-options.h machinery you can't tell which option depends on which other, so it just shows every option available for a command when autocompleting. I'm not sure it's worth it to implement such a feature with bash-completions when the parse-options.h machinery doesn't.

Yes, I agree. It would be cool if parse-options.h would be smarter in this regard, but for now that's not the case, and I'm fine with that. I'm pretty sure (although I cannot think of any right now) there are other options (for other commands) that only work if combined.

I appreciate thinking about this, but that's something for the future.

Quoted 2 lines

Thank you for the review, will reroll.
Mirko Faina

Signature · 2 lines
Laters,
Toon
#6 lore raw

PATCH v2 1/1 completions: add some missing options for git log

In reply to Mirko Faina

Some options for "git log" are missing in bash-completions, --graph-lane-limit introduced in [1] and --[no-]graph-indent introduced in [2].

Teach bash-completions to autocomplete these options.

[1] f756a3c78d (graph: add --graph-lane-limit option, 2026-03-28)
[2] e9b5720bef (graph: add --[no-]graph-indent and log.graphIndent, 2026-07-14)

---
 contrib/completion/git-completion.bash | 2 ++
 1 file changed, 2 insertions(+)
contrib/completion/git-completion.bash +2 -0
index c3a49e2e22..eab6309a69 100644
@@ -2395,6 +2395,8 @@ __git_complete_log_opts ()
 			--cherry-mark
 			--cherry-pick
 			--graph
+			--graph-indent --no-graph-indent
+			--graph-lane-limit=
 			--decorate --decorate= --no-decorate
 			--walk-reflogs
 			--no-walk --no-walk= --do-walk

base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd

Signature · 1 line
2.56.0
#7 lore raw

Re: [PATCH v2] completions: add some missing options for git log

Quoted 28 lines · Mirko Faina

Some options for "git log" are missing in bash-completions, --graph-lane-limit introduced in [1] and --[no-]graph-indent introduced in [2].

Teach bash-completions to autocomplete these options.

[1] f756a3c78d (graph: add --graph-lane-limit option, 2026-03-28)
[2] e9b5720bef (graph: add --[no-]graph-indent and log.graphIndent, 2026-07-14)

---
 contrib/completion/git-completion.bash | 2 ++
 1 file changed, 2 insertions(+)
contrib/completion/git-completion.bash +2 -0
index c3a49e2e22..eab6309a69 100644
@@ -2395,6 +2395,8 @@ __git_complete_log_opts ()
 			--cherry-mark
 			--cherry-pick
 			--graph
+			--graph-indent --no-graph-indent
+			--graph-lane-limit=
 			--decorate --decorate= --no-decorate
 			--walk-reflogs
 			--no-walk --no-walk= --do-walk
Quoted 3 lines

base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd

Signature · 1 line
2.56.0

I'm fine with these changes, they do what we want them to. Looks good to me.

Signature · 2 lines
Laters,
Toon
#8 lore raw

Re: [PATCH v2] completions: add some missing options for git log

Quoted 8 lines · Toon Claes
Quoted 3 lines · Mirko Faina

Some options for "git log" are missing in bash-completions, --graph-lane-limit introduced in [1] and --[no-]graph-indent introduced in [2].

I'm fine with these changes, they do what we want them to. Looks good to me.

Yeah, this looks good to me, too. Thanks, both.