Skip to content

Commit 2e14988

Browse files
committed
keepalive: fix merging upstream
When upstream truly diverged from the downstream repository, a merge base needs to be determined, otherwise the merge will fail with: fatal: refusing to merge unrelated histories Unfortunately, merge base calculation will also fail when one of the branches is _shallow_, in which case the error message is actually highly misleading. Let's just ensure that we do not have a shallow clone when running in a fork. There would be an opportunity to make this logic smarter, by using the GitHub REST API to check whether there _are_ upstream commits that aren't reachable from the downstream HEAD, but https://xkcd.com/1205/... Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 8e3ff0b commit 2e14988

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

.github/workflows/keepalive.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
id: merge
2222
if: github.event.repository.fork == true
2323
run: |
24+
git fetch --unshallow origin &&
2425
git fetch https://github.com/gitgitgadget/gitgitgadget-workflows HEAD &&
2526
if test 0 = $(git rev-list --count HEAD..FETCH_HEAD)
2627
then

0 commit comments

Comments
 (0)