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

Re: [PATCH] git-init: set core.workdir when GIT_WORK_DIR is specified

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 19, 2007, 14:24 UTC
Message-ID
<Pine.LNX.4.63.0703191523520.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7vk5xensjn.fsf@assigned-by-dhcp.cox.net>
Hi,
On Sun, 18 Mar 2007, Junio C Hamano wrote:
Show 46 quoted lines
> Matthias Lederhofer <matled@gmx.net> writes:
> 
> > Junio C Hamano <junkio@cox.net> wrote:
> >> Matthias Lederhofer <matled@gmx.net> writes:
> >> >  * is_bare_repository() in general
> >> 
> >> There is a bit of chicken and egg involved in is_bare, because
> >> we need to find out where GIT_DIR is in order to find where to
> >> read GIT_DIR/config from, and only after reading the file we
> >> would know if the user explicitly told us the repository is
> >> bare, and setup_gently does not want to cd-up if the repository
> >> is bare (i.e. there is no "top" to move to).
> >
> > How about changing setup_git_directory_gently to do the following:
> >
> > Find the git directory ($GIT_DIR, .git in parent directories and "."
> > at last).
> >
> > Read configuration for core.bare and core.worktree.  If core.bare is
> > not specified do the old guessing.
> >
> > if core.bare = true:
> >     Set GIT_DIR if it isn't set yet and stop (don't change the
> >     directory).
> >
> > if core.bare = false:
> >     GIT_DIR specified:
> >         use GIT_WORK_TREE, core.worktree or "." as working tree
> >     found repository as .git directory:
> >         use the parent directory of the .git directory as working tree
> >     found repository in ".":
> >         use "." as working tree
> >
> >     if cwd is below the working tree:
> >         change to working tree
> >         inside_work_tree = 1
> >         return prefix
> >     if cwd is outside of the working tree:
> >         inside_work_tree = 0
> >         return NULL
> 
> Luckily, this is an area that two of the most active git
> regulars have touched, and I can rely on their judgement to help
> me ;-)
> 
> What you describe sounds like a sane outline to me.
Yes, I like it, too (that is, I did not find an obvious flaw in it).

Ciao, Dscho

Previous: Matthias Lederhofer
Message 18 of 18 in “git-init: set core.workdir when GIT_WORK_DIR is specified”
  1. git-init: set core.workdir when GIT_WORK_DIR is specifiedMatthias Lederhofer, Mar 17, 2007
  2. Junio C HamanoMar 17, 2007
  3. Matthias LederhoferMar 17, 2007
  4. Matthias LederhoferMar 17, 2007
  5. 1/5 rev-parse: --is-bare-repository optionMatthias Lederhofer, Mar 17, 2007
  6. 2/5 test git-rev-parseMatthias Lederhofer, Mar 17, 2007
  7. test git-rev-parseMatthias Lederhofer, Mar 27, 2007
  8. 3/5 introduce GIT_WORK_TREE environment variableMatthias Lederhofer, Mar 17, 2007
  9. Matthias LederhoferMar 18, 2007
  10. Matthias LederhoferMar 18, 2007
  11. Matthias LederhoferMar 18, 2007
  12. Junio C HamanoMar 18, 2007
  13. 4/5 test GIT_WORK_TREEMatthias Lederhofer, Mar 17, 2007
  14. 5/5 git-init: set core.worktree when GIT_WORK_TREE is specifiedMatthias Lederhofer, Mar 17, 2007
  15. Junio C HamanoMar 18, 2007
  16. Matthias LederhoferMar 18, 2007
  17. Matthias LederhoferMar 18, 2007
  18. Johannes SchindelinMar 19, 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.