All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Lederhofer <matled@gmx.net>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-init: set core.workdir when GIT_WORK_DIR is specified
Date: Sun, 18 Mar 2007 22:18:36 +0100	[thread overview]
Message-ID: <20070318211836.GA12456@moooo.ath.cx> (raw)
In-Reply-To: <7vr6rnlyzt.fsf@assigned-by-dhcp.cox.net>

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

  parent reply	other threads:[~2007-03-18 21:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-17  1:58 [PATCH] git-init: set core.workdir when GIT_WORK_DIR is specified Matthias Lederhofer
2007-03-17  7:29 ` Junio C Hamano
2007-03-17 11:01   ` Matthias Lederhofer
2007-03-17 14:34   ` Matthias Lederhofer
2007-03-17 14:42     ` [PATCH 1/5] rev-parse: --is-bare-repository option Matthias Lederhofer
2007-03-17 14:43     ` [PATCH 2/5] test git-rev-parse Matthias Lederhofer
2007-03-27 22:07       ` [PATCH(amend)] " Matthias Lederhofer
2007-03-17 14:44     ` [PATCH 3/5] introduce GIT_WORK_TREE environment variable Matthias Lederhofer
2007-03-18 19:43       ` Matthias Lederhofer
2007-03-18 20:12       ` Matthias Lederhofer
2007-03-18 20:23         ` Matthias Lederhofer
2007-03-18 20:28           ` Junio C Hamano
2007-03-17 14:44     ` [PATCH 4/5] test GIT_WORK_TREE Matthias Lederhofer
2007-03-17 14:45     ` [PATCH 5/5] git-init: set core.worktree when GIT_WORK_TREE is specified Matthias Lederhofer
2007-03-18  8:47     ` [PATCH] git-init: set core.workdir when GIT_WORK_DIR " Junio C Hamano
2007-03-18 11:18       ` Matthias Lederhofer
2007-03-18 21:18       ` Matthias Lederhofer [this message]
     [not found]         ` <7vk5xensjn.fsf@assigned-by-dhcp.cox.net>
2007-03-19 14:24           ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070318211836.GA12456@moooo.ath.cx \
    --to=matled@gmx.net \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.