threads / patch / 46092

patch, 6 partsSome more git config completions

Subject: [PATCH 0/6] Some more git config completions

## tl;dr

10 messages between Jun 1, 2017 and Jun 4, 2017. Diffs are folded; open one to read it.

replies: 9people: 4as markdown or json

Rikard Falkeborn· May 27, 2017, 06:25 UTC · lore

Some more completions (from what I could tell, there are probably more missing). Please let me know if you prefer them in smaller (or larger) batches (or if the patches aren't wanted at all).

Patches are based on master. 
Rikard Falkeborn (6):
  completion: Add git config gc completions
  completion: Add git config core completions
  completion: Add git config am.threeWay completion
  completion: Add git config advice completions
  completion: Add git config credential completions
  completion: Add git config credentialCache.ignoreSIGHUP
 contrib/completion/git-completion.bash | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
-- 
2.13.0
Rikard Falkeborn· May 27, 2017, 06:25 UTC · re: Rikard Falkeborn · lore

[PATCH 2/6] completion: Add git config core completions

Add missing completions for git config core:
* core.checkStat
* core.commentChar
* core.hideDotFiles
* core.hooksPath
* core.packedRefsTimeout
* core.precomposeUnicode
* core.protectHFS
* core.protectNTFS
* core.splitIndex
* core.sshCommand

Note that some configs are only used for some platforms (hideDotFiles on Windows and precomposeUnicode on Mac).

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 contrib/completion/git-completion.bash | 10 ++++++++++
 1 file changed, 10 insertions(+)
Show changes to contrib/completion/git-completion.bash +10 −0
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 4e5e2eaae..de9306173 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2403,6 +2403,8 @@ _git_config ()
 		core.autocrlf
 		core.bare
 		core.bigFileThreshold
+		core.checkStat
+		core.commentChar
 		core.compression
 		core.createObject
 		core.deltaBaseCacheLimit
@@ -2412,6 +2414,8 @@ _git_config ()
 		core.fileMode
 		core.fsyncobjectfiles
 		core.gitProxy
+		core.hideDotFiles
+		core.hooksPath
 		core.ignoreStat
 		core.ignorecase
 		core.logAllRefUpdates
@@ -2419,14 +2423,20 @@ _git_config ()
 		core.notesRef
 		core.packedGitLimit
 		core.packedGitWindowSize
+		core.packedRefsTimeout
 		core.pager
+		core.precomposeUnicode
 		core.preferSymlinkRefs
 		core.preloadindex
+		core.protectHFS
+		core.protectNTFS
 		core.quotepath
 		core.repositoryFormatVersion
 		core.safecrlf
 		core.sharedRepository
 		core.sparseCheckout
+		core.splitIndex
+		core.sshCommand
 		core.symlinks
 		core.trustctime
 		core.untrackedCache
-- 
2.13.0
Rikard Falkeborn· May 27, 2017, 06:25 UTC · re: Rikard Falkeborn · lore

[PATCH 1/6] completion: Add git config gc completions

Add missing completion for git config gc options:
* gc.aggressiveDepth
* gc.autoDetach
* gc.logExpiry
* gc.worktreePruneExpire
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 contrib/completion/git-completion.bash | 4 ++++
 1 file changed, 4 insertions(+)
Show changes to contrib/completion/git-completion.bash +4 −0
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 45a78a095..4e5e2eaae 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2464,15 +2464,19 @@ _git_config ()
 		format.thread
 		format.to
 		gc.
+		gc.aggressiveDepth
 		gc.aggressiveWindow
 		gc.auto
+		gc.autoDetach
 		gc.autopacklimit
+		gc.logExpiry
 		gc.packrefs
 		gc.pruneexpire
 		gc.reflogexpire
 		gc.reflogexpireunreachable
 		gc.rerereresolved
 		gc.rerereunresolved
+		gc.worktreePruneExpire
 		gitcvs.allbinary
 		gitcvs.commitmsgannotation
 		gitcvs.dbTableNamePrefix
-- 
2.13.0
Rikard Falkeborn· May 27, 2017, 06:25 UTC · re: Rikard Falkeborn · lore

[PATCH 4/6] completion: Add git config advice completions

Add missing completions for git config advice:
* advice.amWorkDir
* advice.pushAlreadyExists
* advice.pushFetchFirst
* advice.pushNeedsForce
* advice.pushNonFFCurrent
* advice.pushNonFFMatching
* advice.pushUpdateRejected
* advice.rmHints
* advice.statusUoption

Remove completion for git config advice.pushNonFastForward, since it was renamed to pushUpdateRejected in 1184564eac8e. The config still works, but is no longer part of the documentation.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 contrib/completion/git-completion.bash | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Show changes to contrib/completion/git-completion.bash +9 −1
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3a630a230..7efcb2a79 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2336,12 +2336,20 @@ _git_config ()
 	esac
 	__gitcomp "
 		add.ignoreErrors
+		advice.amWorkDir
 		advice.commitBeforeMerge
 		advice.detachedHead
 		advice.implicitIdentity
-		advice.pushNonFastForward
+		advice.pushAlreadyExists
+		advice.pushFetchFirst
+		advice.pushNeedsForce
+		advice.pushNonFFCurrent
+		advice.pushNonFFMatching
+		advice.pushUpdateRejected
 		advice.resolveConflict
+		advice.rmHints
 		advice.statusHints
+		advice.statusUoption
 		alias.
 		am.keepcr
 		am.threeWay
-- 
2.13.0
Rikard Falkeborn· May 27, 2017, 06:25 UTC · re: Rikard Falkeborn · lore

[PATCH 6/6] completion: Add git config credentialCache.ignoreSIGHUP

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 contrib/completion/git-completion.bash | 1 +
 1 file changed, 1 insertion(+)
Show changes to contrib/completion/git-completion.bash +1 −0
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 98f3e76ee..6de0dda6c 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2455,6 +2455,7 @@ _git_config ()
 		credential.helper
 		credential.useHttpPath
 		credential.username
+		credentialCache.ignoreSIGHUP
 		diff.autorefreshindex
 		diff.external
 		diff.ignoreSubmodules
-- 
2.13.0
Rikard Falkeborn· May 27, 2017, 06:25 UTC · re: Rikard Falkeborn · lore

[PATCH 3/6] completion: Add git config am.threeWay completion

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 contrib/completion/git-completion.bash | 1 +
 1 file changed, 1 insertion(+)
Show changes to contrib/completion/git-completion.bash +1 −0
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index de9306173..3a630a230 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2344,6 +2344,7 @@ _git_config ()
 		advice.statusHints
 		alias.
 		am.keepcr
+		am.threeWay
 		apply.ignorewhitespace
 		apply.whitespace
 		branch.autosetupmerge
-- 
2.13.0
Rikard Falkeborn· May 27, 2017, 06:25 UTC · re: Rikard Falkeborn · lore

[PATCH 5/6] completion: Add git config credential completions

Add missing completions for git config credential:
* credential.helper
* credential.useHttpPath
* credential.username
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 contrib/completion/git-completion.bash | 3 +++
 1 file changed, 3 insertions(+)
Show changes to contrib/completion/git-completion.bash +3 −0
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 7efcb2a79..98f3e76ee 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2452,6 +2452,9 @@ _git_config ()
 		core.warnAmbiguousRefs
 		core.whitespace
 		core.worktree
+		credential.helper
+		credential.useHttpPath
+		credential.username
 		diff.autorefreshindex
 		diff.external
 		diff.ignoreSubmodules
-- 
2.13.0
Ævar Arnfjörð Bjarmason· Jun 1, 2017, 22:02 UTC · re: Rikard Falkeborn · lore

Re: [PATCH 0/6] Some more git config completions

On Sat, May 27, 2017 at 8:25 AM, Rikard Falkeborn <rikard.falkeborn@gmail.com> wrote:

> Some more completions (from what I could tell, there are probably more
> missing). Please let me know if you prefer them in smaller (or larger)
> batches (or if the patches aren't wanted at all).

This all looks good to me, and I think it would be fine to have changes like these in bigger batches, they're easy to review.

As an aside from this series, has anyone ever proposed some method of semi-automatically keeping this up-to-date? Seems we're in a continual cycle of adding flags/config, forgetting to update this, then updating it. At least the command-line flags should be easy to parse out in some test, ditto config variables from config.txt maybe...

Junio C Hamano· Jun 2, 2017, 00:33 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [PATCH 0/6] Some more git config completions

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 5 quoted lines
> As an aside from this series, has anyone ever proposed some method of
> semi-automatically keeping this up-to-date? Seems we're in a continual
> cycle of adding flags/config, forgetting to update this, then updating
> it. At least the command-line flags should be easy to parse out in
> some test, ditto config variables from config.txt maybe...

In theory, yes, and if it is harder to automate it, at some point we may want to see if we can devise a way to make it easier by extending parse-options and config API.

Such an automation however needs to take into account the fact that historically we tried not to blindly add everything under the sun to completion (iow, there needs a way to allow us mark some things not to be auto completed in the mechanism).

SZEDER Gábor· Jun 4, 2017, 18:41 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [PATCH 0/6] Some more git config completions

> As an aside from this series, has anyone ever proposed some method of
> semi-automatically keeping this up-to-date?

For configuration variables, not that I know of. For command line options, there was an attempt to enhance parse-options to dump all command line options and use this in the completion script on-demand to lazy-initialize command-specific variables holding the list of options:

  http://public-inbox.org/git/1334140165-24958-1-git-send-email-bebarino@gmail.com/T/#u
> Seems we're in a continual
> cycle of adding flags/config, forgetting to update this, then updating
> it. At least the command-line flags should be easy to parse out in
> some test, ditto config variables from config.txt maybe...
A couple of thoughts concerning configuration variables:
 - config.txt includes other files listing configuration variables,
   too.
 - There are many config variables with subsections, e.g.
   'branch.<name>.description'.  That '<name>' is not good for
   completion, of course.
 - Some config variables are not listed with their full names, see
   'advice.*' (this is easy to fix).
 - Perhaps there are config variables that are only mentioned in the
   docs of the relevant command, but not in config.txt (or in the
   included files).
 - There are definitely config variables that are not mentioned in the
   docs at all, e.g. the 'bash.*' variables controlling __git_ps1().
 - The completion script is currently self-contained and ready to be
   used as-is.  I think that's quite nice.  This wouldn't be the case
   if we want to include an automatically generated list of config
   variables extracted from config.txt during the build process.

← back to recent threads