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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sun, 18 Mar 2007, Junio C Hamano wrote:

> Matthias Lederhofer <matled@xxxxxxx> writes:
> 
> > Junio C Hamano <junkio@xxxxxxx> wrote:
> >> Matthias Lederhofer <matled@xxxxxxx> 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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]