Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
e2f2489a
Unverified
Commit
e2f2489a
authored
Dec 08, 2020
by
Joseph Heyburn
Committed by
GitHub
Dec 08, 2020
Browse files
fix(git): silently fail in `git_main_branch` if not in a git repo (#9484)
Co-authored-by:
Marc Cornellà
<
marc.cornella@live.com
>
parent
452586e7
Changes
1
Show whitespace changes
Inline
Side-by-side
plugins/git/git.plugin.zsh
View file @
e2f2489a
...
@@ -31,6 +31,7 @@ function work_in_progress() {
...
@@ -31,6 +31,7 @@ function work_in_progress() {
# Check if main exists and use instead of master
# Check if main exists and use instead of master
function
git_main_branch
()
{
function
git_main_branch
()
{
command
git rev-parse
--git-dir
&>/dev/null
||
return
local
branch
local
branch
for
branch
in
main trunk
;
do
for
branch
in
main trunk
;
do
if
command
git show-ref
-q
--verify
refs/heads/
$branch
;
then
if
command
git show-ref
-q
--verify
refs/heads/
$branch
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment