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

Re: [PATCH v2 00/41] Automate updating git-completion.bash a bit

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jan 31, 2018, 15:01 UTC
Message-ID
<87po5qm5sb.fsf@evledraar.gmail.com>
In-Reply-To
<20180131110547.20577-1-pclouds@gmail.com>
On Wed, Jan 31 2018, Nguyễn Thái Ngọc Duy jotted:
Show 21 quoted lines
> I posted a proof of concept a while back [1]. This is the full version.
>
> This series lets "git" binary help git-completion.bash to complete
> --<stuff> so that when a new option is added, we don't have to update
> git-completion.bash manually too (people often forget it). As a side
> effect, about 180 more options are now completable.
>
> parse-options is updated to allow developers to flag certain options
> not to be completable if they want finer control over it.  But by
> default, new non-hidden options are completable. Negative forms must
> be handled manually. That's for the next step.
>
> The number of patches is high, but changes after the first four
> patches and 33/41 are quite simple. I still need some eyeballs though
> to make sure I have not accidentally allowed completion of dangerous
> options. Details are broken down per command in each commit message.
>
> If people want to play with this, I have a script [2] that shows all
> completable options for most commands (I ignore some that are
> shell-based because I don't touch them in this series). You can then
> do a "diff" to see new/old options.

Thanks, looks great to me, especially caching the result of the completion.

> There's a small conflict with 'pu' because --prune-tags is added in
> git-completion.bash. The solution is simple and beautiful: ignore
> those changes, --prune-tags will be completable anyway :)

Yay! Also another good argument for this series, it took me until v3 until I noticed I'd forgotten the bash completion: https://public-inbox.org/git/20180123221326.28495-1-avarab@gmail.com/

> parse-options: add OPT_xxx_F() variants

Not directly related to this series, but my own https://public-inbox.org/git/20170324231013.23346-1-avarab@gmail.com/ which I've been meaning to clean up and re-submit also added some new macros to this file.

