Replies: 1 comment 1 reply
-
I briefly tried creating a Git test case that mimics your scenario: diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh
index dfc0d96d8a..75e159ceaa 100755
--- a/t/t1507-rev-parse-upstream.sh
+++ b/t/t1507-rev-parse-upstream.sh
@@ -129,6 +129,16 @@ test_expect_success 'checkout -b new my-side@{u} forks from the same' '
)
'
+test_expect_success 'rev-parse --symbolic works in empty repo' '
+ git init empty &&
+ git -C empty remote add origin "file://$(pwd)" &&
+ git -C empty config branch.test.remote origin &&
+ git -C empty config branch.test.remote refs/heads/side &&
+ echo side >expect &&
+ git -C empty rev-parse --symbolic test@{u} >actual&&
+ test_cmp expect actual
+'
+
test_expect_success 'merge my-side@{u} records the correct name' '
(
cd clone && This test only configures the upstream, but the branch doesn't actually exist. The Since the repo is empty, I would expect the ref to not exist, so I think your fallback is a decent option. It has an issue with "what does 'sync' mean for Git?" It's not an action that corresponds directly to a |
Beta Was this translation helpful? Give feedback.
-
VS Code currently uses
rev-parse --symbolic-full-name <branch-name>@{u}
to get the current upstream. This fails in an edge case where the repo is empy but has an upstream branch configured. So we have an open PR to fix this edge case by looking up the branch config. And looking for the remote and merge properties.IMO, it sounds like a decent fallback, but I would still use
rev-parse
first -- any thoughts on that or is there a better approach?RE: microsoft/vscode#114163
Beta Was this translation helpful? Give feedback.
All reactions