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

[bug] git-rev-parse sometimes appends subdirectories to result

From
Mmasukomi <masukomi@masukomi.org>
Date
Feb 3, 2020, 20:14 UTC
Message-ID
<CAG4-5WdTkFyCa_MqiRchR9GZgC_NEWdgobPfRfxYhTVqzVCCQw@mail.gmail.com>
Expected behavior

No matter what subdirectory of my repo I am in git rev-parse --show-toplevel will always return the same result

Actual behavior

Depending on what subdirectories you are in it will sometimes (not always) start appending those subdirectories to the path.

Reproduction
My git repo root is at
/Users/masukomi/workspace/private_comments

If i run git rev-parse --show-toplevel within that directory it returns the correct (identical) path. If i run it within /Users/masukomi/workspace/private_comments/src it returns the correct path (without the /src) If I run it within /Users/masukomi/workspace/private_comments/src/tests it suddenly starts returning

/Users/masukomi/workspace/private_comments/src/tests
Notes

Git 2.25.0 macOS 10.15.3 installed via homebrew. no submodules present.

- Kay Rhodes
https://masukomi.org
Next: masukomi
Message 1 of 2 in “[bug] git-rev-parse sometimes appends subdirectories to result”
  1. masukomiFeb 3, 2020
  2. masukomiFeb 3, 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.