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

Re: Alternates corruption issue

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 31, 2012, 22:22 UTC
Message-ID
<20120131222258.GG13252@burratino>
In-Reply-To
<20120131220510.GA3253@sigill.intra.peff.net>
Jeff King wrote:
Show 5 quoted lines
> True. But I consider that to make the walk-backwards-from-pwd case
> simply a superset. That is, in (A) we are walking backwards and trying
> to apply the lookup rule from (B) individually to each directory we
> consider (though even that is not entirely true, as we don't look for
> parallel "$PWD.git" directories in the walk).

That parenthesis is important. Although in a nicer world maybe we would want some symmetry like this, (A) and (B) really have nothing to do with each other.

Forgetting the algorithms:
 (A) means "find what repository we are in the worktree for, or,
 barring that, what bare repository we are in".
 (B) means "find which repository the user pointed to.  To be extra
 nice, we allow a '.git' extension to be left out, so the URL used
 doesn't have to include the redundant information that this is a
 git repository, and we even allow pointing to the toplevel of a
 worktree instead of a repository, too."

Notice that the above description does not exactly match the actual behavior of git. For example, if someone has a directory layout like this:

  repo-manipulator/
     .git/
     src/
     testcases/
       repo1.git/
       repo2.git/

and git is run from repo1.git, according to the description above, the naive user _wanted_ git commands to apply to the toplevel repository. And in practice, I think that's often true, though changing the behavior of git to match that would not be worth the downsides.

> I'll admit I don't care that much, though. This is extremely unlikely to
> come up.

I admit part of the reason I care is that just putting "" first would probably taken care of the more important part of <http://bugs.debian.org/399041>.

Anyway, thanks for explaining. Hopefully I can get to this soon and factor out a common function for get_repo_path and enter_repo to call so playing with the ordering becomes a little less scary. ;-)

Jonathan
Previous: Jeff KingNext: Jeff King
Message 9 of 19 in “Alternates corruption issue”
  1. Richard PurdieJan 31, 2012
  2. Jeff KingJan 31, 2012
  3. Junio C HamanoJan 31, 2012
  4. Jeff KingJan 31, 2012
  5. Jonathan NiederJan 31, 2012
  6. Jeff KingJan 31, 2012
  7. Jonathan NiederJan 31, 2012
  8. Jeff KingJan 31, 2012
  9. Jonathan NiederJan 31, 2012
  10. Jeff KingJan 31, 2012
  11. Jonathan NiederJan 31, 2012
  12. Jeff KingFeb 2, 2012
  13. Junio C HamanoFeb 3, 2012
  14. Jeff KingFeb 3, 2012
  15. Junio C HamanoFeb 3, 2012
  16. Jeff KingFeb 3, 2012
  17. Junio C HamanoFeb 3, 2012
  18. Jeff KingFeb 3, 2012
  19. Richard PurdieFeb 3, 2012

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.