Skip to content

Commit 8c90be2

Browse files
committed
Detecting outgoing changes will default to master when in detached mode
1 parent f2e4193 commit 8c90be2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

mbed/mbed.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -630,20 +630,17 @@ def outgoing():
630630
remote = Git.getremote()
631631
if not remote:
632632
return -1
633-
634633
# Get current branch
635634
branch = Git.getbranch()
636635
if not branch:
637-
# Detached mode is okay as we don't expect the user to publish from detached state without branch
638-
return 0
639-
636+
# Default to "master" in detached mode
637+
branch = "master"
640638
try:
641639
# Check if remote branch exists
642640
if not pquery([git_cmd, 'rev-parse', '%s/%s' % (remote, branch)]):
643641
return 1
644642
except ProcessException:
645643
return 1
646-
647644
# Check for outgoing commits for the same remote branch
648645
return 1 if pquery([git_cmd, 'log', '%s/%s..%s' % (remote, branch, branch)]) else 0
649646

0 commit comments

Comments
 (0)