Skip to content

Commit

Permalink
Log how we decided on upstream remote. (#166)
Browse files Browse the repository at this point in the history
Signed-off-by: Phil Dibowitz <[email protected]>
  • Loading branch information
jaymzh authored Jan 14, 2025
1 parent 8a04f72 commit 82f4081
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/sugarjar/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -898,15 +898,21 @@ def rebase_in_progress?
end

def tracked_branch(fallback: true)
branch = nil
s = git_nofail(
'rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'
)
if s.error?
fallback ? most_main : nil

branch = fallback ? most_main : nil
SugarJar::Log.debug("No specific tracked branch, using #{branch}")
else
s.stdout.strip
branch = s.stdout.strip
SugarJar::Log.debug(
"Using explicit tracked branch: #{branch}, use " +
'`git branch -u` to change',
)
end
branch
end

def most_main
Expand Down

0 comments on commit 82f4081

Please sign in to comment.