All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Lederhofer <matled@gmx.net>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-init: set up GIT_DIR/workdir if GIT_WORK_DIR is set
Date: Mon, 12 Mar 2007 15:08:08 +0100	[thread overview]
Message-ID: <20070312140808.GA17450@moooo.ath.cx> (raw)
In-Reply-To: <fcaeb9bf0703120636r7038a7fat24e571e7c087d13d@mail.gmail.com>

Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
> Let users create $GIT_DIR/workdir themselves. Your way may be less
> confusing to you but might be more confusing to me because I _might_
> expect a relative workdir setting (for example I move the repository
> and the working directory together to another place).

Well, without this patch you havo to do one of these:

    /tmp$ mkdir repository working_directory
    /tmp$ git --git-dir=repository init
    /tmp$ git --git-dir=repository config core.bare false
    /tmp$ echo ../working_directory > repository/workdir

or

    /tmp$ mkdir repository working_directory
    /tmp/repository$ cd repository
    /tmp$ git init
    /tmp/repository$ mv .git/* .
    /tmp/repository$ rmdir .git
    /tmp$ echo ../working_directory > repository/workdir

Where the second example is probably better because git init creates a
bare repository in the first case which might have more settings
different from a 'normal' repository (it actually sets also
core.logallrefupdates = true which probably should be added to the
first example).

With this patch you'd have to do

    /tmp$ mkdir repository working_directory
    /tmp$ git --git-dir=repository --work-dir=working_directory init
    /tmp$ echo ../working_directory > repository/workdir

in case you really want a relative path.

Because the first two ways are so long I think git init should have
some way to handle this case.

I don't want to put $GIT_WORK_DIR 'as is' to $GIT_DIR/workdir because
$GIT_WORK_DIR is normally interpreted as relative path to the current
working directory and not relative to $GIT_DIR.

Perhaps we could add another flag to git init which will be used 'as is'
for $GIT_DIR/workdir:
    git --git-dir=repository init --work-dir=../working_directory

Other things I can think of:

    Add a --not-bare flag to git init:
    $ git --git-dir=repository init --not-bare
    $ echo ../working_directory > repository/workdir

    Tell the user what to do in case the path should be relative:
    $ git --git-dir=repository --work-dir=working_directory init
    You specified a relative working directory and git has
    automatically expanded this to /tmp/working_directory.  If you
    prefer a relative path you can do:
        echo relative_path > repository/workdir

  reply	other threads:[~2007-03-12 14:08 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-11  4:32 [RFC] introduce GIT_WORK_DIR environment variable Matthias Lederhofer
2007-03-11  5:34 ` Junio C Hamano
2007-03-11  8:26   ` Andy Parkins
2007-03-11 16:22   ` Matthias Lederhofer
2007-03-11 20:10     ` Junio C Hamano
2007-03-11 21:43       ` Johannes Schindelin
2007-03-11 20:37   ` Linus Torvalds
2007-03-11 21:04     ` Junio C Hamano
2007-03-11 21:13       ` Linus Torvalds
2007-03-12  8:08       ` A.J. Rossini
2007-04-01  7:42       ` Andy Parkins
2007-03-11 12:42 ` Nguyen Thai Ngoc Duy
2007-03-11 13:33   ` Matthias Lederhofer
2007-03-11 13:46     ` Nguyen Thai Ngoc Duy
2007-03-11 14:05       ` Matthias Lederhofer
2007-03-11 14:18         ` Nguyen Thai Ngoc Duy
2007-03-11 15:56   ` [PATCH(amend)] " Matthias Lederhofer
2007-03-11 16:25     ` Nguyen Thai Ngoc Duy
2007-03-11 21:29     ` [PATCH] use $GIT_DIR/workdir as working directory with $GIT_DIR Matthias Lederhofer
2007-03-13 23:10       ` [PATCH] core.workdir config variable Matthias Lederhofer
2007-03-13 23:57         ` [PATCH(amend)] " Matthias Lederhofer
2007-03-14  6:01           ` Shawn O. Pearce
2007-03-14  7:48             ` Junio C Hamano
2007-03-14 14:20               ` Shawn O. Pearce
2007-03-11 13:27 ` [RFC] introduce GIT_WORK_DIR environment variable Nguyen Thai Ngoc Duy
2007-03-11 15:05   ` [PATCH] rev-parse: --is-bare-repository option Matthias Lederhofer
2007-03-12 11:53 ` [PATCH] git-init: set up GIT_DIR/workdir if GIT_WORK_DIR is set Matthias Lederhofer
2007-03-12 12:12   ` Joshua N Pritikin
2007-03-12 12:52     ` Matthias Lederhofer
2007-03-12 13:12     ` Matthias Lederhofer
2007-03-12 13:36       ` Nguyen Thai Ngoc Duy
2007-03-12 14:08         ` Matthias Lederhofer [this message]
2007-03-12 17:31           ` Junio C Hamano
2007-03-12 18:08             ` Matthias Lederhofer
2007-03-12 19:18               ` [PATCH] always interpret GIT_WORK_DIR relative to $GIT_DIR Matthias Lederhofer
2007-03-12 19:53                 ` [PATCH] GIT_WORK_DIR: documentation for relative path Matthias Lederhofer
2007-03-12 20:05               ` [PATCH] git-init: set up GIT_DIR/workdir if GIT_WORK_DIR is set Junio C Hamano
2007-03-12 20:40                 ` Matthias Lederhofer
2007-03-12 19:23   ` [PATCH(amend)] " Matthias Lederhofer

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=20070312140808.GA17450@moooo.ath.cx \
    --to=matled@gmx.net \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /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.