git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 09/11] t7064: use update-ref -d to remove upstream branch

From
Han-Wen Nienhuys via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 2, 2021, 16:53 UTC
Message-ID
<1326e99a1fd1704e44b4f2d1a5731fe9da4d0a8a.1627923216.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1052.v3.git.git.1627923216.gitgitgadget@gmail.com>
From: Han-Wen Nienhuys <hanwen@google.com>

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>
---
 t/t7064-wtstatus-pv2.sh | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/t/t7064-wtstatus-pv2.sh b/t/t7064-wtstatus-pv2.sh
index 4613882caff..eeb0534163d 100755
--- a/t/t7064-wtstatus-pv2.sh
+++ b/t/t7064-wtstatus-pv2.sh
@@ -373,10 +373,7 @@ test_expect_success 'verify upstream fields in branch header' '
 
 		## Test upstream-gone case. Fake this by pointing
 		## origin/initial-branch at a non-existing commit.
-		OLD=$(git rev-parse origin/initial-branch) &&
-		NEW=$ZERO_OID &&
-		mv .git/packed-refs .git/old-packed-refs &&
-		sed "s/$OLD/$NEW/g" <.git/old-packed-refs >.git/packed-refs &&
+		git update-ref -d refs/remotes/origin/initial-branch &&
 
 		HUF=$(git rev-parse HEAD) &&
 
-- 
gitgitgadget
Previous: Han-Wen Nienhuys via GitGitGadgetNext: Han-Wen Nienhuys via GitGitGadget
Message 39 of 46 in “Fix direct filesystem access in various test files.”
  1. 0/6 Fix direct filesystem access in various test files.Han-Wen Nienhuys via GitGitGadget, Jul 19, 2021
  2. 5/6 t3320: use git-symbolic-ref rather than filesystem accessHan-Wen Nienhuys via GitGitGadget, Jul 19, 2021
  3. 1/6 t6050: use git-update-ref rather than filesystem accessHan-Wen Nienhuys via GitGitGadget, Jul 19, 2021
  4. 2/6 t1503: mark symlink test as REFFILESHan-Wen Nienhuys via GitGitGadget, Jul 19, 2021
  5. 6/6 t2402: use ref-store test helper to create broken symlinkHan-Wen Nienhuys via GitGitGadget, Jul 19, 2021
  6. 3/6 t6120: use git-update-ref rather than filesystem accessHan-Wen Nienhuys via GitGitGadget, Jul 19, 2021
  7. 4/6 t7509: use git-update-ref rather than filesystem accessHan-Wen Nienhuys via GitGitGadget, Jul 19, 2021
  8. Junio C HamanoJul 19, 2021
  9. 00/11 Fix direct filesystem access in various test files.Han-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  10. 01/11 t6050: use git-update-ref rather than filesystem accessHan-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  11. 03/11 t6120: use git-update-ref rather than filesystem accessHan-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  12. 02/11 t1503: mark symlink test as REFFILESHan-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  13. 05/11 t2402: use ref-store test helper to create broken symlinkHan-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  14. 04/11 t3320: use git-symbolic-ref rather than filesystem accessHan-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  15. 06/11 t1405: use 'git reflog exists' to check reflog existenceHan-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  16. Junio C HamanoJul 23, 2021
  17. 07/11 t1405: mark test for 'git pack-refs' as REFFILESHan-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  18. Junio C HamanoJul 23, 2021
  19. 08/11 t1410: mark test as REFFILESHan-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  20. Junio C HamanoJul 23, 2021
  21. 09/11 t7064: use update-ref -d to remove upstream branchHan-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  22. Junio C HamanoJul 23, 2021
  23. 10/11 t6500: use "ls -1" to snapshot ref database stateHan-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  24. 11/11 t6001: avoid direct file system accessHan-Wen Nienhuys via GitGitGadget, Jul 22, 2021
  25. Junio C HamanoJul 23, 2021
  26. Junio C HamanoJul 23, 2021
  27. Han-Wen NienhuysAug 2, 2021
  28. Junio C HamanoAug 2, 2021
  29. Junio C HamanoAug 2, 2021
  30. Han-Wen NienhuysAug 2, 2021
  31. 00/11 Fix direct filesystem access in various test files.Han-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  32. 01/11 t6050: use git-update-ref rather than filesystem accessHan-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  33. 03/11 t6120: use git-update-ref rather than filesystem accessHan-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  34. 02/11 t1503: mark symlink test as REFFILESHan-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  35. 04/11 t3320: use git-symbolic-ref rather than filesystem accessHan-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  36. 05/11 t2402: use ref-store test helper to create broken symlinkHan-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  37. 07/11 t1405: mark test for 'git pack-refs' as REFFILESHan-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  38. 08/11 t1410: mark test as REFFILESHan-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  39. 09/11 t7064: use update-ref -d to remove upstream branchHan-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  40. 06/11 t1405: use 'git reflog exists' to check reflog existenceHan-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  41. 11/11 t6001: avoid direct file system accessHan-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  42. 10/11 t6500: use "ls -1" to snapshot ref database stateHan-Wen Nienhuys via GitGitGadget, Aug 2, 2021
  43. Junio C HamanoAug 2, 2021
  44. Junio C HamanoAug 2, 2021
  45. Han-Wen NienhuysAug 3, 2021
  46. Junio C HamanoJul 22, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.