public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Kang-Che Sung <explorer09@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: "Git worktree list" on paths with newlines
Date: Fri, 25 Feb 2022 09:11:16 -0800	[thread overview]
Message-ID: <xmqqilt2g9cb.fsf@gitster.g> (raw)
In-Reply-To: <CADDzAfNTuuAWn1ynswTayRqgNNcPn3ou=v6c+z_tRsu5uoqJZA@mail.gmail.com> (Kang-Che Sung's message of "Fri, 25 Feb 2022 16:32:37 +0800")

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.


  reply	other threads:[~2022-02-25 17:11 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 [this message]
2022-02-28  8:43   ` Eric Sunshine

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=xmqqilt2g9cb.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=explorer09@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox