completion: various __gitdir()-related improvements
Get series with b4
b4 am [email protected]Versions newest first
- v2 Latest21 patches 1 replyIn review
Changes in v2 from the cover letter
- Use our real_path() instead of system realpath() to implement 'git rev-parse --absolute-git-dir'.
- Refactored a bit how __git_refs() determines where it should list refs from.
- Renamed a few refnames and remote in the tests (this accounts for the bulk of the interdiff).
- Misc small adjustments: a few more comments, removed unnecessary disambiguating '--', typofix and more consistent quoting.
- Improved commit messages.
- Rebased to current master.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/21 | completion: improve __git_refs()'s in-code documentationcontrib/ | +5 | 0 replies | |
| 2/21 | completion tests: don't add test cruft to the test repositoryt/ | +3 | 0 replies | |
| 3/21 | completion tests: make the $cur variable local to the test helper functionst/ | +2 | 0 replies | |
| 4/21 | completion tests: consolidate getting path of current working directoryt/ | +21 | 0 replies | |
| 5/21 | completion tests: check __gitdir()'s output in the error casest/ | +5 | 0 replies | |
| 6/21 | completion tests: add tests for the __git_refs() helper functiont/ | +264 | 0 replies | |
| 7/21 | completion: ensure that the repository path given on the command line existscontrib/ t/ | +9 | 0 replies | |
| 8/21 | completion: fix most spots not respecting 'git --git-dir=<path>'contrib/ | +7 | 0 replies | |
| 9/21 | completion: respect 'git --git-dir=<path>' when listing remote refscontrib/ t/ | +19 | 0 replies | |
| 10/21 | completion: list refs from remote when remote's name matches a directorycontrib/ t/ | +28 | 0 replies | |
| 11/21 | completion: don't list 'HEAD' when trying refs completion outside of a repocontrib/ t/ | +7 | 0 replies | |
| 12/21 | completion: list short refs from a remote given as a URLcontrib/ t/ | +19 | 0 replies | |
| 13/21 | completion: don't offer commands when 'git --opt' needs an argumentcontrib/ | +11 | 0 replies | |
| 14/21 | completion: fix completion after 'git -C <path>'contrib/ t/ | +10 | 0 replies | |
| 15/21 | rev-parse: add '--absolute-git-dir' optionDocumentation/ builtin/ t/ | +31 | 0 replies | |
| 16/21 | completion: respect 'git -C <path>'contrib/ t/ | +101 | 0 replies | |
| 17/21 | completion: don't use __gitdir() for git commandscontrib/ | +31 | 5 replies | |
| 18/21 | completion: consolidate silencing errors from git commandscontrib/ | +12 | 0 replies | |
| 19/21 | completion: don't guard git executions with __gitdir()contrib/ | +11 | 0 replies | |
| 20/21 | completion: extract repository discovery from __gitdir()contrib/ t/ | +42 | 0 replies | |
| 21/21 | completion: cache the path to the repositorycontrib/ t/ | +132 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCHv2 00/21] completion: various __gitdir()-related improvements
This is a long overdue reroll of a bunch of bugfixes, cleanups and optimizations related to how the completion script finds the path to the repository and how it uses that path. Most importantly this series adds support for completion following 'git -C path', and it eliminates a few subshells and git processes, for the sake of fork()+exec() challenged OSes.
The first round is at [1]. It made its way to pu back then, but since the reroll didn't come it was eventually discarded.
What did NOT change since v1 is that the new option added to 'git rev-parse' is still called '--absolute-git-dir'. There was a suggestion [2] to turn it into an orthogonal '--absolute-dir' option that works with other path-querying options, too, but I really doubt it's worth it. In short, regular scripts don't care, because a relative path doesn't make any difference for them, and before we do this orthogonal thing we have to decide a bunch of questions first, see [3].
Changes since v1:
- Use our real_path() instead of system realpath() to implement 'git rev-parse --absolute-git-dir'.
- Refactored a bit how __git_refs() determines where it should list refs from.
- Renamed a few refnames and remote in the tests (this accounts for the bulk of the interdiff).
- Misc small adjustments: a few more comments, removed unnecessary disambiguating '--', typofix and more consistent quoting.
- Improved commit messages.
- Rebased to current master.
The interdiff below is compared to v1 rebased on top of current master.
This series is also available at
https://github.com/szeder/git completion-gitdir-improvements
[1] - http://public-inbox.org/git/[email protected]/T/
[2] - http://public-inbox.org/git/CANoM8SXO_Rz_CVOz9ptsaVCzcQ2D1FQrSuFFW4vZ4SdRYMzD=w@mail.gmail.com/
[3] - http://public-inbox.org/git/20160518185825.Horde.EPd2nJNvqEW_VX4b01yWdIr@webmail.informatik.kit.edu/
SZEDER Gábor (21):
completion: improve __git_refs()'s in-code documentation completion tests: don't add test cruft to the test repository completion tests: make the $cur variable local to the test helper
functions
completion tests: consolidate getting path of current working
directory
completion tests: check __gitdir()'s output in the error cases completion tests: add tests for the __git_refs() helper function
completion: ensure that the repository path given on the command line
exists
completion: fix most spots not respecting 'git --git-dir=<path>'
completion: respect 'git --git-dir=<path>' when listing remote refs
completion: list refs from remote when remote's name matches a
directory
completion: don't list 'HEAD' when trying refs completion outside of a
repo
completion: list short refs from a remote given as a URL
completion: don't offer commands when 'git --opt' needs an argument
completion: fix completion after 'git -C <path>'
rev-parse: add '--absolute-git-dir' option
completion: respect 'git -C <path>'
completion: don't use __gitdir() for git commands
completion: consolidate silencing errors from git commands
completion: don't guard git executions with __gitdir()
completion: extract repository discovery from __gitdir()
completion: cache the path to the repository
Documentation/git-rev-parse.txt | 4 + builtin/rev-parse.c | 26 +- contrib/completion/git-completion.bash | 250 ++++++++++----- t/t1500-rev-parse.sh | 17 +- t/t9902-completion.sh | 561 +++++++++++++++++++++++++++++---- 5 files changed, 690 insertions(+), 168 deletions(-)
Signature · 1 line
2.11.0.555.g967c1bcb3
builtin/rev-parse.c +1 -4
@@ -820,10 +820,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)if (!gitdir && !prefix) gitdir =".git" ;if (gitdir) { -char absolute_path[PATH_MAX ]; -if (!realpath (gitdir, absolute_path)) -die_errno (_ ("unable to get absolute path" )); -puts (absolute_path); +puts (real_path (gitdir));continue ; } }
contrib/completion/git-completion.bash +22 -22
97 lines not on this page · raw message
t/t9902-completion.sh +92 -77
312 lines not on this page · raw message