{"thread":{"id":"11179","subject":"[PATCH] quote_path: convert empty path to \"./\"","startedAt":"2007-12-07T16:57:04Z","lastAt":"2007-12-08T08:45:52Z","messageCount":12,"participants":["Jeff King","Johannes Schindelin","Thomas Harning","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"62297","messageId":"20071207165703.GA8889@sigill.intra.peff.net","threadId":"11179","inReplyTo":null,"subject":"[PATCH] quote_path: convert empty path to \"./\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-12-07T16:57:04Z","receivedAt":"2007-12-07T16:57:04Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Now that we are correctly removing leading prefixes from files in git\nstatus, there is a degenerate case: the directory matching the prefix.\nBecause we show only the directory name for a directory that contains\nonly untracked files, it gets collapsed to an empty string.\n\nExample:\n\n  $ git init\n  $ mkdir subdir\n  $ touch subdir/file\n  $ git status\n  ...\n  # Untracked files:\n  #   (use \"git add <file>...\" to include in what will be committed)\n  #\n  #       subdir/\n\n  So far, so good.\n\n  $ cd subdir\n  $ git status\n  ....\n  # Untracked files:\n  #   (use \"git add <file>...\" to include in what will be committed)\n  #\n  #\n\n  Oops, that's a bit confusing.\n\n  This patch prints './' to show that there is some output.\n\n---\nI think it looks a bit ugly because it is so small (though just '.' was\neven worse). But I don't see what else would make sense.\n\n wt-status.c |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex 02dbb75..31d83bf 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -121,6 +121,9 @@ static char *quote_path(const char *in, int len,\n \t\t}\n \t}\n \n+\tif (!out->len)\n+\t\tstrbuf_addstr(out, \"./\");\n+\n \treturn out->buf;\n }\n \n-- \n1.5.3.7.2156.g3d791-dirty\n"},{"id":"62301","messageId":"Pine.LNX.4.64.0712071853500.27959@racer.site","threadId":"11179","inReplyTo":"20071207165703.GA8889@sigill.intra.peff.net","subject":"Re: [PATCH] quote_path: convert empty path to \"./\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-07T18:54:07Z","receivedAt":"2007-12-07T18:54:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 7 Dec 2007, Jeff King wrote:\n\n>   # Untracked files:\n>   #   (use \"git add <file>...\" to include in what will be committed)\n>   #\n>   #       subdir/\n> \n>   So far, so good.\n> \n>   $ cd subdir\n>   $ git status\n>   ....\n>   # Untracked files:\n>   #   (use \"git add <file>...\" to include in what will be committed)\n>   #\n>   #\n> \n>   Oops, that's a bit confusing.\n> \n>   This patch prints './' to show that there is some output.\n\nSounds reasonable.\n\nCiao,\nDscho\n"},{"id":"62303","messageId":"4759996B.2000300@gmail.com","threadId":"11179","inReplyTo":"Pine.LNX.4.64.0712071853500.27959@racer.site","subject":"Re: [PATCH] quote_path: convert empty path to \"./\"","fromName":"Thomas Harning","fromEmail":"harningt@gmail.com","sentAt":"2007-12-07T19:05:15Z","receivedAt":"2007-12-07T19:05:15Z","isPatch":true,"sender":{"key":"harningt@gmail.com","avatar":"https://gravatar.com/avatar/a79ddd43da8c8f1f899cd75b7b95cc5f3b2ba5643400468988b1a12c86b75d08?d=mp&s=160"},"body":"Johannes Schindelin wrote:\n> Hi,\n>\n> On Fri, 7 Dec 2007, Jeff King wrote:\n>   \n>> ...\n>>     \n>\n> Sounds reasonable.\n>\n> Ciao,\n> Dscho  \nI concur.  There is one case that this seems to dodge.  What about the \ncase where you are in:\n\n/test/test_2  where /test  is not tracked...\n\nThis should probably show \"./../\"   not just \"./\"   , right?\n"},{"id":"62317","messageId":"20071207204937.GA20111@coredump.intra.peff.net","threadId":"11179","inReplyTo":"4759996B.2000300@gmail.com","subject":"Re: [PATCH] quote_path: convert empty path to \"./\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-12-07T20:49:37Z","receivedAt":"2007-12-07T20:49:37Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Dec 07, 2007 at 02:05:15PM -0500, Thomas Harning wrote:\n\n> I concur.  There is one case that this seems to dodge.  What about the case \n> where you are in:\n>\n> /test/test_2  where /test  is not tracked...\n>\n> This should probably show \"./../\"   not just \"./\"   , right?\n\nIt already says \"../\", which is correct:\n\n  $ git init\n  $ mkdir test && cd test\n  $ touch file\n  $ mkdir test2 && cd test2\n  $ git status\n  ...\n  # Untracked files:\n  #   (use \"git add <file>...\" to include in what will be committed)\n  #\n  #       ../\n\nThere's no point in ever saying \"./\" _except_ in the case where the\noutput would be totally blank, since there is no way to tell that it is\nan output line.\n\nPersonally, I don't like either the \"../\" or the \"./\", but I actually\nthink the relative paths are less readable than the full paths in\ngeneral.\n\n-Peff\n"},{"id":"62323","messageId":"20071207212607.GA11504@coredump.intra.peff.net","threadId":"11179","inReplyTo":"20071207204937.GA20111@coredump.intra.peff.net","subject":"[PATCH] add status.relativePaths config variable","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-12-07T21:26:07Z","receivedAt":"2007-12-07T21:26:07Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The output of git-status was recently changed to output\nrelative paths. Setting this variable to false restores the\nold behavior for any old-timers that prefer it.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nOn Fri, Dec 07, 2007 at 03:49:37PM -0500, Jeff King wrote:\n\n> Personally, I don't like either the \"../\" or the \"./\", but I actually\n> think the relative paths are less readable than the full paths in\n> general.\n\nSo here is a config option to turn it off; I don't think there should be\nany consistency problems, since git-status output is meant to be\nhuman-readable (and after all, we just changed it :) ).\n\nThis patch also contains a small buglet fix in the neighboring code\nwhere we didn't stop trying to match \"color.status.*\" even after we used\nit to set the status color.\n\n Documentation/config.txt |    6 ++++++\n builtin-commit.c         |    3 +--\n builtin-revert.c         |    2 +-\n t/t7502-status.sh        |   31 +++++++++++++++++++++++++++++++\n wt-status.c              |   10 +++++++++-\n wt-status.h              |    2 +-\n 6 files changed, 49 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex f0ffb9d..fabe7f8 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -776,6 +776,12 @@ showbranch.default::\n \tThe default set of branches for gitlink:git-show-branch[1].\n \tSee gitlink:git-show-branch[1].\n \n+status.relativePaths::\n+\tBy default, gitlink:git-status[1] shows paths relative to the\n+\tcurrent directory. Setting this variable to `false` shows paths\n+\trelative to the repository root (this was the default for git\n+\tprior to v1.5.4).\n+\n tar.umask::\n \tThis variable can be used to restrict the permission bits of\n \ttar archive entries.  The default is 0002, which turns off the\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 18c6323..04b3bf1 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -284,8 +284,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix)\n {\n \tstruct wt_status s;\n \n-\twt_status_prepare(&s);\n-\ts.prefix = prefix;\n+\twt_status_prepare(&s, prefix);\n \n \tif (amend) {\n \t\ts.amend = 1;\ndiff --git a/builtin-revert.c b/builtin-revert.c\nindex 4bf8eb2..c285f8e 100644\n--- a/builtin-revert.c\n+++ b/builtin-revert.c\n@@ -277,7 +277,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)\n \n \t\tif (get_sha1(\"HEAD\", head))\n \t\t\tdie (\"You do not have a valid HEAD\");\n-\t\twt_status_prepare(&s);\n+\t\twt_status_prepare(&s, NULL);\n \t\tif (s.commitable)\n \t\t\tdie (\"Dirty index: cannot %s\", me);\n \t\tdiscard_cache();\ndiff --git a/t/t7502-status.sh b/t/t7502-status.sh\nindex d6ae69d..9ce50ca 100755\n--- a/t/t7502-status.sh\n+++ b/t/t7502-status.sh\n@@ -88,4 +88,35 @@ test_expect_success 'status with relative paths' '\n \n '\n \n+cat > expect << \\EOF\n+# On branch master\n+# Changes to be committed:\n+#   (use \"git reset HEAD <file>...\" to unstage)\n+#\n+#\tnew file:   dir2/added\n+#\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#\n+#\tmodified:   dir1/modified\n+#\n+# Untracked files:\n+#   (use \"git add <file>...\" to include in what will be committed)\n+#\n+#\tdir1/untracked\n+#\tdir2/modified\n+#\tdir2/untracked\n+#\texpect\n+#\toutput\n+#\tuntracked\n+EOF\n+\n+test_expect_success 'status without relative paths' '\n+\n+\tgit config status.relativePaths false\n+\t(cd dir1 && git status) > output &&\n+\tgit diff expect output\n+\n+'\n+\n test_done\ndiff --git a/wt-status.c b/wt-status.c\nindex 02dbb75..b21b2c4 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -8,6 +8,7 @@\n #include \"revision.h\"\n #include \"diffcore.h\"\n \n+int wt_status_relative_paths = 1;\n int wt_status_use_color = 0;\n static char wt_status_colors[][COLOR_MAXLEN] = {\n \t\"\",         /* WT_STATUS_HEADER: normal */\n@@ -42,7 +43,7 @@ static const char* color(int slot)\n \treturn wt_status_use_color ? wt_status_colors[slot] : \"\";\n }\n \n-void wt_status_prepare(struct wt_status *s)\n+void wt_status_prepare(struct wt_status *s, const char *prefix)\n {\n \tunsigned char sha1[20];\n \tconst char *head;\n@@ -53,6 +54,8 @@ void wt_status_prepare(struct wt_status *s)\n \ts->reference = \"HEAD\";\n \ts->fp = stdout;\n \ts->index_file = get_index_file();\n+\tif (wt_status_relative_paths)\n+\t\ts->prefix = prefix;\n }\n \n static void wt_status_print_cached_header(struct wt_status *s)\n@@ -397,6 +400,11 @@ int git_status_config(const char *k, const char *v)\n \tif (!prefixcmp(k, \"status.color.\") || !prefixcmp(k, \"color.status.\")) {\n \t\tint slot = parse_status_slot(k, 13);\n \t\tcolor_parse(v, k, wt_status_colors[slot]);\n+\t\treturn 0;\n+\t}\n+\tif (!strcmp(k, \"status.relativepaths\")) {\n+\t\twt_status_relative_paths = git_config_bool(k, v);\n+\t\treturn 0;\n \t}\n \treturn git_default_config(k, v);\n }\ndiff --git a/wt-status.h b/wt-status.h\nindex 225fb4d..0ed94f3 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -28,7 +28,7 @@ struct wt_status {\n \n int git_status_config(const char *var, const char *value);\n int wt_status_use_color;\n-void wt_status_prepare(struct wt_status *s);\n+void wt_status_prepare(struct wt_status *s, const char *prefix);\n void wt_status_print(struct wt_status *s);\n \n #endif /* STATUS_H */\n-- \n1.5.3.7.2159.gde63a-dirty\n"},{"id":"62381","messageId":"7vejdxy70p.fsf@gitster.siamese.dyndns.org","threadId":"11179","inReplyTo":"20071207212607.GA11504@coredump.intra.peff.net","subject":"Re: [PATCH] add status.relativePaths config variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-08T07:34:14Z","receivedAt":"2007-12-08T07:34:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> The output of git-status was recently changed to output\n> relative paths. Setting this variable to false restores the\n> old behavior for any old-timers that prefer it.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> On Fri, Dec 07, 2007 at 03:49:37PM -0500, Jeff King wrote:\n>\n>> Personally, I don't like either the \"../\" or the \"./\", but I actually\n>> think the relative paths are less readable than the full paths in\n>> general.\n>\n> So here is a config option to turn it off; I don't think there should be\n> any consistency problems, since git-status output is meant to be\n> human-readable (and after all, we just changed it :) ).\n\nI like the general idea (and suspect we might want to make it default to\nfalse to retain the original behaviour, but I'd refrain from suggesting\nit, to keep the user experience stable during the upcoming -rc period).\n\nWe'd need an update to git-status documentation to mention the variable.\n\n> diff --git a/builtin-commit.c b/builtin-commit.c\n> index 18c6323..04b3bf1 100644\n> --- a/builtin-commit.c\n> +++ b/builtin-commit.c\n> @@ -284,8 +284,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix)\n>  {\n>  \tstruct wt_status s;\n>  \n> -\twt_status_prepare(&s);\n> -\ts.prefix = prefix;\n> +\twt_status_prepare(&s, prefix);\n\nI have been wondering ever since receiving this patch if this is a good\ninterface change.  Was there a problem if instead:\n\n\t- The implementation of wt_status_prepare(&s) stays as before;\n\n\t- run_status(), after calling wt_status_prepare(&s), notices the\n          configuration variable, and sets s.prefix conditionally;\n"},{"id":"62382","messageId":"7vaboly6dv.fsf@gitster.siamese.dyndns.org","threadId":"11179","inReplyTo":"7vejdxy70p.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] add status.relativePaths config variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-08T07:47:56Z","receivedAt":"2007-12-08T07:47:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> I have been wondering ever since receiving this patch if this is a good\n> interface change.  Was there a problem if instead:\n>\n> \t- The implementation of wt_status_prepare(&s) stays as before;\n>\n> \t- run_status(), after calling wt_status_prepare(&s), notices the\n>           configuration variable, and sets s.prefix conditionally;\n\nWhich would make the rewritten patch like this...\n\n-- >8 --\nFrom: Jeff King <peff@peff.net>\nDate: Fri, 7 Dec 2007 16:26:07 -0500\nSubject: [PATCH] add status.relativePaths config variable\n\nThe output of git-status was recently changed to output relative\npaths. Setting this variable to false restores the old behavior for\nany old-timers that prefer it.\n\nSigned-off-by: Jeff King <peff@peff.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/config.txt     |    6 ++++++\n Documentation/git-status.txt |    5 ++++-\n builtin-commit.c             |    3 ++-\n t/t7502-status.sh            |   31 +++++++++++++++++++++++++++++++\n wt-status.c                  |    6 ++++++\n wt-status.h                  |    1 +\n 6 files changed, 50 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 736fcd7..79d51f2 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -762,6 +762,12 @@ showbranch.default::\n \tThe default set of branches for gitlink:git-show-branch[1].\n \tSee gitlink:git-show-branch[1].\n \n+status.relativePaths::\n+\tBy default, gitlink:git-status[1] shows paths relative to the\n+\tcurrent directory. Setting this variable to `false` shows paths\n+\trelative to the repository root (this was the default for git\n+\tprior to v1.5.4).\n+\n tar.umask::\n \tThis variable can be used to restrict the permission bits of\n \ttar archive entries.  The default is 0002, which turns off the\ndiff --git a/Documentation/git-status.txt b/Documentation/git-status.txt\nindex b0cb6bc..bd4d787 100644\n--- a/Documentation/git-status.txt\n+++ b/Documentation/git-status.txt\n@@ -42,7 +42,10 @@ template comments, and all the output lines are prefixed with '#'.\n \n The paths mentioned in the output, unlike many other git commands, are\n made relative to the current directory, if you are working in a\n-subdirectory (this is on purpose, to help cutting and pasting).\n+subdirectory (this is on purpose, to help cutting and pasting).  You can\n+restore the older behaviour of showing the paths as relative to the top\n+of the work tree by setting `status.relativepaths` configuration\n+variable to `false`.\n \n \n CONFIGURATION\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 2ec8223..19297ac 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -285,7 +285,8 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix)\n \tstruct wt_status s;\n \n \twt_status_prepare(&s);\n-\ts.prefix = prefix;\n+\tif (wt_status_relative_paths)\n+\t\ts.prefix = prefix;\n \n \tif (amend) {\n \t\ts.amend = 1;\ndiff --git a/t/t7502-status.sh b/t/t7502-status.sh\nindex d6ae69d..9ce50ca 100755\n--- a/t/t7502-status.sh\n+++ b/t/t7502-status.sh\n@@ -88,4 +88,35 @@ test_expect_success 'status with relative paths' '\n \n '\n \n+cat > expect << \\EOF\n+# On branch master\n+# Changes to be committed:\n+#   (use \"git reset HEAD <file>...\" to unstage)\n+#\n+#\tnew file:   dir2/added\n+#\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#\n+#\tmodified:   dir1/modified\n+#\n+# Untracked files:\n+#   (use \"git add <file>...\" to include in what will be committed)\n+#\n+#\tdir1/untracked\n+#\tdir2/modified\n+#\tdir2/untracked\n+#\texpect\n+#\toutput\n+#\tuntracked\n+EOF\n+\n+test_expect_success 'status without relative paths' '\n+\n+\tgit config status.relativePaths false\n+\t(cd dir1 && git status) > output &&\n+\tgit diff expect output\n+\n+'\n+\n test_done\ndiff --git a/wt-status.c b/wt-status.c\nindex 05414bb..51c1879 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -8,6 +8,7 @@\n #include \"revision.h\"\n #include \"diffcore.h\"\n \n+int wt_status_relative_paths = 1;\n int wt_status_use_color = 0;\n static char wt_status_colors[][COLOR_MAXLEN] = {\n \t\"\",         /* WT_STATUS_HEADER: normal */\n@@ -400,6 +401,11 @@ int git_status_config(const char *k, const char *v)\n \tif (!prefixcmp(k, \"status.color.\") || !prefixcmp(k, \"color.status.\")) {\n \t\tint slot = parse_status_slot(k, 13);\n \t\tcolor_parse(v, k, wt_status_colors[slot]);\n+\t\treturn 0;\n+\t}\n+\tif (!strcmp(k, \"status.relativepaths\")) {\n+\t\twt_status_relative_paths = git_config_bool(k, v);\n+\t\treturn 0;\n \t}\n \treturn git_default_config(k, v);\n }\ndiff --git a/wt-status.h b/wt-status.h\nindex 225fb4d..63d50f2 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -28,6 +28,7 @@ struct wt_status {\n \n int git_status_config(const char *var, const char *value);\n int wt_status_use_color;\n+int wt_status_relative_paths;\n void wt_status_prepare(struct wt_status *s);\n void wt_status_print(struct wt_status *s);\n \n-- \n1.5.3.7-2182-g108b\n"},{"id":"62383","messageId":"20071208075538.GA4812@coredump.intra.peff.net","threadId":"11179","inReplyTo":"7vejdxy70p.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] add status.relativePaths config variable","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-12-08T07:55:38Z","receivedAt":"2007-12-08T07:55:38Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Dec 07, 2007 at 11:34:14PM -0800, Junio C Hamano wrote:\n\n> I like the general idea (and suspect we might want to make it default to\n> false to retain the original behaviour, but I'd refrain from suggesting\n> it, to keep the user experience stable during the upcoming -rc period).\n> \n> We'd need an update to git-status documentation to mention the variable.\n\nPatch is below; please squash it into the original.\n\nIt seems kind of silly to manually write the \"Configuration\" section for\ngit-status, though. It would be nice if our config.txt could be\nannotated to mention which commands use which config variables, and\ngit-*.txt could automagically include the right sections.\n\n> > -\twt_status_prepare(&s);\n> > -\ts.prefix = prefix;\n> > +\twt_status_prepare(&s, prefix);\n> \n> I have been wondering ever since receiving this patch if this is a good\n> interface change.  Was there a problem if instead:\n> \n> \t- The implementation of wt_status_prepare(&s) stays as before;\n> \n> \t- run_status(), after calling wt_status_prepare(&s), notices the\n>           configuration variable, and sets s.prefix conditionally;\n\nThat would work fine. My reasoning was: the point of wt_status_prepare\nis to initialize the wt_status object. I thought the \"whether to use\nrelative paths based on config\" logic should be something that _every_\npreparer uses. OTOH, when I wrote it, I never expected that anyone _but_\nrun_status would call it (I must confess to not really investigating why\ngit-revert needed it; looks like it is to find a dirty index or working\ntree, which is a little silly, since as a side effect we will do a find\non all untracked files).\n\nI am fine with either; your call. Documentation patch is below.\n\n---\ndiff --git a/Documentation/git-status.txt b/Documentation/git-status.txt\nindex b0cb6bc..645dc85 100644\n--- a/Documentation/git-status.txt\n+++ b/Documentation/git-status.txt\n@@ -42,7 +42,8 @@ template comments, and all the output lines are prefixed with '#'.\n \n The paths mentioned in the output, unlike many other git commands, are\n made relative to the current directory, if you are working in a\n-subdirectory (this is on purpose, to help cutting and pasting).\n+subdirectory (this is on purpose, to help cutting and pasting). See\n+the status.relativePaths config option below.\n \n \n CONFIGURATION\n@@ -53,6 +54,10 @@ mean the same thing and the latter is kept for backward\n compatibility) and `color.status.<slot>` configuration variables\n to colorize its output.\n \n+If the config variable `status.relativePaths` is set to false, then all\n+paths shown are relative to the repository root, not to the current\n+directory.\n+\n See Also\n --------\n gitlink:gitignore[5]\n"},{"id":"62384","messageId":"20071208080238.GB4812@coredump.intra.peff.net","threadId":"11179","inReplyTo":"7vaboly6dv.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] add status.relativePaths config variable","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-12-08T08:02:38Z","receivedAt":"2007-12-08T08:02:38Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Dec 07, 2007 at 11:47:56PM -0800, Junio C Hamano wrote:\n\n> Which would make the rewritten patch like this...\n\nLooks like our patches just crossed paths.  Yours looks OK, but we\nshould add something to the 'configuration' section, and...\n\n> diff --git a/wt-status.h b/wt-status.h\n> index 225fb4d..63d50f2 100644\n> --- a/wt-status.h\n> +++ b/wt-status.h\n> @@ -28,6 +28,7 @@ struct wt_status {\n>  \n>  int git_status_config(const char *var, const char *value);\n>  int wt_status_use_color;\n> +int wt_status_relative_paths;\n>  void wt_status_prepare(struct wt_status *s);\n>  void wt_status_print(struct wt_status *s);\n\nShouldn't both of these ints be marked \"extern\"? I'm surprised it worked\nat all (or perhaps the part of my brain that stores C linkage issues is\nrotting?).\n\n-Peff\n"},{"id":"62385","messageId":"7v63z9y5k2.fsf@gitster.siamese.dyndns.org","threadId":"11179","inReplyTo":"20071208080238.GB4812@coredump.intra.peff.net","subject":"Re: [PATCH] add status.relativePaths config variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-08T08:05:49Z","receivedAt":"2007-12-08T08:05:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Fri, Dec 07, 2007 at 11:47:56PM -0800, Junio C Hamano wrote:\n>\n>> Which would make the rewritten patch like this...\n>\n> Looks like our patches just crossed paths.  Yours looks OK, but we\n> should add something to the 'configuration' section, and...\n>\n>> diff --git a/wt-status.h b/wt-status.h\n>> index 225fb4d..63d50f2 100644\n>> --- a/wt-status.h\n>> +++ b/wt-status.h\n>> @@ -28,6 +28,7 @@ struct wt_status {\n>>  \n>>  int git_status_config(const char *var, const char *value);\n>>  int wt_status_use_color;\n>> +int wt_status_relative_paths;\n>>  void wt_status_prepare(struct wt_status *s);\n>>  void wt_status_print(struct wt_status *s);\n>\n> Shouldn't both of these ints be marked \"extern\"? I'm surprised it worked\n> at all (or perhaps the part of my brain that stores C linkage issues is\n> rotting?).\n\nYes, rotting very much.\n"},{"id":"62386","messageId":"7v1w9xy55h.fsf@gitster.siamese.dyndns.org","threadId":"11179","inReplyTo":"20071208075538.GA4812@coredump.intra.peff.net","subject":"Re: [PATCH] add status.relativePaths config variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-08T08:14:34Z","receivedAt":"2007-12-08T08:14:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Fri, Dec 07, 2007 at 11:34:14PM -0800, Junio C Hamano wrote:\n> ...\n>> I have been wondering ever since receiving this patch if this is a good\n>> interface change.  Was there a problem if instead:\n>> \n>> \t- The implementation of wt_status_prepare(&s) stays as before;\n>> \n>> \t- run_status(), after calling wt_status_prepare(&s), notices the\n>>           configuration variable, and sets s.prefix conditionally;\n>\n> That would work fine. My reasoning was: the point of wt_status_prepare\n> is to initialize the wt_status object.\n\nYes, just like diffopts and revs.  They initialize the object to a plain\nvanilla defaults, and the caller uses other methods (either direct\nassignments to members or by calling helper functions such as\ndiff_opt_parse() and setup_revisions()) to fill in specialized values.\n\nAnd s.prefix is very much special case.  That's the reasoning behind my\nsuggestion.\n\n> ..., which is a little silly, since as a side effect we will do a find\n> on all untracked files).\n\nAh, that is probably the side effect of direct rewrite from shell script\nto C.  We should drop that and replace with what Alex did recently to\ngit-commit --no-edit codepath.\n\n> I am fine with either; your call. Documentation patch is below.\n\nThanks.  Will take it.\n"},{"id":"62390","messageId":"20071208084552.GA5206@coredump.intra.peff.net","threadId":"11179","inReplyTo":"7v63z9y5k2.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] add status.relativePaths config variable","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-12-08T08:45:52Z","receivedAt":"2007-12-08T08:45:52Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Dec 08, 2007 at 12:05:49AM -0800, Junio C Hamano wrote:\n\n> >> index 225fb4d..63d50f2 100644\n> >> --- a/wt-status.h\n> >> +++ b/wt-status.h\n> >> @@ -28,6 +28,7 @@ struct wt_status {\n> >>  \n> >>  int git_status_config(const char *var, const char *value);\n> >>  int wt_status_use_color;\n> >> +int wt_status_relative_paths;\n> >>  void wt_status_prepare(struct wt_status *s);\n> >>  void wt_status_print(struct wt_status *s);\n> >\n> > Shouldn't both of these ints be marked \"extern\"? I'm surprised it worked\n> > at all (or perhaps the part of my brain that stores C linkage issues is\n> > rotting?).\n> \n> Yes, rotting very much.\n\nNope, there's still a little grey matter left. It is not technically\nguaranteed by the standard to work, since the declaration in every\nsource file which includes wt-status.h is a \"tentative definition.\"\nFortunately, the linker is nice enough to figure out what's going on as\nlong as only one is actually initialized. This is listed in C99 Section\nJ.5.11 as a \"Common extension\".\n\nThe Summit C FAQ mentions it as well:\n\n  http://c-faq.com/decl/decldef.html\n\nSo \"extern\" is better, but apparently not required for any\nlinkers we care about. Note that omitting \"extern\" _is_ illegal in C++,\nbut fortunately we _really_ don't care about those linkers. :)\n\nBut at least I'm not totally crazy.\n\n-Peff\n"}]}