git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/RFC 0/2] Automate updating git-completion.bash a bit

From
Duy Nguyen <pclouds@gmail.com>
Date
Jan 23, 2018, 09:59 UTC
Message-ID
<20180123095927.GA26613@ash>
In-Reply-To
<CAM0VKj=NeQ_BthG087vswP=mCizXPBcfmCAa9haH4N5MRCNRWQ@mail.gmail.com>
On Mon, Jan 22, 2018 at 07:03:24PM +0100, SZEDER Gábor wrote:
Show 11 quoted lines
> On Wed, Jan 17, 2018 at 10:34 AM, Duy Nguyen <pclouds@gmail.com> wrote:
> > Actually I forgot another option. What if we automate updating the
> > script at "compile" time instead of calling git at run time? E.g. with
> > something like below, a contributor could just run
> >
> >     make update-completion
> >
> > then add git-completion.bash changes to the same patch that introduces
> > new options. If they forget
> 
> They inevitably will :)

OK. We go with the first option then (with caching to reduce overhead on Windows). I'm not going to bother you with actual code changes. The diff of completable options looks like below. It would be great if people could check if some options should NOT be completable for some reason.

A couple points
- Ignore options that are removed in the diff. They are removed for a
  reason which I will explain when real patches come.
- There are regressions where --foo= becomes --foo, I hope this is ok
  for now. We can tweak this later.
- In some commands you can complete both --foo and --foo= (now it's
  just one form, --foo). I would argue that it's pointless. It's no
  big deal to type '=' (or a space) after we have completed --foo.
- I feel --force is not treated the same way everywhere. But I guess
  that's ok since "forcing" in some command context may be less severe
  than others.
-- 8< --
diff --git a/git-add.txt b/git-add.txt
index 1c249a3..2693cc1 100644
--- a/git-add.txt
+++ b/git-add.txt
@@ -1,10 +1,15 @@
+--all
 --chmod=
 --dry-run
 --edit
 --force
 --ignore-errors
+--ignore-missing
+--ignore-removal
 --intent-to-add
 --interactive
 --patch
 --refresh
+--renormalize
 --update
+--verbose
diff --git a/git-am.txt b/git-am.txt
index b0082bf..552dc96 100644
--- a/git-am.txt
+++ b/git-am.txt
@@ -1,12 +1,24 @@
 --3way
 --committer-date-is-author-date
+--directory
+--exclude
+--gpg-sign
 --ignore-date
 --ignore-space-change
 --ignore-whitespace
+--include
 --interactive
 --keep
+--keep-cr
+--keep-non-patch
+--message-id
+--no-keep-cr
 --no-utf8
+--patch-format
+--quiet
+--reject
+--resolvemsg=
 --scissors
 --signoff
 --utf8
---whitespace=
+--whitespace
diff --git a/git-apply.txt b/git-apply.txt
index 6bf4c2f..71d53d2 100644
--- a/git-apply.txt
+++ b/git-apply.txt
@@ -1,13 +1,17 @@
+--3way
+--allow-overlap
 --apply
+--build-fake-ancestor=
 --cached
 --check
---directory=
---exclude=
+--directory
+--exclude
 --ignore-space-change
 --ignore-whitespace
 --inaccurate-eof
+--include
 --index
---index-info
+--no-add
 --no-add
 --numstat
 --recount
@@ -17,4 +21,4 @@
 --summary
 --unidiff-zero
 --verbose
---whitespace=
+--whitespace
diff --git a/git-branch.txt b/git-branch.txt
index 69594e3..9d308aa 100644
--- a/git-branch.txt
+++ b/git-branch.txt
@@ -1,10 +1,14 @@
---abbrev=
+--abbrev
+--all
 --color
 --column
 --contains
 --copy
+--create-reflog
 --delete
 --edit-description
+--format=
+--ignore-case
 --list
 --merged
 --move
@@ -15,9 +19,10 @@
 --no-merged
 --no-track
 --points-at
+--quiet
 --remotes
 --set-upstream-to=
---sort=
+--sort
 --track
 --unset-upstream
 --verbose
diff --git a/git-checkout.txt b/git-checkout.txt
index 493a1fe..75f19d2 100644
--- a/git-checkout.txt
+++ b/git-checkout.txt
@@ -1,12 +1,14 @@
 --conflict=
 --detach
