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

Re: [PATCH 2/3] contrib/subtree/t: Added tests for .gitsubtree support

From
Paul Campbell <pcampbell@kemitix.net>
Date
Feb 15, 2013, 23:16 UTC
Message-ID
<CALeLG_nLz9Gfqcfk4EcWixRXbWC0x0GUVFDAKD20DGbkhRNWvQ@mail.gmail.com>
In-Reply-To
<20130215225624.GB21165@google.com>
Hi Jonathan,
On Fri, Feb 15, 2013 at 10:56 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 26 quoted lines
> Hi Paul,
>
> Paul Campbell wrote:
>
>> --- a/contrib/subtree/t/t7900-subtree.sh
>> +++ b/contrib/subtree/t/t7900-subtree.sh
>> @@ -465,4 +465,34 @@ test_expect_success 'verify one file change per commit' '
> [...]
>> +test_expect_success 'change in subtree is pushed okay' '
>> +        cd copy0 && create new_file && git commit -m"Added new_file" &&
>> +        cd .. && git subtree push --prefix=copy0 2>&1 | \
>
> If it possible to restrict the chdirs to subshells, that can make the
> test more resiliant to early failures without breaking later tests.
>
> That is:
>
>         (
>                 cd copy0 &&
>                 create new_file &&
>                 test_tick &&
>                 git commit -m "add new_file"
>         ) &&
>         git subtree push --prefix=copy0 >output 2>&1 &&
>         grep "..." output
>
Adding them in.
Show 5 quoted lines
>> +                grep "^\s\{3\}[0-9a-f]\{7\}\.\.[0-9a-f]\{7\}\s\s[0-9a-f]\{40\}\s->\ssub1$"
>
> This might not be portable if I understand
> Documentation/CodingGuidelines correctly.
>

And it's ugly. But I believe it fits the "don't use grep -E" condition. Unless I missed something else.

Is there was a better way to verify that the push operation succeeds then grepping for a SHA1?

Show 7 quoted lines
> [...]
>> +        (grep "^copy3 . sub2$" .gitsubtree && die || true) &&
>
>         ! grep "^copy3 . sub2\$" .gitsubtree &&
>
> Hope that helps,
> Jonathan
Thanks. That's a much neater way to do it.
-- 
Paul [W] Campbell
Previous: Jonathan NiederNext: Jonathan Nieder
Message 3 of 6 in “contrib/subtree/t: Added tests for .gitsubtree support”
  1. 2/3 contrib/subtree/t: Added tests for .gitsubtree supportPaul Campbell, Feb 15, 2013
  2. Jonathan NiederFeb 15, 2013
  3. Paul CampbellFeb 15, 2013
  4. Jonathan NiederFeb 17, 2013
  5. Paul CampbellFeb 17, 2013
  6. Jonathan NiederFeb 18, 2013

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.