Archived
Resolve pins to the closest branch
A pin on a pushed feature branch showed as diverged from origin/main because the .gitmodules branch won before any distance was compared. Now the branch containing the pin with the fewest commits after it wins; the .gitmodules branch, the upstream and the remote default branch only break ties and are always compared. An unpushed pin compares just those preferred refs by commits on either side. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -72,6 +72,8 @@ g "$w" push origin main
|
||||
g "$root/work/log" submodule add "$root/remotes/nested.git" modules/nested
|
||||
g "$root/work/log" commit -m "Add nested"
|
||||
g "$root/work/log" push origin main
|
||||
# "archive" ties with main (same tip, sorts first) -> the preferred ref wins
|
||||
g "$root/work/log" push origin main:archive
|
||||
|
||||
super="$root/super"
|
||||
git init -q "$super"
|
||||
@@ -88,6 +90,7 @@ add ui libs/staged
|
||||
add net libs/missing
|
||||
add ui vendor
|
||||
add work libs/work
|
||||
add feature libs/topic -b main
|
||||
g "$super" submodule update --init --recursive
|
||||
g "$super" commit -m "Add submodules"
|
||||
|
||||
@@ -109,6 +112,13 @@ g "$super/libs/feature" checkout origin/feat/search~1
|
||||
g "$super" add libs/feature
|
||||
g "$super" commit -m "Pin feature search"
|
||||
|
||||
# libs/topic: .gitmodules says main, but the pin is the tip of feat/search
|
||||
# -> the closest branch wins over the configured one
|
||||
g "$super/libs/topic" fetch
|
||||
g "$super/libs/topic" checkout origin/feat/search
|
||||
g "$super" add libs/topic
|
||||
g "$super" commit -m "Pin topic search"
|
||||
|
||||
# src/core: checkout moved away from the pin -> off pin
|
||||
g "$super/src/core" checkout HEAD~1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user