diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-04-04 10:56:25 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-04-04 10:56:25 -0700 |
commit | 7c6d8ee8fa3be77d4bf4d38f59e866a0af1931f8 (patch) | |
tree | e294c0e59efcbaa48f051c220a8bdfdc66bfd211 /Documentation/git-worktree.txt | |
parent | 77ceb113420ce73c35bdea47cb320b08ed1ab0e9 (diff) | |
parent | d97eb302ea848ff6f8f9af50a176734930964b9a (diff) | |
download | git-7c6d8ee8fa3be77d4bf4d38f59e866a0af1931f8.tar.gz |
Merge branch 'pw/worktree-list-with-z'
"git worktree list --porcelain" did not c-quote pathnames and lock
reasons with unsafe bytes correctly, which is worked around by
introducing NUL terminated output format with "-z".
* pw/worktree-list-with-z:
worktree: add -z option for list subcommand
Diffstat (limited to 'Documentation/git-worktree.txt')
-rw-r--r-- | Documentation/git-worktree.txt | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index 453e155022..ada30c86a7 100644 --- a/Documentation/git-worktree.txt +++ b/Documentation/git-worktree.txt @@ -10,7 +10,7 @@ SYNOPSIS -------- [verse] 'git worktree add' [-f] [--detach] [--checkout] [--lock [--reason <string>]] [-b <new-branch>] <path> [<commit-ish>] -'git worktree list' [-v | --porcelain] +'git worktree list' [-v | --porcelain [-z]] 'git worktree lock' [--reason <string>] <worktree> 'git worktree move' <worktree> <new-path> 'git worktree prune' [-n] [-v] [--expire <expire>] @@ -224,7 +224,14 @@ This can also be set up as the default behaviour by using the --porcelain:: With `list`, output in an easy-to-parse format for scripts. This format will remain stable across Git versions and regardless of user - configuration. See below for details. + configuration. It is recommended to combine this with `-z`. + See below for details. + +-z:: + Terminate each line with a NUL rather than a newline when + `--porcelain` is specified with `list`. This makes it possible + to parse the output when a worktree path contains a newline + character. -q:: --quiet:: @@ -416,7 +423,8 @@ worktree itself. Porcelain Format ~~~~~~~~~~~~~~~~ -The porcelain format has a line per attribute. Attributes are listed with a +The porcelain format has a line per attribute. If `-z` is given then the lines +are terminated with NUL rather than a newline. Attributes are listed with a label and value separated by a single space. Boolean attributes (like `bare` and `detached`) are listed as a label only, and are present only if the value is true. Some attributes (like `locked`) can be listed as a label @@ -454,7 +462,7 @@ prunable gitdir file points to non-existent location ------------ -If the lock reason contains "unusual" characters such as newline, they +Unless `-z` is used any "unusual" characters in the lock reason such as newlines are escaped and the entire reason is quoted as explained for the configuration variable `core.quotePath` (see linkgit:git-config[1]). For Example: |