From 90ed93409e9f045d5f6352908d81615615f7c928 Mon Sep 17 00:00:00 2001 From: Phil Dibowitz Date: Tue, 14 Jan 2025 09:33:06 -0800 Subject: [PATCH] Log how we decided on upstream remote. Signed-off-by: Phil Dibowitz --- lib/sugarjar/commands.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/sugarjar/commands.rb b/lib/sugarjar/commands.rb index f1320de..33b221f 100644 --- a/lib/sugarjar/commands.rb +++ b/lib/sugarjar/commands.rb @@ -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