1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-28 15:01:21 +02:00

github #48/0001: vcs_info git: avoid warnings in bare repositories

Git 2.25 introduced a change to how git rev-parse --show-toplevel
behaves.  Traditionally, it succeeded with no output if the user was
in a bare repository.  Now it dies, printing an error to standard error.
Consequently, when the user is in a bare repository with a newer Git,
vcs_info prints noisily to standard error.

While this is functionally harmless, it is annoying for the shell to
print messages from Git every time the prompt is printed, so let's
silence the error message.
This commit is contained in:
brian m. carlson 2020-02-16 00:03:13 +00:00 committed by Daniel Shahaf
parent 459e2be810
commit bacad96523
2 changed files with 7 additions and 1 deletions

@ -1,3 +1,9 @@
2020-02-17 brian m. carlson <sandals@crustytoothpaste.net>
* github #48/0001:
Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git:
avoid warnings in bare repositories
2020-02-14 dana <dana@dana.is>
* unposted: Config/version.mk: Post-release version bump

@ -138,7 +138,7 @@ VCS_INFO_git_handle_patches () {
gitdir=${vcs_comm[gitdir]}
VCS_INFO_git_getbranch ${gitdir}
gitbase=$( ${vcs_comm[cmd]} rev-parse --show-toplevel )
gitbase=$( ${vcs_comm[cmd]} rev-parse --show-toplevel 2> /dev/null )
rrn=${gitbase:t}
if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then
gitsha1=$(${vcs_comm[cmd]} rev-parse --quiet --verify HEAD)