aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-01-15 11:36:11 +0100
committerJunio C Hamano <gitster@pobox.com>2024-01-16 09:18:21 -0800
commit9a9c31135e6029dbda773f7271cea4648644eb8e (patch)
treed34d60a2e07225261b4fa5eb2966f474f27c8a3e /contrib
parent7b9cda2d3d7de794974ce6f29a2a838565cd338d (diff)
downloadgit-9a9c31135e6029dbda773f7271cea4648644eb8e.tar.gz
completion: silence pseudoref existence check
In 44dbb3bf29 (completion: support pseudoref existence checks for reftables, 2023-12-19), we have extended the Bash completion script to support future ref backends better by using git-rev-parse(1) to check for pseudo-ref existence. This conversion has introduced a bug, because even though we pass `--quiet` to git-rev-parse(1) it would still output the resolved object ID of the ref in question if it exists. Fix this by redirecting its stdout to `/dev/null` and add a test that catches this behaviour. Note that the test passes even without the fix for the "files" backend because we parse pseudo refs via the filesystem directly in that case. But the test will fail with the "reftable" backend. Helped-by: Jeff King <peff@peff.net> Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-completion.bash2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index d703e3e64f..54ce58f73d 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -148,7 +148,7 @@ __git_pseudoref_exists ()
# platforms.
if __git_eread "$__git_repo_path/HEAD" head; then
if [ "$head" == "ref: refs/heads/.invalid" ]; then
- __git rev-parse --verify --quiet "$ref"
+ __git rev-parse --verify --quiet "$ref" >/dev/null
return $?
fi
fi