]> git.ipfire.org Git - thirdparty/git.git/commitdiff
last-modified: document NUL termination
authorToon Claes <toon@iotcl.com>
Fri, 16 Jan 2026 13:22:49 +0000 (14:22 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 16 Jan 2026 18:27:20 +0000 (10:27 -0800)
The command git-last-modified(1) already recognizes the option '-z', and
similar to many other commands this will make the output NUL-terminated
instead of using newlines. Although, this option is missing from the
documentation, so add it.

Signed-off-by: Toon Claes <toon@iotcl.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-last-modified.adoc
builtin/last-modified.c

index 602843e09598a52bf6a8d506f3359f08e9bd39ce..2e5f370c15746fa0f10733ad65388588f110906e 100644 (file)
@@ -9,7 +9,8 @@ git-last-modified - EXPERIMENTAL: Show when files were last modified
 SYNOPSIS
 --------
 [synopsis]
-git last-modified [--recursive] [--show-trees] [<revision-range>] [[--] <path>...]
+git last-modified [--recursive] [--show-trees] [-z]
+                 [<revision-range>] [[--] <path>...]
 
 DESCRIPTION
 -----------
@@ -32,6 +33,9 @@ OPTIONS
        Show tree entries even when recursing into them. It has no effect
        without `--recursive`.
 
+`-z`::
+       Terminate each line with a _NUL_ character rather than a newline.
+
 `<revision-range>`::
        Only traverse commits in the specified revision range. When no
        `<revision-range>` is specified, it defaults to `HEAD` (i.e. the whole
@@ -44,6 +48,22 @@ OPTIONS
        Without an optional path parameter, all files and subdirectories
        in path traversal the are included in the output.
 
+OUTPUT
+------
+
+The output is in the format:
+
+------------
+ <oid> TAB <path> LF
+------------
+
+If a path contains any special characters, the path is C-style quoted. To
+avoid quoting, pass option `-z` to terminate each line with a NUL.
+
+------------
+ <oid> TAB <path> NUL
+------------
+
 SEE ALSO
 --------
 linkgit:git-blame[1],
index b0ecbdc5400d137b7e147c8f91f43210cf8236e0..80b805a589c860c9eb794bb0d64632ff77bea5f1 100644 (file)
@@ -510,8 +510,8 @@ int cmd_last_modified(int argc, const char **argv, const char *prefix,
        struct last_modified lm = { 0 };
 
        const char * const last_modified_usage[] = {
-               N_("git last-modified [--recursive] [--show-trees] "
-                  "[<revision-range>] [[--] <path>...]"),
+               N_("git last-modified [--recursive] [--show-trees] [-z]\n"
+                  "                  [<revision-range>] [[--] <path>...]"),
                NULL
        };