I've been wondering what a good solution is to avoid a combinatorial explosion explosion of these macros in the longer term, but haven't come up with anthing.

Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 55 of 127 in “Automate updating git-completion.bash a bit”
  1. 00/41 Automate updating git-completion.bash a bitNguyễn Thái Ngọc Duy, Jan 31, 2018
  2. 01/41 parse-options: support --git-completion-helperNguyễn Thái Ngọc Duy, Jan 31, 2018
  3. Eric SunshineJan 31, 2018
  4. Eric SunshineJan 31, 2018
  5. Duy NguyenFeb 1, 2018
  6. Eric SunshineFeb 1, 2018
  7. Duy NguyenFeb 1, 2018
  8. Eric SunshineFeb 1, 2018
  9. Duy NguyenFeb 5, 2018
  10. Eric SunshineFeb 6, 2018
  11. SZEDER GáborFeb 7, 2018
  12. Ævar Arnfjörð BjarmasonFeb 5, 2018
  13. Duy NguyenFeb 5, 2018
  14. 02/41 parse-options: add OPT_xxx_F() variantsNguyễn Thái Ngọc Duy, Jan 31, 2018
  15. 03/41 parse-options: let OPT__FORCE take optional flags argumentNguyễn Thái Ngọc Duy, Jan 31, 2018
  16. 04/41 git-completion.bash: introduce __gitcomp_builtinNguyễn Thái Ngọc Duy, Jan 31, 2018
  17. 05/41 completion: use __gitcomp_builtin in _git_addNguyễn Thái Ngọc Duy, Jan 31, 2018
  18. 06/41 completion: use __gitcomp_builtin in _git_amNguyễn Thái Ngọc Duy, Jan 31, 2018
  19. 07/41 completion: use __gitcomp_builtin in _git_applyNguyễn Thái Ngọc Duy, Jan 31, 2018
  20. 08/41 completion: use __gitcomp_builtin in _git_branchNguyễn Thái Ngọc Duy, Jan 31, 2018
  21. 09/41 completion: use __gitcomp_builtin in _git_checkoutNguyễn Thái Ngọc Duy, Jan 31, 2018
  22. 10/41 completion: use __gitcomp_builtin in _git_cherry_pickNguyễn Thái Ngọc Duy, Jan 31, 2018
  23. 11/41 completion: use __gitcomp_builtin in _git_cleanNguyễn Thái Ngọc Duy, Jan 31, 2018
  24. 12/41 completion: use __gitcomp_builtin in _git_cloneNguyễn Thái Ngọc Duy, Jan 31, 2018
  25. 13/41 completion: use __gitcomp_builtin in _git_commitNguyễn Thái Ngọc Duy, Jan 31, 2018
  26. Eric SunshineJan 31, 2018
  27. 14/41 completion: use __gitcomp_builtin in _git_configNguyễn Thái Ngọc Duy, Jan 31, 2018
  28. 15/41 completion: use __gitcomp_builtin in _git_describeNguyễn Thái Ngọc Duy, Jan 31, 2018
  29. 16/41 completion: use __gitcomp_builtin in _git_difftoolNguyễn Thái Ngọc Duy, Jan 31, 2018
  30. 17/41 completion: use __gitcomp_builtin in _git_fetchNguyễn Thái Ngọc Duy, Jan 31, 2018
  31. 18/41 completion: use __gitcomp_builtin in _git_fsckNguyễn Thái Ngọc Duy, Jan 31, 2018
  32. 19/41 completion: use __gitcomp_builtin in _git_gcNguyễn Thái Ngọc Duy, Jan 31, 2018
  33. 21/41 completion: use __gitcomp_builtin in _git_helpNguyễn Thái Ngọc Duy, Jan 31, 2018
  34. 24/41 completion: use __gitcomp_builtin in _git_ls_remoteNguyễn Thái Ngọc Duy, Jan 31, 2018
  35. 25/41 completion: use __gitcomp_builtin in _git_mergeNguyễn Thái Ngọc Duy, Jan 31, 2018
  36. 26/41 completion: use __gitcomp_builtin in _git_merge_baseNguyễn Thái Ngọc Duy, Jan 31, 2018
  37. 23/41 completion: use __gitcomp_builtin in _git_ls_filesNguyễn Thái Ngọc Duy, Jan 31, 2018
  38. 27/41 completion: use __gitcomp_builtin in _git_mvNguyễn Thái Ngọc Duy, Jan 31, 2018
  39. 28/41 completion: use __gitcomp_builtin in _git_name_revNguyễn Thái Ngọc Duy, Jan 31, 2018
  40. 29/41 completion: use __gitcomp_builtin in _git_notesNguyễn Thái Ngọc Duy, Jan 31, 2018
  41. 30/41 completion: use __gitcomp_builtin in _git_pullNguyễn Thái Ngọc Duy, Jan 31, 2018
  42. 31/41 completion: use __gitcomp_builtin in _git_pushNguyễn Thái Ngọc Duy, Jan 31, 2018
  43. 32/41 completion: use __gitcomp_builtin in _git_remoteNguyễn Thái Ngọc Duy, Jan 31, 2018
  44. 22/41 completion: use __gitcomp_builtin in _git_initNguyễn Thái Ngọc Duy, Jan 31, 2018
  45. 33/41 remote: force completing --mirror= instead of --mirrorNguyễn Thái Ngọc Duy, Jan 31, 2018
  46. 34/41 completion: use __gitcomp_builtin in _git_replaceNguyễn Thái Ngọc Duy, Jan 31, 2018
  47. 35/41 completion: use __gitcomp_builtin in _git_resetNguyễn Thái Ngọc Duy, Jan 31, 2018
  48. 36/41 completion: use __gitcomp_builtin in _git_revertNguyễn Thái Ngọc Duy, Jan 31, 2018
  49. 37/41 completion: use __gitcomp_builtin in _git_rmNguyễn Thái Ngọc Duy, Jan 31, 2018
  50. 38/41 completion: use __gitcomp_builtin in _git_show_branchNguyễn Thái Ngọc Duy, Jan 31, 2018
  51. 39/41 completion: use __gitcomp_builtin in _git_statusNguyễn Thái Ngọc Duy, Jan 31, 2018
  52. 40/41 completion: use __gitcomp_builtin in _git_tagNguyễn Thái Ngọc Duy, Jan 31, 2018
  53. 41/41 completion: use __gitcomp_builtin in _git_worktreeNguyễn Thái Ngọc Duy, Jan 31, 2018
  54. 20/41 completion: use __gitcomp_builtin in _git_grepNguyễn Thái Ngọc Duy, Jan 31, 2018
  55. Ævar Arnfjörð BjarmasonJan 31, 2018
  56. Junio C HamanoFeb 7, 2018
  57. Duy NguyenFeb 8, 2018
  58. 00/42 Automate updating git-completion.bash a bitNguyễn Thái Ngọc Duy, Feb 9, 2018
  59. 01/42 parse-options: support --git-completion-helperNguyễn Thái Ngọc Duy, Feb 9, 2018
  60. Ævar Arnfjörð BjarmasonDec 2, 2018
  61. parse-options: fix SunCC compiler warningNguyễn Thái Ngọc Duy, Dec 9, 2018
  62. Junio C HamanoDec 10, 2018
  63. Duy NguyenDec 10, 2018
  64. Junio C HamanoDec 11, 2018
  65. Duy NguyenDec 11, 2018
  66. Junio C HamanoDec 12, 2018
  67. parse-options: fix SunCC compiler warningNguyễn Thái Ngọc Duy, Dec 11, 2018
  68. 02/42 parse-options: add OPT_xxx_F() variantsNguyễn Thái Ngọc Duy, Feb 9, 2018
  69. 03/42 parse-options: let OPT__FORCE take optional flags argumentNguyễn Thái Ngọc Duy, Feb 9, 2018
  70. 04/42 git-completion.bash: introduce __gitcomp_builtinNguyễn Thái Ngọc Duy, Feb 9, 2018
  71. Junio C HamanoFeb 9, 2018
  72. SZEDER GáborFeb 14, 2018
  73. Duy NguyenFeb 23, 2018
  74. 05/42 completion: use __gitcomp_builtin in _git_addNguyễn Thái Ngọc Duy, Feb 9, 2018
  75. 06/42 completion: use __gitcomp_builtin in _git_amNguyễn Thái Ngọc Duy, Feb 9, 2018
  76. SZEDER GáborFeb 14, 2018
  77. Duy NguyenFeb 22, 2018
  78. Junio C HamanoFeb 22, 2018
  79. Duy NguyenFeb 23, 2018
  80. Junio C HamanoFeb 23, 2018
  81. Duy NguyenFeb 24, 2018
  82. 07/42 completion: use __gitcomp_builtin in _git_applyNguyễn Thái Ngọc Duy, Feb 9, 2018
  83. 08/42 completion: use __gitcomp_builtin in _git_branchNguyễn Thái Ngọc Duy, Feb 9, 2018
  84. 09/42 completion: use __gitcomp_builtin in _git_checkoutNguyễn Thái Ngọc Duy, Feb 9, 2018
  85. 10/42 completion: use __gitcomp_builtin in _git_cherry_pickNguyễn Thái Ngọc Duy, Feb 9, 2018
  86. 11/42 completion: use __gitcomp_builtin in _git_cleanNguyễn Thái Ngọc Duy, Feb 9, 2018
  87. 12/42 completion: use __gitcomp_builtin in _git_cloneNguyễn Thái Ngọc Duy, Feb 9, 2018
  88. 13/42 completion: use __gitcomp_builtin in _git_commitNguyễn Thái Ngọc Duy, Feb 9, 2018
  89. 14/42 completion: use __gitcomp_builtin in _git_configNguyễn Thái Ngọc Duy, Feb 9, 2018
  90. 15/42 completion: use __gitcomp_builtin in _git_describeNguyễn Thái Ngọc Duy, Feb 9, 2018
  91. 16/42 completion: use __gitcomp_builtin in _git_difftoolNguyễn Thái Ngọc Duy, Feb 9, 2018
  92. 17/42 completion: use __gitcomp_builtin in _git_fetchNguyễn Thái Ngọc Duy, Feb 9, 2018
  93. 18/42 completion: use __gitcomp_builtin in _git_fsckNguyễn Thái Ngọc Duy, Feb 9, 2018
  94. 19/42 completion: use __gitcomp_builtin in _git_gcNguyễn Thái Ngọc Duy, Feb 9, 2018
  95. 20/42 completion: use __gitcomp_builtin in _git_grepNguyễn Thái Ngọc Duy, Feb 9, 2018
  96. 21/42 completion: use __gitcomp_builtin in _git_helpNguyễn Thái Ngọc Duy, Feb 9, 2018
  97. 22/42 completion: use __gitcomp_builtin in _git_initNguyễn Thái Ngọc Duy, Feb 9, 2018
  98. 23/42 completion: use __gitcomp_builtin in _git_ls_filesNguyễn Thái Ngọc Duy, Feb 9, 2018
  99. 25/42 completion: use __gitcomp_builtin in _git_mergeNguyễn Thái Ngọc Duy, Feb 9, 2018
  100. 26/42 completion: use __gitcomp_builtin in _git_merge_baseNguyễn Thái Ngọc Duy, Feb 9, 2018
  101. 27/42 completion: use __gitcomp_builtin in _git_mvNguyễn Thái Ngọc Duy, Feb 9, 2018
  102. 28/42 completion: use __gitcomp_builtin in _git_name_revNguyễn Thái Ngọc Duy, Feb 9, 2018
  103. 24/42 completion: use __gitcomp_builtin in _git_ls_remoteNguyễn Thái Ngọc Duy, Feb 9, 2018
  104. 29/42 completion: use __gitcomp_builtin in _git_notesNguyễn Thái Ngọc Duy, Feb 9, 2018
  105. SZEDER GáborFeb 14, 2018
  106. Duy NguyenFeb 23, 2018
  107. Duy NguyenFeb 23, 2018
  108. SZEDER GáborFeb 14, 2018
  109. Duy NguyenFeb 23, 2018
  110. 30/42 completion: use __gitcomp_builtin in _git_pullNguyễn Thái Ngọc Duy, Feb 9, 2018
  111. 31/42 completion: use __gitcomp_builtin in _git_pushNguyễn Thái Ngọc Duy, Feb 9, 2018
  112. 32/42 completion: use __gitcomp_builtin in _git_remoteNguyễn Thái Ngọc Duy, Feb 9, 2018
  113. 33/42 remote: force completing --mirror= instead of --mirrorNguyễn Thái Ngọc Duy, Feb 9, 2018
  114. 34/42 completion: use __gitcomp_builtin in _git_replaceNguyễn Thái Ngọc Duy, Feb 9, 2018
  115. 35/42 completion: use __gitcomp_builtin in _git_resetNguyễn Thái Ngọc Duy, Feb 9, 2018
  116. 36/42 completion: use __gitcomp_builtin in _git_revertNguyễn Thái Ngọc Duy, Feb 9, 2018
  117. 37/42 completion: use __gitcomp_builtin in _git_rmNguyễn Thái Ngọc Duy, Feb 9, 2018
  118. 38/42 completion: use __gitcomp_builtin in _git_show_branchNguyễn Thái Ngọc Duy, Feb 9, 2018
  119. 39/42 completion: use __gitcomp_builtin in _git_statusNguyễn Thái Ngọc Duy, Feb 9, 2018
  120. 40/42 completion: use __gitcomp_builtin in _git_tagNguyễn Thái Ngọc Duy, Feb 9, 2018
  121. 41/42 completion: use __gitcomp_builtin in _git_worktreeNguyễn Thái Ngọc Duy, Feb 9, 2018
  122. 42/42 git-completion.bash: add GIT_COMPLETION_OPTIONS=all configNguyễn Thái Ngọc Duy, Feb 9, 2018
  123. Ævar Arnfjörð BjarmasonFeb 9, 2018
  124. Duy NguyenFeb 10, 2018
  125. Ævar Arnfjörð BjarmasonFeb 11, 2018
  126. Eric SunshineFeb 11, 2018
  127. Duy NguyenFeb 12, 2018

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.