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

Re: [DONOTAPPLY PATCH 2/3] setup: warn about implicit worktree with $GIT_DIR

From
Jeff King <peff@peff.net>
Date
Mar 26, 2013, 20:27 UTC
Message-ID
<20130326202722.GA22769@sigill.intra.peff.net>
In-Reply-To
<20130326202142.GL1414@google.com>
On Tue, Mar 26, 2013 at 01:21:42PM -0700, Jonathan Nieder wrote:
Show 13 quoted lines
> Jeff King wrote:
> 
> > --- a/setup.c
> > +++ b/setup.c
> > @@ -437,6 +437,23 @@ const char *read_gitfile(const char *path)
> >  	return path;
> >  }
> >  
> > +static const char warn_implicit_work_tree_msg[] =
> > +N_("You have set GIT_DIR (or used --git-dir) without specifying\n"
> > +   "a working tree. In Git 2.0, the behavior will change
> 
> Please no.  I don't want git 2.0 to be delayed forever.

Please replace "2.0" with some future version, then. I just made up the number. But...

Show 5 quoted lines
> If we want this warning, would something like the following do?
> 
> 	warning: You have set GIT_DIR without setting GIT_WORK_TREE
> 	hint: In this case, GIT_WORK_TREE defaults to '.'
> 	hint: To suppress this message, set GIT_WORK_TREE='.'

That can help by teaching people how GIT_DIR behaves in general. But the warning and hint will be small consolation to somebody who runs "GIT_DIR=foo.git git clean -f" and sees it for the first time.

If you want to argue that people would see the warning in earlier runs of git, I can kind of buy that. Although the incident that triggered this discussion probably wouldn't have (I would usually start a git-clean session with "git clean" without "-f" or "git status", either of which would have done equally well as this warning to notify the user what was going on).

Like I said earlier, though, I'm not really sure this is the direction we want to go. This series is more about seeing what the fallouts are. I probably shouldn't have included this middle patch at all, because the interesting thing is what happens when we do turn it off.

-Peff
Previous: Jonathan NiederNext: Jonathan Nieder
Message 32 of 35 in “git ate my home directory :-(”
  1. Richard WeinbergerMar 25, 2013
  2. Jonathan NiederMar 25, 2013
  3. Junio C HamanoMar 25, 2013
  4. Jonathan NiederMar 25, 2013
  5. Junio C HamanoMar 25, 2013
  6. Junio C HamanoMar 25, 2013
  7. Richard WeinbergerMar 25, 2013
  8. Jonathan NiederMar 25, 2013
  9. Junio C HamanoMar 25, 2013
  10. Richard WeinbergerMar 25, 2013
  11. Jonathan NiederMar 25, 2013
  12. Brandon CaseyMar 25, 2013
  13. Philip OakleyMar 26, 2013
  14. Duy NguyenMar 26, 2013
  15. Jeff KingMar 26, 2013
  16. Junio C HamanoMar 26, 2013
  17. Duy NguyenMar 27, 2013
  18. Philip OakleyMar 26, 2013
  19. Richard WeinbergerMar 26, 2013
  20. Jeff KingMar 26, 2013
  21. Richard WeinbergerMar 26, 2013
  22. demerphqMar 26, 2013
  23. Jeff KingMar 26, 2013
  24. demerphqMar 26, 2013
  25. Jeff KingMar 26, 2013
  26. Junio C HamanoMar 26, 2013
  27. Jeff KingMar 26, 2013
  28. 1/3 environment: set GIT_WORK_TREE when we figure out work treeJeff King, Mar 26, 2013
  29. Jonathan NiederMar 26, 2013
  30. 2/3 setup: warn about implicit worktree with $GIT_DIRJeff King, Mar 26, 2013
  31. Jonathan NiederMar 26, 2013
  32. Jeff KingMar 26, 2013
  33. Jonathan NiederMar 26, 2013
  34. Matthieu MoyMar 27, 2013
  35. 3/3 setup: treat GIT_DIR without GIT_WORK_TREE as a bare repoJeff King, Mar 26, 2013

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.