mirror of
https://github.com/git/git.git
synced 2024-11-28 04:23:30 +08:00
completion: silence "fatal: Not a git repository" error
It is possible that a user is trying to run a git command and fail to realize that they are not in a git repository or working tree. When trying to complete an operation, __git_refs would fall to a degenerate case and attempt to use "git for-each-ref", which would emit the error. Hide this error message coming from "git for-each-ref". Signed-off-by: John Szakmeister <john@szakmeister.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
670a3c1d5a
commit
8f7ff5b2fe
@ -388,7 +388,8 @@ __git_refs ()
|
||||
;;
|
||||
*)
|
||||
echo "HEAD"
|
||||
git for-each-ref --format="%(refname:short)" -- "refs/remotes/$dir/" | sed -e "s#^$dir/##"
|
||||
git for-each-ref --format="%(refname:short)" -- \
|
||||
"refs/remotes/$dir/" 2>/dev/null | sed -e "s#^$dir/##"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user