+--ignore-other-worktrees
 --ignore-skip-worktree-bits
 --merge
 --no-recurse-submodules
 --no-track
---orphan
+--orphan=
 --ours
 --patch
+--progress
 --quiet
 --recurse-submodules
 --theirs
diff --git a/git-cherry-pick.txt b/git-cherry-pick.txt
index 39ba895..f8cdbce 100644
--- a/git-cherry-pick.txt
+++ b/git-cherry-pick.txt
@@ -1,5 +1,14 @@
+--abort
+--allow-empty
+--allow-empty-message
+--continue
 --edit
+--ff
+--gpg-sign
+--keep-redundant-commits
 --mainline
 --no-commit
+--quit
 --signoff
 --strategy=
+--strategy-option
diff --git a/git-clean.txt b/git-clean.txt
index 40407f7..10c6155 100644
--- a/git-clean.txt
+++ b/git-clean.txt
@@ -1,2 +1,4 @@
 --dry-run
+--exclude
+--interactive
 --quiet
diff --git a/git-clone.txt b/git-clone.txt
index f6e892b..1b6a4da 100644
--- a/git-clone.txt
+++ b/git-clone.txt
@@ -1,18 +1,29 @@
 --bare
---branch
---depth
+--branch=
+--config
+--depth=
+--dissociate
+--ipv4
+--ipv6
+--jobs=
 --local
 --mirror
 --no-checkout
 --no-hardlinks
 --no-single-branch
 --no-tags
---origin
+--origin=
+--progress
 --quiet
 --recurse-submodules
 --reference
+--reference-if-able
+--separate-git-dir=
+--shallow-exclude
+--shallow-since=
 --shallow-submodules
 --shared
 --single-branch
 --template=
---upload-pack
+--upload-pack=
+--verbose
diff --git a/git-commit.txt b/git-commit.txt
index 2f98a59..337a57e 100644
--- a/git-commit.txt
+++ b/git-commit.txt
@@ -1,20 +1,26 @@
 --all
---allow-empty
 --amend
 --author=
+--branch
 --cleanup=
---date
+--date=
 --dry-run
 --edit
 --file=
 --fixup=
+--gpg-sign
 --include
 --interactive
---message=
+--long
+--message
 --no-edit
+--no-post-rewrite
 --no-verify
+--no-verify
+--null
 --only
 --patch
+--porcelain
 --quiet
 --reedit-message=
 --reset-author
@@ -22,8 +28,7 @@
 --short
 --signoff
 --squash=
+--status
 --template=
 --untracked-files
---untracked-files=
 --verbose
---verify
diff --git a/git-config.txt b/git-config.txt
index c4bcd1e..651fc27 100644
--- a/git-config.txt
+++ b/git-config.txt
@@ -1,15 +1,28 @@
 --add
+--blob=
+--bool
+--bool-or-int
+--edit
+--expiry-date
 --file=
 --get
 --get-all
+--get-color
+--get-colorbool
 --get-regexp
+--get-urlmatch
 --global
+--includes
+--int
 --list
 --local
 --name-only
+--null
+--path
 --remove-section
 --rename-section
 --replace-all
+--show-origin
 --system
 --unset
 --unset-all
diff --git a/git-describe.txt b/git-describe.txt
index 05eeb7a..275debb 100644
--- a/git-describe.txt
+++ b/git-describe.txt
@@ -1,4 +1,4 @@
---abbrev=
+--abbrev
 --all
 --always
 --broken
diff --git a/git-fsck.txt b/git-fsck.txt
index 9732ebf..3af9964 100644
--- a/git-fsck.txt
+++ b/git-fsck.txt
@@ -1,8 +1,12 @@
 --cache
+--connectivity-only
+--dangling
 --full
 --lost-found
 --name-objects
 --no-reflogs
+--progress
+--reflogs
 --root
 --strict
 --tags
diff --git a/git-gc.txt b/git-gc.txt
index 3b7ca6f..c08e60a 100644
--- a/git-gc.txt
+++ b/git-gc.txt
@@ -1,2 +1,3 @@
 --aggressive
 --prune
