Thread (8 messages) 8 messages, 4 authors, 2018-05-23

Re: [PATCH] t: make many tests depend less on the refs being files

From: Christian Couder <hidden>
Date: 2018-05-23 05:28:04

On Mon, May 21, 2018 at 1:49 PM, SZEDER Gábor [off-list ref] wrote:
quoted
quoted
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 8f5c811dd7..c3b89ae783 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -148,7 +148,7 @@ test_expect_success 'prompt - inside .git directory' '
 test_expect_success 'prompt - deep inside .git directory' '
    printf " (GIT_DIR!)" >expected &&
    (
-           cd .git/refs/heads &&
+           cd .git/objects &&
            __git_ps1 >"$actual"
    ) &&
    test_cmp expected "$actual"
This one looks wrong.
It's right, though.
quoted
Why not `cd .git` instead?
That case is covered in the previous test.

Once upon a time it mattered how deep we were in the .git directory
when running __git_ps1(), because it executed different branches of a
long-ish if-elif chain.  For the prompt it doesn't matter anymore,
because those ifs were eliminated, but for the completion script it
still does, which brings us to:
Thanks for the explanations!
Christian!  There is a similar test, '__git_find_repo_path - parent is
a .git directory' in 't9902-completion.sh', which, too, performs a 'cd
.git/refs/heads'.
Ok, I will take care of both of these tests in another patch.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help