From: Johannes Sixt <j.sixt@viscovery.net>
To: Chris Packham <judge.packham@gmail.com>
Cc: git@vger.kernel.org, jrnieder@gmail.com, gitster@pobox.com,
bebarino@gmail.com
Subject: Re: [PATCHv2 2/2] tests for git alternate command
Date: Thu, 25 Mar 2010 08:38:09 +0100 [thread overview]
Message-ID: <4BAB12E1.8070602@viscovery.net> (raw)
In-Reply-To: <1269497251-13103-3-git-send-email-judge.packham@gmail.com>
Am 3/25/2010 7:07, schrieb Chris Packham:
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
Your patches violate whitespace rules. Use 'git show --check' to see the
questionable lines.
> ---
> I wasn't sure about the test numbering so I just grabbed the highest one. Still
> need to add tests for the deletion use case.
According to t/README, t1* would be a suitable category, perhaps t1430.
> t/t9800-git-alternate.sh | 95 ++++++++++++++++++++++++++++++++++++++++++++++
"git" in the name is redundant
> +test_expect_success \
> + 'Setup for rest of the test' '
The modern style for test headers is
test_expect_success 'Setup for rest of the test' '
test goes here
'
It may improve readability if you insert a blank line after the headline.
> + mkdir -p base &&
> + cd base &&
> + git init &&
> + echo test > a.txt &&
> + echo test > b.txt &&
> + echo test > c.txt &&
> + git add *.txt &&
> + git commit -a -m "Initial Commit" &&
> + cd .. &&
Do not use 'cd dir && ... && cd ..', use (cd dir && ...) like you did in
the rest of the tests.
> +test_expect_success \
> + 'Add alternate after clone' '
> + (cd B &&
> + git alternate -a ../base/.git/objects
> + )
We saw tests like this written with more whitespace like:
(
cd B &&
git alternate -a ../base/.git/objects
)
> +test_expect_success \
> + 'add same alternate fails adding existing abs path' '
> + (cd B &&
> + test_must_fail git alternate -a $PWD/base/.git/objects
This use of $PWD is OK, but for consistency it should be $(pwd) like
below. Moreover, it needs double-quotes.
> +test_expect_success \
> + 'test git alternate display' '
> + testbase=$PWD
You must write this as (d-quotes not needed here)
testbase=$(pwd) &&
for the benefit of Windows. The difference is that $PWD returns /c/path,
but $(pwd) returns c:/path.
When the alternate was set up using the command, git has only ever seen a
c:/path style path (regardless of whether you used $PWD or $(pwd), because
the path is converted to c:/path by the shell before it invokes git), and
therefore the alternates file contains this style.
But when the expected result is constructed, the /c/path style is *not*
converted to c:/path; and a mismatch would be detected.
> + (cd B &&
> + git alternate >actual &&
> + {
> + echo "Object store $testbase/base/.git/objects"
> + echo " referenced via $testbase/B/.git"
> + } >expect &&
> + test_cmp expect actual
> + )
> +'
> +
> +test_expect_success \
> + 'test git alternate recursive display' '
> + testbase=$PWD
Ditto.
> +#rm -rf A B C D base
> \ No newline at end of file
test_done
-- Hannes
next prev parent reply other threads:[~2010-03-25 7:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-22 17:26 Question about .git/objects/info/alternates Chris Packham
2010-03-23 2:42 ` Jonathan Nieder
2010-03-24 18:53 ` Chris Packham
2010-03-24 19:23 ` Jonathan Nieder
2010-03-24 19:58 ` Junio C Hamano
2010-03-24 20:35 ` Chris Packham
2010-03-25 6:07 ` Chris Packham
2010-03-25 6:07 ` [PATCHv2 1/2] Add git alternate command Chris Packham
2010-03-29 7:32 ` Junio C Hamano
2010-03-31 4:35 ` Chris Packham
2010-03-25 6:07 ` [PATCHv2 2/2] tests for " Chris Packham
2010-03-25 7:38 ` Johannes Sixt [this message]
2010-03-25 18:51 ` Chris Packham
2010-03-26 0:48 ` Miklos Vajna
2010-03-26 6:44 ` Johannes Sixt
2010-03-24 20:16 ` Question about .git/objects/info/alternates Stephen Boyd
2010-03-24 20:37 ` Chris Packham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BAB12E1.8070602@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=bebarino@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=judge.packham@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).