+--quiet
diff --git a/git-grep.txt b/git-grep.txt
index 6bec8f7..f7770be 100644
--- a/git-grep.txt
+++ b/git-grep.txt
@@ -1,9 +1,14 @@
+--after-context=
 --all-match
 --and
 --basic-regexp
+--before-context=
 --break
 --cached
+--color
+--context
 --count
+--exclude-standard
 --extended-regexp
 --files-with-matches
 --files-without-match
@@ -14,14 +19,17 @@
 --ignore-case
 --invert-match
 --line-number
---max-depth
+--max-depth=
 --name-only
 --no-index
 --not
 --or
 --perl-regexp
+--quiet
+--recurse-submodules
 --show-function
 --text
---threads
+--textconv
+--threads=
 --untracked
 --word-regexp
diff --git a/git-init.txt b/git-init.txt
index a7d3da6..aec6a35 100644
--- a/git-init.txt
+++ b/git-init.txt
@@ -1,5 +1,5 @@
 --bare
 --quiet
+--separate-git-dir=
 --shared
---shared=
 --template=
diff --git a/git-ls-files.txt b/git-ls-files.txt
index 04d6f08..6810eb0 100644
--- a/git-ls-files.txt
+++ b/git-ls-files.txt
@@ -1,20 +1,23 @@
 --abbrev
 --cached
+--debug
 --deleted
 --directory
+--empty-directory
+--eol
 --error-unmatch
---exclude=
---exclude-from=
---exclude-per-directory
+--exclude
+--exclude-from
 --exclude-per-directory=
 --exclude-standard
 --full-name
 --ignored
---ignored
 --killed
 --modified
 --no-empty-directory
 --others
+--recurse-submodules
+--resolve-undo
 --stage
 --unmerged
 --with-tree=
diff --git a/git-ls-remote.txt b/git-ls-remote.txt
index c58c80e..381384b 100644
--- a/git-ls-remote.txt
+++ b/git-ls-remote.txt
@@ -1,5 +1,7 @@
 --get-url
 --heads
+--quiet
 --refs
 --symref
 --tags
+--upload-pack=
diff --git a/git-mv.txt b/git-mv.txt
index c26c9e6..28ae674 100644
--- a/git-mv.txt
+++ b/git-mv.txt
@@ -1 +1,2 @@
 --dry-run
+--verbose
diff --git a/git-name-rev.txt b/git-name-rev.txt
index 7b1acde..1e5044a 100644
--- a/git-name-rev.txt
+++ b/git-name-rev.txt
@@ -1,3 +1,8 @@
 --all
+--always
+--exclude
+--name-only
+--refs
 --stdin
 --tags
+--undefined
diff --git a/git-notes_add.txt b/git-notes_add.txt
index 87cb06b..4c2dfc1 100644
--- a/git-notes_add.txt
+++ b/git-notes_add.txt
@@ -1,4 +1,5 @@
---file=
---message=
---reedit-message=
---reuse-message=
+--allow-empty
+--file
+--message
+--reedit-message
+--reuse-message
diff --git a/git-notes_append.txt b/git-notes_append.txt
index 87cb06b..4c2dfc1 100644
--- a/git-notes_append.txt
+++ b/git-notes_append.txt
@@ -1,4 +1,5 @@
---file=
---message=
---reedit-message=
---reuse-message=
+--allow-empty
+--file
+--message
+--reedit-message
+--reuse-message
diff --git a/git-notes_copy.txt b/git-notes_copy.txt
index 93aa025..d088b96 100644
--- a/git-notes_copy.txt
+++ b/git-notes_copy.txt
@@ -1 +1,2 @@
+--for-rewrite=
 --stdin
diff --git a/git-push.txt b/git-push.txt
index 1f4182f..5ea1e39 100644
--- a/git-push.txt
+++ b/git-push.txt
@@ -1,16 +1,24 @@
 --all
+--atomic
 --delete
 --dry-run
+--exec=
 --follow-tags
 --force
 --force-with-lease
---force-with-lease=
+--ipv4
+--ipv6
 --mirror
+--no-verify
+--porcelain
+--progress
 --prune
+--push-option
 --quiet
 --receive-pack=
---recurse-submodules=
+--recurse-submodules
 --repo=
 --set-upstream
+--signed
 --tags
 --verbose
