Thread (7 messages) flat view 7 messages, 6 authors, 2021-08-19

Re: [PATCH] t3200: refactor symlink test

From: Eric Sunshine <hidden>
Date: 2021-08-19 05:52:12

On Thu, Aug 19, 2021 at 1:02 AM Carlo Marcelo Arenas Belón
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
d1931bcf0d (refs: make errno output explicit for refs_resolve_ref_unsafe,
2021-07-20) add a test for a crash when refs is a symlink, but it fails
on windows.

add the missing SYMLINKS dependency and while at it, refactor it slightly
to comply better with the CodingGuidelines.

Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
---
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
@@ -109,17 +109,22 @@ test_expect_success 'git branch -m n/n n should work' '
-test_expect_success 'git branch -m with symlinked .git/refs' '
+test_expect_success SYMLINKS 'git branch -m with symlinked .git/refs' '
        git init subdir &&
        test_when_finished "rm -rf subdir" &&
-       (cd subdir &&
-               for d in refs objects packed-refs ; do
-               rm -rf .git/$d &&
-               ln -s ../../.git/$d .git/$d ; done ) &&
+       (
+               cd subdir &&
+               for d in refs objects packed-refs
+               do
+                       rm -rf .git/$d &&
+                       ln -s ../../.git/$d .git/$d
Ideally, the above line should be:

    ln -s ../../.git/$d .git/$d || exit 1

to catch and signal a failure within the for-loop body (which happens
to be in a subshell; if not in a subshell, you'd use `|| return 1`).
+               done
+       ) &&
        git --git-dir subdir/.git/ branch rename-src &&
-       expect=$(git rev-parse rename-src) &&
+       git rev-parse rename-src >expect &&
        git --git-dir subdir/.git/ branch -m rename-src rename-dest &&
-       test $(git rev-parse rename-dest) = "$expect" &&
+       git rev-parse rename-dest >actual &&
+       test_cmp expect actual &&
        git branch -D rename-dest
 '
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help