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

Re: [PATCH v4 2/2] rev-parse: add option for absolute or relative path formatting

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Dec 7, 2020, 02:38 UTC
Message-ID
<X82Vl7YmZ1/Sr4xS@camp.crustytoothpaste.net>
In-Reply-To
<CAPig+cS-2Vw84rejMFAiDeF8dd5gtBOmQZUMpOy2ufA8nU7W7g@mail.gmail.com>
On 2020-12-07 at 00:30:13, Eric Sunshine wrote:
Show 10 quoted lines
> I read the commit message and looked at the implementation so I know
> that this option can be specified multiple times, but this
> documentation only vaguely hints at it by saying "options following
> it". We could do a better job of imparting that knowledge to the
> reader by saying so explicitly, perhaps like this:
> 
>     Controls the behavior of some path-printing options. If
>     'absolute', [...]. If 'relative', [...]. May be specified multiple
>     times, each time affecting the path-printing options which
>     follow it. The default path format is option-specific.
I'll improve the documentation in v5.
Show 5 quoted lines
> Since this option can be specified multiple times, should it also
> recognize `default` to request the default behavior in addition to
> `absolute` and `relative`? (Genuine question. Maybe real-world
> use-cases wouldn't need it, but it would be easy to support and make
> it functionally complete.)

I don't think adding the default is helpful. I can think of situations where people want absolute path names or relative path names, but in what case would someone want, "meh, whatever Git decides to give me"?

The problem we're solving here is that Git isn't consistent and can't be used to provide valuable information that the user wants. If a user doesn't care what format the path is in, then they can always specify absolute and it will almost certainly be correct and work for them.

> Leaking `realbuf` and `prefixbuf` here.
Will fix.
-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: Eric Sunshine
Message 9 of 9 in “rev-parse options for absolute or relative paths”
  1. 0/2 rev-parse options for absolute or relative pathsbrian m. carlson, Dec 6, 2020
  2. 1/2 abspath: add a function to resolve paths with missing componentsbrian m. carlson, Dec 6, 2020
  3. Eric SunshineDec 7, 2020
  4. brian m. carlsonDec 7, 2020
  5. René ScharfeDec 7, 2020
  6. brian m. carlsonDec 8, 2020
  7. 2/2 rev-parse: add option for absolute or relative path formattingbrian m. carlson, Dec 6, 2020
  8. Eric SunshineDec 7, 2020
  9. brian m. carlsonDec 7, 2020

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.