diff --git a/git-remote_add.txt b/git-remote_add.txt
index aed6530..4889f31 100644
--- a/git-remote_add.txt
+++ b/git-remote_add.txt
@@ -1,6 +1,6 @@
 --fetch
---master
---mirror=
+--master=
+--mirror
 --no-tags
 --tags
 --track
diff --git a/git-replace.txt b/git-replace.txt
index 53cd1aa..d494653 100644
--- a/git-replace.txt
+++ b/git-replace.txt
@@ -3,3 +3,4 @@
 --format=
 --graft
 --list
+--raw
diff --git a/git-reset.txt b/git-reset.txt
index eafefbc..840cbae 100644
--- a/git-reset.txt
+++ b/git-reset.txt
@@ -1,6 +1,9 @@
 --hard
+--intent-to-add
 --keep
 --merge
 --mixed
 --patch
+--quiet
+--recurse-submodules
 --soft
diff --git a/git-revert.txt b/git-revert.txt
index abd5c1e..ffa0d80 100644
--- a/git-revert.txt
+++ b/git-revert.txt
@@ -1,7 +1,11 @@
+--abort
+--continue
 --edit
+--gpg-sign
 --mainline
 --no-commit
 --no-edit
+--quit
 --signoff
 --strategy=
---strategy-option=
+--strategy-option
diff --git a/git-show-branch.txt b/git-show-branch.txt
index e3c3096..37c9594 100644
--- a/git-show-branch.txt
+++ b/git-show-branch.txt
@@ -5,7 +5,7 @@
 --independent
 --list
 --merge-base
---more=
+--more
 --no-color
 --no-name
 --reflog
diff --git a/git-status.txt b/git-status.txt
index 2dce372..ed86ad5 100644
--- a/git-status.txt
+++ b/git-status.txt
@@ -1,10 +1,12 @@
 --branch
---column=
+--column
 --ignored
---ignore-submodules=
+--ignore-submodules
 --long
 --no-column
+--null
 --porcelain
 --short
---untracked-files=
+--show-stash
+--untracked-files
 --verbose
diff --git a/git-tag.txt b/git-tag.txt
index b983562..a5419db 100644
--- a/git-tag.txt
+++ b/git-tag.txt
@@ -1,18 +1,21 @@
 --annotate
---cleanup
+--cleanup=
+--color
 --column
 --contains
 --create-reflog
 --delete
---file
+--file=
 --force
+--format=
+--ignore-case
 --list
---local-user
+--local-user=
 --merged
 --message
 --no-contains
 --no-merged
 --points-at
 --sign
---sort=
+--sort
 --verify
diff --git a/git-worktree_add.txt b/git-worktree_add.txt
index 9dd7f92..3cb6a7e 100644
--- a/git-worktree_add.txt
+++ b/git-worktree_add.txt
@@ -1 +1,5 @@
+--checkout
 --detach
+--guess-remote
+--lock
+--track
diff --git a/git-worktree_lock.txt b/git-worktree_lock.txt
index a0bc06b..6ad59bb 100644
--- a/git-worktree_lock.txt
+++ b/git-worktree_lock.txt
@@ -1 +1 @@
---reason
+--reason=
-- 8< --
--
Duy
Previous: SZEDER GáborNext: Duy Nguyen
Message 12 of 14 in “Automate updating git-completion.bash a bit”
  1. 0/2 Automate updating git-completion.bash a bitNguyễn Thái Ngọc Duy, Jan 16, 2018
  2. 1/2 parse-options: support --git-completion-helperNguyễn Thái Ngọc Duy, Jan 16, 2018
  3. Jacob KellerJan 16, 2018
  4. Duy NguyenJan 17, 2018
  5. Junio C HamanoJan 16, 2018
  6. Duy NguyenJan 17, 2018
  7. 2/2 git-completion: use --git-completion-helperNguyễn Thái Ngọc Duy, Jan 16, 2018
  8. SZEDER GáborJan 17, 2018
  9. Duy NguyenJan 17, 2018
  10. Duy NguyenJan 17, 2018
  11. SZEDER GáborJan 22, 2018
  12. Duy NguyenJan 23, 2018
  13. Duy NguyenApr 11, 2019
  14. Duy NguyenApr 11, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.