git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] add status.relativePaths config variable

From
Jeff King <peff@peff.net>
Date
Dec 8, 2007, 07:55 UTC
Message-ID
<20071208075538.GA4812@coredump.intra.peff.net>
In-Reply-To
<7vejdxy70p.fsf@gitster.siamese.dyndns.org>
On Fri, Dec 07, 2007 at 11:34:14PM -0800, Junio C Hamano wrote:
Show 5 quoted lines
> I like the general idea (and suspect we might want to make it default to
> false to retain the original behaviour, but I'd refrain from suggesting
> it, to keep the user experience stable during the upcoming -rc period).
> 
> We'd need an update to git-status documentation to mention the variable.
Patch is below; please squash it into the original.

It seems kind of silly to manually write the "Configuration" section for git-status, though. It would be nice if our config.txt could be annotated to mention which commands use which config variables, and git-*.txt could automagically include the right sections.

Show 11 quoted lines
> > -	wt_status_prepare(&s);
> > -	s.prefix = prefix;
> > +	wt_status_prepare(&s, prefix);
> 
> I have been wondering ever since receiving this patch if this is a good
> interface change.  Was there a problem if instead:
> 
> 	- The implementation of wt_status_prepare(&s) stays as before;
> 
> 	- run_status(), after calling wt_status_prepare(&s), notices the
>           configuration variable, and sets s.prefix conditionally;

That would work fine. My reasoning was: the point of wt_status_prepare is to initialize the wt_status object. I thought the "whether to use relative paths based on config" logic should be something that _every_ preparer uses. OTOH, when I wrote it, I never expected that anyone _but_ run_status would call it (I must confess to not really investigating why git-revert needed it; looks like it is to find a dirty index or working tree, which is a little silly, since as a side effect we will do a find on all untracked files).

I am fine with either; your call. Documentation patch is below.
---
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index b0cb6bc..645dc85 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -42,7 +42,8 @@ template comments, and all the output lines are prefixed with '#'.
 
 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
@@ -53,6 +54,10 @@ mean the same thing and the latter is kept for backward
 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]
Previous: Jeff KingNext: Junio C Hamano
Message 11 of 12 in “quote_path: convert empty path to "./"”
  1. quote_path: convert empty path to "./"Jeff King, Dec 7, 2007
  2. Johannes SchindelinDec 7, 2007
  3. Thomas HarningDec 7, 2007
  4. Jeff KingDec 7, 2007
  5. add status.relativePaths config variableJeff King, Dec 7, 2007
  6. Junio C HamanoDec 8, 2007
  7. Junio C HamanoDec 8, 2007
  8. Jeff KingDec 8, 2007
  9. Junio C HamanoDec 8, 2007
  10. Jeff KingDec 8, 2007
  11. Jeff KingDec 8, 2007
  12. Junio C HamanoDec 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.