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

Re: git's is_inside_git_dir too strict?

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 6, 2007, 21:46 UTC
Message-ID
<Pine.LNX.4.63.0703062232570.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<fcaeb9bf0703060741l7cbfd0f3ue443730176606db6@mail.gmail.com>
Hi,
On Tue, 6 Mar 2007, Nguyen Thai Ngoc Duy wrote:
> I have a working directory separated from its git repository. When I
> work on this directory, I specify --git-dir argument (actually all
> happens in script so I don't have to type that much). It used to work
> but no longer since git 1.5.0.
Yes, we tried to make sure a few common errors were harder to make.
> Complaints include "cannot be used without a working tree" and "This 
> operation must be run in a work tree". Can I have the former behaviour 
> back in some ways?

Well, there is a real problem with "This operation must be run in a work tree". What operation is that? We tried to make it hard to overwrite things in $GIT_DIR by running Git operations meant for the working tree, and it seems like you are running one of them.

However, I think that is_bare_repository() really should check if $GIT_DIR is a prefix of $(pwd). Because if it is not, we are likely to run in a detached work tree.

If you agree, then is_inside_git_dir() might actually be a better way to ask if the repo is bare than is_bare_repository().

Comments?

Ciao, Dscho

Previous: Nguyen Thai Ngoc DuyNext: Nguyen Thai Ngoc Duy
Message 2 of 8 in “git's is_inside_git_dir too strict?”
  1. Nguyen Thai Ngoc DuyMar 6, 2007
  2. Johannes SchindelinMar 6, 2007
  3. Nguyen Thai Ngoc DuyMar 7, 2007
  4. Shawn O. PearceMar 7, 2007
  5. Nguyen Thai Ngoc DuyMar 7, 2007
  6. Matthias LederhoferMar 9, 2007
  7. Junio C HamanoMar 10, 2007
  8. Nguyen Thai Ngoc DuyMar 10, 2007

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.