summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c3ce326)
raw | patch | inline | side by side (parent: c3ce326)
author | Jeff King <peff@peff.net> | |
Fri, 7 Dec 2007 21:26:07 +0000 (16:26 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 8 Dec 2007 11:33:24 +0000 (03:33 -0800) |
The output of git-status was recently changed to output relative
paths. Setting this variable to false restores the old behavior for
any old-timers that prefer it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
paths. Setting this variable to false restores the old behavior for
any old-timers that prefer it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
index 736fcd71cce107969c93cbd06490b3956be72a1b..79d51f26ccfa69a3785e6bebcbdce9b320d96e6d 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
The default set of branches for gitlink:git-show-branch[1].
See gitlink:git-show-branch[1].
+status.relativePaths::
+ By default, gitlink:git-status[1] shows paths relative to the
+ current directory. Setting this variable to `false` shows paths
+ relative to the repository root (this was the default for git
+ prior to v1.5.4).
+
tar.umask::
This variable can be used to restrict the permission bits of
tar archive entries. The default is 0002, which turns off the
index b0cb6bc8b74158f3c9012b6f2d0f10f8f9e5bae9..645dc85ceb15c97a55faddbdab3586b39f74a60f 100644 (file)
The paths mentioned in the output, unlike many other git commands, are
made relative to the current directory, if you are working in a
-subdirectory (this is on purpose, to help cutting and pasting).
+subdirectory (this is on purpose, to help cutting and pasting). See
+the status.relativePaths config option below.
CONFIGURATION
compatibility) and `color.status.<slot>` configuration variables
to colorize its output.
+If the config variable `status.relativePaths` is set to false, then all
+paths shown are relative to the repository root, not to the current
+directory.
+
See Also
--------
gitlink:gitignore[5]
diff --git a/builtin-commit.c b/builtin-commit.c
index 2ec8223132807e1df77512d3d77efd71b790496a..19297ac027ab88ffe01d4b9b5dc12c7ae556f6c1 100644 (file)
--- a/builtin-commit.c
+++ b/builtin-commit.c
struct wt_status s;
wt_status_prepare(&s);
- s.prefix = prefix;
+ if (wt_status_relative_paths)
+ s.prefix = prefix;
if (amend) {
s.amend = 1;
diff --git a/t/t7502-status.sh b/t/t7502-status.sh
index d6ae69d46e84a3e470d99efaf33bc0f2c83a9037..9ce50cade8981bb5317397c10b0fabeba4893fc8 100755 (executable)
--- a/t/t7502-status.sh
+++ b/t/t7502-status.sh
'
+cat > expect << \EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# new file: dir2/added
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: dir1/modified
+#
+# Untracked files:
+# (use "git add <file>..." to include in what will be committed)
+#
+# dir1/untracked
+# dir2/modified
+# dir2/untracked
+# expect
+# output
+# untracked
+EOF
+
+test_expect_success 'status without relative paths' '
+
+ git config status.relativePaths false
+ (cd dir1 && git status) > output &&
+ git diff expect output
+
+'
+
test_done
diff --git a/wt-status.c b/wt-status.c
index 05414bb9e9dd064f65ff21ae2c6c53f996a6bd21..51c18796915c0a9e052806eadd460b0f9afa7fee 100644 (file)
--- a/wt-status.c
+++ b/wt-status.c
#include "revision.h"
#include "diffcore.h"
+int wt_status_relative_paths = 1;
int wt_status_use_color = 0;
static char wt_status_colors[][COLOR_MAXLEN] = {
"", /* WT_STATUS_HEADER: normal */
if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
int slot = parse_status_slot(k, 13);
color_parse(v, k, wt_status_colors[slot]);
+ return 0;
+ }
+ if (!strcmp(k, "status.relativepaths")) {
+ wt_status_relative_paths = git_config_bool(k, v);
+ return 0;
}
return git_default_config(k, v);
}
diff --git a/wt-status.h b/wt-status.h
index 225fb4d53561f4f1d6ad43fd990dda1c6da956f0..63d50f2871f51d4363afa2f7bbb21c81186b9f44 100644 (file)
--- a/wt-status.h
+++ b/wt-status.h
int git_status_config(const char *var, const char *value);
int wt_status_use_color;
+int wt_status_relative_paths;
void wt_status_prepare(struct wt_status *s);
void wt_status_print(struct wt_status *s);