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.
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"))
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);
}