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

Re: [PATCH] submodule: check for NULL return of get_submodule_ref_store()

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 28, 2018, 20:21 UTC
Message-ID
<CAPig+cQ_j4OyBjsZHE8ZPBojqD7HhSEb14-CFY9qYfXX+dafpQ@mail.gmail.com>
In-Reply-To
<CAGZ79kYD+RC_Z7AH_uH9tZSDHhkikML4HkxUNGxkW8voHJ1i3A@mail.gmail.com>
On Wed, Mar 28, 2018 at 4:08 PM, Stefan Beller <sbeller@google.com> wrote:
Show 17 quoted lines
> On Wed, Mar 28, 2018 at 11:57 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>>> +test_expect_success 'moving the submodule does not break the superproject' '
>>> +       (
>>> +               cd addtest2 &&
>>> +
>>> +               mv repo repo.bak &&
>>> +               git submodule status >actual &&
>>> +               grep -e "^-" -e repo actual &&
>>> +
>>> +               mv repo.bak repo
>>
>> Should this "move back" be encapsulated in a test_when_finished?
>
> I thought about that, but decided against it for some reason as I was debating
> where to put the test_when_finished. I mostly saw those at the very beginning
> of a test and wondered if it can be called from within a subshell.
> (I'd not want to put it at the beginning but rather adjacent to the move.)

It looks like test_when_finished() shouldn't be used in a subshell. However, wouldn't the following be reasonable?

    mv addtest2/repo addtest2/repo.bak &&
    test_when_finished "mv addtest2/repo.bak addtest2/repo" &&
    (
        cd addtest2 &&
        git submodule status >actual &&
        grep -e "^-" -e repo actual
    )
Or, even simpler:
    mv addtest2/repo addtest2/repo.bak &&
    test_when_finished "mv addtest2/repo.bak addtest2/repo" &&
    git -C addtest2 submodule status >actual &&
    grep -e "^-" -e repo actual
Previous: Stefan BellerNext: Stefan Beller
Message 9 of 14 in “Re: Null pointer dereference in git-submodule”
  1. Jeremy FeusiMar 25, 2018
  2. René ScharfeMar 25, 2018
  3. Stefan BellerMar 27, 2018
  4. Junio C HamanoMar 28, 2018
  5. Stefan BellerMar 28, 2018
  6. submodule: check for NULL return of get_submodule_ref_store()Stefan Beller, Mar 28, 2018
  7. Eric SunshineMar 28, 2018
  8. Stefan BellerMar 28, 2018
  9. Eric SunshineMar 28, 2018
  10. Stefan BellerMar 28, 2018
  11. René ScharfeMar 28, 2018
  12. Stefan BellerMar 28, 2018
  13. René ScharfeMar 28, 2018
  14. Junio C HamanoMar 28, 2018

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.