diff options
author | Joseph Heyburn <34041368+jdheyburn@users.noreply.github.com> | 2020-12-08 17:25:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-08 18:25:42 +0100 |
commit | e2f2489a666caf238804783b4e8851a781ac6ffc (patch) | |
tree | e976c62aed37d91b67efc79be9c47c612eca9d05 | |
parent | 452586e79a06d568a3445b26e6d6f4d62c111f52 (diff) | |
download | zsh-e2f2489a666caf238804783b4e8851a781ac6ffc.tar.gz zsh-e2f2489a666caf238804783b4e8851a781ac6ffc.tar.bz2 zsh-e2f2489a666caf238804783b4e8851a781ac6ffc.zip |
fix(git): silently fail in `git_main_branch` if not in a git repo (#9484)
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
-rw-r--r-- | plugins/git/git.plugin.zsh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index bf2619976..e32136f15 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -31,6 +31,7 @@ function work_in_progress() { # Check if main exists and use instead of master function git_main_branch() { + command git rev-parse --git-dir &>/dev/null || return local branch for branch in main trunk; do if command git show-ref -q --verify refs/heads/$branch; then |