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

Re: [PATCH] pull.sh: quote $upload_pack when passing it to git-fetch

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 30, 2015, 21:13 UTC
Message-ID
<xmqq8u9x73hv.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1438288803-17953-1-git-send-email-Matthieu.Moy@imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 15 quoted lines
> The previous code broke for example
>
>   git pull --upload-pack 'echo --foo'
>
> Reported-by: Joey Hess <id@joeyh.name>
> Fix-suggested-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
> Junio wrote:
>> ${upload_pack+"$upload_pack"} or something.
>
> Indeed, we need to pass nothing, not the empty string if $upload_pack
> is not defined.
>
> This should fix it.

The problematic commit touches a lot more than upload-pack, but all others that take user-supplied strings are meant for "git merge" or "git rebase" that are properly quoted and then eval'ed, so this should be sufficient.

Thanks.
Show 17 quoted lines
>
>  git-pull.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-pull.sh b/git-pull.sh
> index a814bf6..26c5e9f 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -295,7 +295,7 @@ test true = "$rebase" && {
>  }
>  orig_head=$(git rev-parse -q --verify HEAD)
>  git fetch $verbosity $progress $dry_run $recurse_submodules $all $append \
> -$upload_pack $force $tags $prune $keep $depth $unshallow $update_shallow \
> +${upload_pack+"$upload_pack"} $force $tags $prune $keep $depth
> $unshallow $update_shallow \
>  $refmap --update-head-ok "$@" || exit 1
>  test -z "$dry_run" || exit 0
Previous: Matthieu MoyNext: Paul Tan
Message 6 of 8 in “git pull --upload-pack reversion in git 2.5.0”
  1. Joey HessJul 30, 2015
  2. Matthieu MoyJul 30, 2015
  3. Joey HessJul 30, 2015
  4. Junio C HamanoJul 30, 2015
  5. pull.sh: quote $upload_pack when passing it to git-fetchMatthieu Moy, Jul 30, 2015
  6. Junio C HamanoJul 30, 2015
  7. Paul TanJul 31, 2015
  8. Junio C HamanoJul 31, 2015

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.