Skip to content

Commit 5218f85

Browse files
committed
fix(e2e): force prepare_build for the 24_git_dependency lock-anchor check
A bare second `mcpp build` takes the try_fast_build path when build.ninja is fresh (no source change), so prepare_build is skipped and neither the lock-anchor code nor `git ls-remote` runs — leaving the `from lock` assertion vacuous (it cannot match; same failure mode as the original ls-remote assertion the reviewer flagged). Run `mcpp clean` first so the fast-path cannot fire; mcpp.lock and the git cache (in MCPP_HOME/git) both survive `mcpp clean`, so the next build re-prepares, hits the anchor, prints 'from lock' and skips both ls-remote and the clone.
1 parent 05a6c5b commit 5218f85

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

tests/e2e/24_git_dependency.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,17 @@ out=$(${triple}${fp_dir}/bin/branchapp)
153153
echo "FAIL: branch dep v1 not invoked: $out"
154154
cat branch-v1.log; exit 1; }
155155

156-
# Second build with the lock in place must not hit the network for ls-remote.
156+
# Second build with the lock in place must resolve the branch dep from the
157+
# lock commit rather than calling `git ls-remote`. A bare `mcpp build` here
158+
# would take the prepare_build fast-path (build.ninja is fresh → just run
159+
# ninja → "Finished" only), so prepare_build never runs and neither the lock
160+
# anchor path nor `ls-remote` is exercised — leaving the assertion vacuous
161+
# (the original main-branch test passed identically). `mcpp clean` wipes only
162+
# `target/`, so mcpp.lock and the git cache (~/.mcpp/git) survive; the next
163+
# build must re-prepare, hit the anchor, and skip both ls-remote and clone.
164+
"$MCPP" clean >/dev/null
157165
build2=$("$MCPP" build 2>&1)
158-
echo "$build2" | grep -q 'from lock' || { echo "FAIL: branch dep not resolved from lock on rebuild"; cat <<<"$build2"; exit 1; }
166+
echo "$build2" | grep -q 'from lock' || { echo "FAIL: branch dep not resolved from lock on rebuild"; echo "--- build2 ---"; cat <<<"$build2"; exit 1; }
159167
echo "$build2" | grep -q 'Cloning' && { echo "FAIL: branch dep re-cloned on rebuild"; exit 1; } || true
160168

161169
grep -q 'source = "git+' mcpp.lock || {

0 commit comments

Comments
 (0)