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

Re: [PATCH 1/3] t7900-subtree.sh: fix quoting and broken && chains

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 26, 2016, 06:06 UTC
Message-ID
<CAPig+cRGz2eqPK0uaih3hYCV0eLayot3VGyjKaz5Qf8Jy5o=DA@mail.gmail.com>
In-Reply-To
<20160726041416.9438-1-davvid@gmail.com>
On Tue, Jul 26, 2016 at 12:14 AM, David Aguilar <davvid@gmail.com> wrote:
Show 14 quoted lines
> Allow whitespace in arguments to subtree_test_create_repo.
> Add missing && chains.
>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
> @@ -16,16 +16,16 @@ export TEST_DIRECTORY
>  subtree_test_create_repo()
>  {
> -       test_create_repo "$1"
> +       test_create_repo "$1" &&
>         (
> -               cd $1
> +               cd "$1" &&

Thanks, I noticed this in December 2015 while reviewing a patch on the list and have had a patch to fix it sitting in my queue since then but never found time to formalize it.

Show 15 quoted lines
>                 git config log.date relative
>         )
>  }
>
>  create()
>  {
> -       echo "$1" >"$1"
> +       echo "$1" >"$1" &&
>         git add "$1"
>  }
>
> @@ -73,10 +73,10 @@ join_commits()
>  test_create_commit() (
>         repo=$1
>         commit=$2

Perhaps &&-chain the above two lines also to future-proof against someone inserting important code somewhere above the following 'cd'.

Show 10 quoted lines
> -       cd "$repo"
> -       mkdir -p $(dirname "$commit") \
> +       cd "$repo" &&
> +       mkdir -p "$(dirname "$commit")" \
>         || error "Could not create directory for commit"
> -       echo "$commit" >"$commit"
> +       echo "$commit" >"$commit" &&
>         git add "$commit" || error "Could not add commit"
>         git commit -m "$commit" || error "Could not commit"
>  )
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 7 in “t7900-subtree.sh: fix quoting and broken && chains”
  1. 1/3 t7900-subtree.sh: fix quoting and broken && chainsDavid Aguilar, Jul 26, 2016
  2. 2/3 subtree: fix "git subtree split --rejoin"David Aguilar, Jul 26, 2016
  3. 3/3 subtree: adjust style to match CodingGuidelinesDavid Aguilar, Jul 26, 2016
  4. Johannes SixtJul 26, 2016
  5. Junio C HamanoJul 26, 2016
  6. Eric SunshineJul 26, 2016
  7. Junio C HamanoJul 26, 2016

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.