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

Re: [PATCH] test-lib: use subshell instead of cd $new && .. && cd $old

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Aug 30, 2010, 16:04 UTC
Message-ID
<20100830160444.GE3292@burratino>
In-Reply-To
<AANLkTi=z9uUB_YZ9Sb0O8JzaEjazKDzqB=ZVtqTTDf2K@mail.gmail.com>
Ævar Arnfjörð Bjarmason wrote:
> On Mon, Aug 30, 2010 at 15:57, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> Ævar Arnfjörð Bjarmason wrote:
Show 17 quoted lines
>>> -     cd "$repo" || error "Cannot setup test environment"
>>> +     (cd "$repo" || error "Cannot setup test environment"
>>>       "$GIT_EXEC_PATH/git-init" "--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
>>>       error "cannot run git init -- have you built things yet?"
>>> -     mv .git/hooks .git/hooks-disabled
>>> -     cd "$owd"
>>> +     mv .git/hooks .git/hooks-disabled)
>>
>> Style: why not use
>>
>>        (
>>                cd "$repo" ...
>>                ... .git/hooks-disabled
>>        )
>>
>
> I've seen both used and I don't know which is preferred.

Okay. I maintain that the latter is way more readable. Is there any advantage to the former?

Whichever the project chooses can be enshrined in Documentation/CodingGuidelines, of course.

Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 4 of 6 in “test-lib: use subshell instead of cd $new && .. && cd $old”
  1. test-lib: use subshell instead of cd $new && .. && cd $oldÆvar Arnfjörð Bjarmason, Aug 30, 2010
  2. Jonathan NiederAug 30, 2010
  3. Ævar Arnfjörð BjarmasonAug 30, 2010
  4. Jonathan NiederAug 30, 2010
  5. Junio C HamanoAug 31, 2010
  6. Ævar Arnfjörð BjarmasonAug 31, 2010

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.