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

Re: bug with .git file and aliases

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 10, 2009, 23:05 UTC
Message-ID
<alpine.DEB.1.00.0908110101110.8306@pacific.mpi-cbg.de>
In-Reply-To
<7f9d599f0908101322i46384247m303e28955f88bbb@mail.gmail.com>
Hi,
On Mon, 10 Aug 2009, Geoffrey Irving wrote:
Show 19 quoted lines
> On Mon, Jul 20, 2009 at 11:21 AM, Jeff King<peff@peff.net> wrote:
> > On Mon, Jul 20, 2009 at 09:54:12AM -0400, Geoffrey Irving wrote:
> >
> >> git 1.6.3.3 has a bug related to .git file support and aliases.
> >> Specifically, if you make an alias for status and call it from a
> >> subdirectory, git status chdirs into the true .git dir but then
> >> chdir's back to the wrong place in order to run the lstats for status.
> >>  The result is that git status thinks all files have disappeared.
> >
> > Yeah, this is a known problem. The problem is that the 'git' wrapper
> > sets up the environment only partially when running aliases, and then
> > the resulting command ends up confused about where the worktree is. I
> > really don't remember the specifics, but you can probably find some
> > discussion in the list archives.  Fixing it, IIRC, required some
> > refactoring of the setup code (which I had hoped to get to at some
> > point, but I am way behind on my git todo list).
> 
> The attached patch fixes the bug for me.  I'll leave it to others to
> determine whether this is a good way to fix the problem.

Note that you made it particularly hard to comment on your patch by not granting us the wish stated in Documentation/SubmittingPatches, namely to inline your patch.

I'll just forego inlining it myself, as I am way past my bed-time and cannot be bothered.

However, I think that it is necessary to comment on your patch.

There is a few style issues, such as declaring offset outside of the block that is the only user, and there is the issue that you go out of your way to append a slash if you're resetting the work tree, but not when not resetting it.

But the bigger issue is that you now broke overriding the work tree via the command line.

The proper fix, of course, is to avoid calling the function with the wrong path to begin with.

Ciao, Dscho

Previous: Geoffrey IrvingNext: Geoffrey Irving
Message 8 of 13 in “bug with .git file and aliases”
  1. Geoffrey IrvingJul 20, 2009
  2. Santi BéjarJul 20, 2009
  3. Geoffrey IrvingJul 20, 2009
  4. Santi BéjarJul 20, 2009
  5. Geoffrey IrvingJul 20, 2009
  6. Jeff KingJul 20, 2009
  7. Geoffrey IrvingAug 10, 2009
  8. Johannes SchindelinAug 10, 2009
  9. Geoffrey IrvingAug 11, 2009
  10. Johannes SchindelinAug 11, 2009
  11. Michael J GruberAug 11, 2009
  12. Johannes SixtAug 11, 2009
  13. Michael J GruberAug 11, 2009

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.