From: Sebastian Schuberth <sschuberth@gmail.com>
To: git@vger.kernel.org
Cc: szeder@ira.uka.de, Junio C Hamano <gitster@pobox.com>, tr@thomasrast.ch
Subject: [PATCH] git-completion.bash: always swallow error output of for-each-ref
Date: Thu, 4 Feb 2016 11:34:59 +0100 [thread overview]
Message-ID: <56B32953.2010908@gmail.com> (raw)
This avoids output like
warning: ignoring broken ref refs/remotes/origin/HEAD
while completing branch names.
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
contrib/completion/git-completion.bash | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 15ebba5..7c0549d 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -317,7 +317,7 @@ __git_heads ()
local dir="$(__gitdir)"
if [ -d "$dir" ]; then
git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
- refs/heads
+ refs/heads 2>/dev/null
return
fi
}
@@ -327,7 +327,7 @@ __git_tags ()
local dir="$(__gitdir)"
if [ -d "$dir" ]; then
git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
- refs/tags
+ refs/tags 2>/dev/null
return
fi
}
@@ -355,14 +355,14 @@ __git_refs ()
;;
esac
git --git-dir="$dir" for-each-ref --format="%($format)" \
- $refs
+ $refs 2>/dev/null
if [ -n "$track" ]; then
# employ the heuristic used by git checkout
# Try to find a remote branch that matches the completion word
# but only output if the branch name is unique
local ref entry
git --git-dir="$dir" for-each-ref --shell --format="ref=%(refname:short)" \
- "refs/remotes/" | \
+ "refs/remotes/" 2>/dev/null | \
while read -r entry; do
eval "$entry"
ref="${ref#*/}"
@@ -1835,7 +1835,7 @@ _git_config ()
remote="${remote%.push}"
__gitcomp_nl "$(git --git-dir="$(__gitdir)" \
for-each-ref --format='%(refname):%(refname)' \
- refs/heads)"
+ refs/heads 2>/dev/null)"
return
;;
pull.twohead|pull.octopus)
--
2.7.0.windows.1
next reply other threads:[~2016-02-04 10:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-04 10:34 Sebastian Schuberth [this message]
2016-02-04 11:13 ` [PATCH] git-completion.bash: always swallow error output of for-each-ref Jeff King
2016-02-04 11:26 ` Johannes Schindelin
2016-02-04 11:45 ` Jeff King
2016-02-04 19:06 ` Junio C Hamano
2016-02-12 23:21 ` SZEDER Gábor
2016-02-12 23:40 ` Jeff King
2016-02-13 1:07 ` SZEDER Gábor
2016-02-13 9:21 ` Johannes Schindelin
2016-02-13 13:53 ` SZEDER Gábor
2016-02-13 17:14 ` Johannes Schindelin
2016-02-13 16:57 ` Jeff King
2016-02-12 23:43 ` SZEDER Gábor
2016-02-12 23:46 ` Jeff King
2016-02-13 0:53 ` Duy Nguyen
2016-02-12 20:00 ` Junio C Hamano
2016-02-12 20:10 ` Jeff King
2016-02-12 20:26 ` Junio C Hamano
2016-02-12 21:40 ` SZEDER Gábor
2016-02-12 22:16 ` Jeff King
2016-02-12 23:37 ` Junio C Hamano
2016-02-23 23:30 ` Junio C Hamano
2016-02-24 7:48 ` Sebastian Schuberth
2016-02-12 9:23 ` Sebastian Schuberth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56B32953.2010908@gmail.com \
--to=sschuberth@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=szeder@ira.uka.de \
--cc=tr@thomasrast.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).