Re: [PATCH] git-init: set up GIT_DIR/workdir if GIT_WORK_DIR is set

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

 



Nguyen Thai Ngoc Duy <pclouds@xxxxxxxxx> 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
-
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]