summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cd676a5)
raw | patch | inline | side by side (parent: cd676a5)
author | Junio C Hamano <gitster@pobox.com> | |
Wed, 13 Feb 2008 08:34:39 +0000 (00:34 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 13 Feb 2008 22:59:34 +0000 (14:59 -0800) |
This allows the --relative option to say which subdirectory to
pretend to be in, so that in a bare repository, you can say:
$ git log --relative=drivers/ v2.6.20..v2.6.22 -- drivers/scsi/
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pretend to be in, so that in a bare repository, you can say:
$ git log --relative=drivers/ v2.6.20..v2.6.22 -- drivers/scsi/
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/diff-options.txt | patch | blob | history | |
diff.c | patch | blob | history | |
revision.c | patch | blob | history |
index 286c30c01ae859b95cc38847eca72e73b31b1ec6..8dc5b001c42376be1b9f814d516ea43f5c711071 100644 (file)
Swap two inputs; that is, show differences from index or
on-disk file to tree contents.
---relative::
+--relative[=<path>]::
When run from a subdirectory of the project, it can be
told to exclude changes outside the directory and show
- pathnames relative to it with this option.
+ pathnames relative to it with this option. When you are
+ not in a subdirectory (e.g. in a bare repository), you
+ can name which subdirectory to make the output relative
+ to by giving a <path> as an argument.
--text::
Treat all files as text.
index db4bd557b75b46e64d71f7ce9565065269ac6355..2b89b160078b4b0de9605100889f8cee110715d0 100644 (file)
--- a/diff.c
+++ b/diff.c
options->detect_rename = 0;
else if (!strcmp(arg, "--relative"))
DIFF_OPT_SET(options, RELATIVE_NAME);
+ else if (!prefixcmp(arg, "--relative=")) {
+ DIFF_OPT_SET(options, RELATIVE_NAME);
+ options->prefix = arg + 11;
+ }
/* xdiff options */
else if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
diff --git a/revision.c b/revision.c
index 6d9188b6cb0c8eb27de89be21d48b0f2b7dd42c0..4d6f57b64e077b3e3853a199daad7511b5ab2f4c 100644 (file)
--- a/revision.c
+++ b/revision.c
revs->commit_format = CMIT_FMT_DEFAULT;
diff_setup(&revs->diffopt);
- if (prefix) {
+ if (prefix && !revs->diffopt.prefix) {
revs->diffopt.prefix = prefix;
revs->diffopt.prefix_length = strlen(prefix);
}