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

Re: [PATCH 8/8] gitk: show modified files with separate work tree

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 11, 2011, 19:15 UTC
Message-ID
<7vipukwqf2.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110410020318.GB25368@brick.ozlabs.ibm.com>
Paul Mackerras <paulus@samba.org> writes:
>> Why do git commands that need a work tree not work under .git?
> ...
> Don't know, ask Junio. :)

Whatever the current behaviour is, I am reasonably sure that it is coming more from "meh -- who cares such a case?" than "it should work like this when you are in .git because of such and such reasons".

For example, what does it mean to be able to do this?
	$ edit Makefile
        $ git add Makefile
        $ edit Makefile
	$ cd .git
        $ git grep frotz Makefile
Perhaps the last step needs to be
	$ git grep frotz ../Makefile
instead, but a more important point is, how would that be useful?

If you have both GIT_DIR and GIT_WORK_TREE set up to point at the correct places, I think it is sensible to make the above (the "../Makefile" version, not the one without dot-dot) work as expected.

I suspect (but would not bother to dig the history myself to find out) that "we require a working tree" semantics that in fact often means "we require you to be in the working tree" was a misdesign that did not matter that came from the days back when GIT_WORK_TREE was not either present or not widely used. Now more people seem to be using GIT_WORK_TREE for some reason, I don't have anything against a patch series that defines and implements a more desirable behaviour clearly.

Thanks.
Previous: Paul MackerrasNext: Martin von Zweigbergk
Message 13 of 15 in “make gitk work better in non-top-level directory”
  1. 0/8 make gitk work better in non-top-level directoryMartin von Zweigbergk, Apr 5, 2011
  2. 1/8 gitk: fix file highlight when run in subdirectoryMartin von Zweigbergk, Apr 5, 2011
  3. Paul MackerrasApr 10, 2011
  4. Martin von ZweigbergkApr 10, 2011
  5. 2/8 gitk: fix "show origin of this line" with separate work treeMartin von Zweigbergk, Apr 5, 2011
  6. 3/8 gitk: fix "blame parent commit" with separate work treeMartin von Zweigbergk, Apr 5, 2011
  7. 4/8 gitk: fix "External diff" with separate work treeMartin von Zweigbergk, Apr 5, 2011
  8. 5/8 gitk: put temporary directory inside .gitMartin von Zweigbergk, Apr 5, 2011
  9. 6/8 gitk: run 'git rev-parse --git-dir' only onceMartin von Zweigbergk, Apr 5, 2011
  10. 7/8 gitk: simplify calculation of gitdirMartin von Zweigbergk, Apr 5, 2011
  11. 8/8 gitk: show modified files with separate work treeMartin von Zweigbergk, Apr 5, 2011
  12. Paul MackerrasApr 10, 2011
  13. Junio C HamanoApr 11, 2011
  14. 8/8 gitk: show modified files with separate work treeMartin von Zweigbergk, May 24, 2011
  15. Peter BaumannApr 5, 2011

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.