All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Kang-Che Sung <explorer09@gmail.com>, Git List <git@vger.kernel.org>
Subject: Re: "Git worktree list" on paths with newlines
Date: Mon, 28 Feb 2022 03:43:45 -0500	[thread overview]
Message-ID: <CAPig+cT9H=rcQz8GhAL5RQP+iXYzYc56yn2eWpQPJz9K0P-zLw@mail.gmail.com> (raw)
In-Reply-To: <xmqqilt2g9cb.fsf@gitster.g>

On Fri, Feb 25, 2022 at 3:47 PM Junio C Hamano <gitster@pobox.com> wrote:
> Kang-Che Sung <explorer09@gmail.com> writes:
> > I wish "git worktree list --porcelain" would show directory names with some
> > quoting or escaping so that tricky names can be handled easily for any program
> > that reads the porcelain output. But I didn't see any command line option that
> > enables quoting or escaping of file names.
> >
> > Does anyone have an idea on what I could do?
>
> I agree that an output mode that claims to be --porcelain should
> produce output that is machine-parseable without ambiguity.
>
> The usual practice is to use quote_c_style() for output without
> "-z", and with "-z", just use the NUL as the termination character,
> as you shouldn't be listing strings with embedded NUL.

A couple additional comments...

Phillip has just submitted a patch to add a `-z` mode to `git worktree
list --porcelain`. You can see it at [1].

Porcelain mode should indeed be quoting the path using
quote_c_style(); the fact that it doesn't is a bug which would be nice
to fix. This has been discussed previously[2], however, there may be
backward compatibility concerns[3].

[1]: https://lore.kernel.org/git/pull.1164.git.1645801727732.gitgitgadget@gmail.com/
[2]: https://lore.kernel.org/git/CAPig+cQq_RnanDQ3jHfNz_L58WyzmsUJBhtdrLxa=H0v_io+WA@mail.gmail.com/
[3]: https://lore.kernel.org/git/936f9b7c-6d54-00bc-f136-4cb4c2836eb6@gmail.com/

      reply	other threads:[~2022-02-28  8:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25  8:32 "Git worktree list" on paths with newlines Kang-Che Sung
2022-02-25 17:11 ` Junio C Hamano
2022-02-28  8:43   ` Eric Sunshine [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPig+cT9H=rcQz8GhAL5RQP+iXYzYc56yn2eWpQPJz9K0P-zLw@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=explorer09@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.