t7064: use update-ref -d to remove upstream branch
The previous code tested this by writing $ZERO_OID explicitly in the packed-refs file. This is a type of corruption that doesn't reflect realistic use-cases. In addition, even the ref-store test-tool refuses to write invalid OIDs. (update-ref interprets $ZERO_OID is deleting the ref). Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Han-Wen Nienhuys committed
Aug 2, 2021 at 16:53 UTC
2cf9f0fca1ad0fedb88f63f59b311b4d80b28f0e
1 file changed
+1
-4
t/t7064-wtstatus-pv2.sh
+1
-4
@@ -373,10 +373,7 @@ test_expect_success 'verify upstream fields in branch header' '
373
374
## Test upstream-gone case. Fake this by pointing
375
## origin/initial-branch at a non-existing commit.
376
- OLD=$(git rev-parse origin/initial-branch) &&
377
- NEW=$ZERO_OID &&
378
- mv .git/packed-refs .git/old-packed-refs &&
379
- sed "s/$OLD/$NEW/g" <.git/old-packed-refs >.git/packed-refs &&
376
+ git update-ref -d refs/remotes/origin/initial-branch &&
377
378
HUF=$(git rev-parse HEAD) &&
379