summaryrefslogtreecommitdiff
path: root/diff-files.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2005-07-13 12:45:51 -0700
committerLibravatar Linus Torvalds <torvalds@g5.osdl.org>2005-07-13 12:55:07 -0700
commit52f28529f4f90cebdca47f8eacbff5cb20004bed (patch)
tree5582a75c2121fca35a99eb35d9e22f97cd2ed5b3 /diff-files.c
parent[PATCH] diff-stages: support "-u" as a synonym for "-p". (diff)
downloadtgif-52f28529f4f90cebdca47f8eacbff5cb20004bed.tar.xz
[PATCH] git-diff-*: --name-only and --name-only-z.
Porcelain layers often want to find only names of changed files, and even with diff-raw output format they end up having to pick out only the filename. Support --name-only (and --name-only-z for xargs -0 and cpio -0 users that want to treat filenames with embedded newlines sanely) flag to help them. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'diff-files.c')
-rw-r--r--diff-files.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/diff-files.c b/diff-files.c
index 3221e31979..6d2aec3406 100644
--- a/diff-files.c
+++ b/diff-files.c
@@ -55,6 +55,10 @@ int main(int argc, const char **argv)
; /* no-op */
else if (!strcmp(argv[1], "-z"))
diff_output_format = DIFF_FORMAT_MACHINE;
+ else if (!strcmp(argv[1], "--name-only"))
+ diff_output_format = DIFF_FORMAT_NAME;
+ else if (!strcmp(argv[1], "--name-only-z"))
+ diff_output_format = DIFF_FORMAT_NAME_Z;
else if (!strcmp(argv[1], "-R"))
diff_setup_opt |= DIFF_SETUP_REVERSE;
else if (!strncmp(argv[1], "-S", 2))