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

Re: [PATCH v2 1/4] rev-parse: fix some options when executed from subpath of main tree

From
Junio C Hamano <gitster@pobox.com>
Date
May 6, 2016, 17:08 UTC
Message-ID
<xmqq8tzn5d26.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160506161312.Horde.7i8_sE5ISIqccneOIfinvCX@webmail.informatik.kit.edu>
SZEDER Gábor <szeder@ira.uka.de> writes:
>> I agree with this, but at one point Junio suggested that it should
>> return the relative path[1],
>
> I wasn't aware of Junio's suggestion.

Mike justified his position to change everything to absolute, citing that it is what "rev-parse --show-toplevel" does when run from a subdirectory. I just gave a counter-example that rev-parse does not always talk in absolute with "rev-parse -C t --show-cdup".

It hinted that his justification may not be strong enough to choose absolute over relative, but wasn't meant to be a suggestion to choose relative at all. At most, I was saying "either is equally plausible".

> It shouldn't really matter in practice, because both the absolute and
> relative paths will ultimately lead to the same place.  However, I
> still think that for consistency's sake absolute paths would be better
> when executed in a subdir of the working tree.
Sure.

One thing I'd be worried about is that people may be using it to compute paths and store them in $GIT_DIR/somewhere, and expecting that they can later do a wholesale "mv" of directory hierarchy and relative paths still work. I wouldn't be one of those who does the "mv" so I personally do not care, but I suspect some do.

Previous: SZEDER GáborNext: Eric Sunshine
Message 11 of 12 in “rev-parse: adjust results when they should be relative”
  1. 0/4 rev-parse: adjust results when they should be relativeMichael Rappazzo, Apr 22, 2016
  2. 1/4 rev-parse: fix some options when executed from subpath of main treeMichael Rappazzo, Apr 22, 2016
  3. SZEDER GáborApr 29, 2016
  4. 2/4 t1500-rev-parse: add tests executed from sub path of the main worktreeMichael Rappazzo, Apr 22, 2016
  5. SZEDER GáborApr 29, 2016
  6. 3/4 t2027-worktree-list: add and adjust tests related to git-rev-parseMichael Rappazzo, Apr 22, 2016
  7. SZEDER GáborApr 29, 2016
  8. 4/4 t1700-split-index: add test for rev-parse --shared-index-pathMichael Rappazzo, Apr 22, 2016
  9. Mike RappazzoMay 6, 2016
  10. SZEDER GáborMay 6, 2016
  11. Junio C HamanoMay 6, 2016
  12. Eric SunshineMay 10, 2016

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.