git: b86e36493469 - main - git-mfc: Improve handling of remotes

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 24 Jul 2026 21:11:24 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=b86e36493469ded108ad616ebc094886b33851c4

commit b86e36493469ded108ad616ebc094886b33851c4
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-24 21:10:26 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-07-24 21:10:26 +0000

    git-mfc: Improve handling of remotes
    
    If we can't figure out which remote to use, print a useful error instead
    of assuming that "freebsd" is the right remote to use.
---
 tools/tools/git/git-mfc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/tools/git/git-mfc b/tools/tools/git/git-mfc
index 431ed2ebc861..c6c4ea2b786a 100755
--- a/tools/tools/git/git-mfc
+++ b/tools/tools/git/git-mfc
@@ -501,11 +501,11 @@ def main():
     if args.remote:
         remote = args.remote
     else:
-        try:
-            tracking = repo.active_branch.tracking_branch()
-            remote = tracking.remote_name if tracking else 'freebsd'
-        except (TypeError, ValueError):
-            remote = 'freebsd'
+        tracking = repo.active_branch.tracking_branch()
+        if tracking:
+            remote = tracking.remote_name
+        else:
+            err(1, "could not find upstream branch, use --remote")
 
     upstream = remote + '/' + origin