Merge fca915500912709c587cf0e32e3242fda73ffbcd into 4d9eaac4572380c0442cdd5c443314a3eda9d517
2 files · +8 -0
M internal/app/cli_mr_e2e_test.go +4 -0
| @@ -224,6 +224,10 @@ func TestMergeRequestsCLIEndToEnd(t *testing.T) { | |||
| 224 | 224 | c.mustGit(wt, "reset", "-q", "--hard", main0) | |
| 225 | 225 | c.writeFile(wt, "other.txt", []byte("o\n")) | |
| 226 | 226 | c.mustGit(wt, "push", "-q", "--force", url, "feat/search") | |
| 227 | + | // Push refreshes the pull refs asynchronously. Reconcile them synchronously | |
| 228 | + | // before GC, or the old pull head/merge can still retain the read commit. | |
| 229 | + | require.NoError(t, c.forge.CI.RescanPulls(c.ctx, c.name("proj"))) | |
| 230 | + | require.NotContains(t, strings.Fields(c.bareGit("proj", "rev-list", "--all")), head1) | |
| 227 | 231 | c.bareGit("proj", "reflog", "expire", "--expire=now", "--all") | |
| 228 | 232 | c.bareGit("proj", "gc", "-q", "--prune=now") | |
| 229 | 233 | res = c.cli(t, "", "mr", "show", "proj", "1", "--since-last-read", "--json").ok(t) | |
| @@ -224,6 +224,10 @@ func TestMergeRequestsCLIEndToEnd(t *testing.T) { | |||||
| 224 | c.mustGit(wt, "reset", "-q", "--hard", main0) | 224 | c.mustGit(wt, "reset", "-q", "--hard", main0) | ||
| 225 | c.writeFile(wt, "other.txt", []byte("o\n")) | 225 | c.writeFile(wt, "other.txt", []byte("o\n")) | ||
| 226 | c.mustGit(wt, "push", "-q", "--force", url, "feat/search") | 226 | c.mustGit(wt, "push", "-q", "--force", url, "feat/search") | ||
| 227 | + | // Push refreshes the pull refs asynchronously. Reconcile them synchronously | |||
| 228 | + | // before GC, or the old pull head/merge can still retain the read commit. | |||
| 229 | + | require.NoError(t, c.forge.CI.RescanPulls(c.ctx, c.name("proj"))) | |||
| 230 | + | require.NotContains(t, strings.Fields(c.bareGit("proj", "rev-list", "--all")), head1) | |||
| 227 | c.bareGit("proj", "reflog", "expire", "--expire=now", "--all") | 231 | c.bareGit("proj", "reflog", "expire", "--expire=now", "--all") | ||
| 228 | c.bareGit("proj", "gc", "-q", "--prune=now") | 232 | c.bareGit("proj", "gc", "-q", "--prune=now") | ||
| 229 | res = c.cli(t, "", "mr", "show", "proj", "1", "--since-last-read", "--json").ok(t) | 233 | res = c.cli(t, "", "mr", "show", "proj", "1", "--since-last-read", "--json").ok(t) | ||
M internal/app/web_mr_test.go +4 -0
| @@ -653,6 +653,10 @@ func TestWebMergeRequestSinceAfterForcePush(t *testing.T) { | |||
| 653 | 653 | r.mustGit(r.wt, "reset", "-q", "--hard", "main") | |
| 654 | 654 | r.writeFile(r.wt, "other.txt", []byte("o\n")) | |
| 655 | 655 | r.mustGit(r.wt, "push", "-q", "--force", r.url, "feat/search") | |
| 656 | + | // Push refreshes the pull refs asynchronously. Reconcile them synchronously | |
| 657 | + | // before GC, or the old pull head/merge can still retain the read commit. | |
| 658 | + | require.NoError(t, r.forge.CI.RescanPulls(r.ctx, r.name("proj"))) | |
| 659 | + | require.NotContains(t, strings.Fields(r.bareGit("proj", "rev-list", "--all")), head1) | |
| 656 | 660 | r.bareGit("proj", "reflog", "expire", "--expire=now", "--all") | |
| 657 | 661 | r.bareGit("proj", "gc", "-q", "--prune=now") | |
| 658 | 662 | ||
| @@ -653,6 +653,10 @@ func TestWebMergeRequestSinceAfterForcePush(t *testing.T) { | |||||
| 653 | r.mustGit(r.wt, "reset", "-q", "--hard", "main") | 653 | r.mustGit(r.wt, "reset", "-q", "--hard", "main") | ||
| 654 | r.writeFile(r.wt, "other.txt", []byte("o\n")) | 654 | r.writeFile(r.wt, "other.txt", []byte("o\n")) | ||
| 655 | r.mustGit(r.wt, "push", "-q", "--force", r.url, "feat/search") | 655 | r.mustGit(r.wt, "push", "-q", "--force", r.url, "feat/search") | ||
| 656 | + | // Push refreshes the pull refs asynchronously. Reconcile them synchronously | |||
| 657 | + | // before GC, or the old pull head/merge can still retain the read commit. | |||
| 658 | + | require.NoError(t, r.forge.CI.RescanPulls(r.ctx, r.name("proj"))) | |||
| 659 | + | require.NotContains(t, strings.Fields(r.bareGit("proj", "rev-list", "--all")), head1) | |||
| 656 | r.bareGit("proj", "reflog", "expire", "--expire=now", "--all") | 660 | r.bareGit("proj", "reflog", "expire", "--expire=now", "--all") | ||
| 657 | r.bareGit("proj", "gc", "-q", "--prune=now") | 661 | r.bareGit("proj", "gc", "-q", "--prune=now") | ||
| 658 | 662 | ||||