git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file
Date: Thu, 03 Mar 2011 22:13:13 +0100	[thread overview]
Message-ID: <4D700469.7090807@gmail.com> (raw)
In-Reply-To: <1299156201-12149-1-git-send-email-pclouds@gmail.com>

W dniu 03.03.2011 13:43, Nguyễn Thái Ngọc Duy pisze:
> Instead of creating the repository at $GIT_DIR, --real-git-dir will
> tell git to put the repository there, then make $GIT_DIR a .git file
> that points to --real-git-dir.
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  This makes '.git symbolic link' (what's its official name?) more
>  convenient to use. Previously whenever I need to create a .git link,
>  I need to open docs to see its format. Now all I need to do is

Took me a while to find documentation for .git file format. Probably my
fault, missed the gitrepository-layout link.

Anyway, tried following:
   $ echo path > .git
   $ git info
   fatal: Invalid gitfile format: .git

Maybe one solution is to improve the message - patch attached:
   $ git info
   fatal: Invalid gitfile format: .git
   Use gitdir: <PATH>

 
>   git init --real-git-dir=/where/real/git/is
>   git clone --real-git-dir=/where/real/git/is something
> 
>  I intend to make 'git init --real-git-dir' move current repo to
>  somewhere else if called on existing repo.
> 
>  Long term I'd like to see a init/clone hook, where I can tell git
>  "when I ask you to create a repo/worktree at foo, put the real repo
>  at ~/git/foo"

Is this needed? As I understand
    git init --real-git-dir=/where/real/git/is

should do the same as
    git --git-dir=/where/real/git/is && \
    echo "gitdir: /where/real/git/is" > ${GIT_DIR:-.git} 

The other actions seems to be similarly simple.


>  I could use a better option name too, any suggestions?

I don't understand why is this needed. It's a bit complicated at first as well.
Adds extra layer to already existing .gitdir/.gitfile/GIT_DIR/--git-dir


---8<---
From e83caf00dc007b9a2e515bb718f0d9ddb080891e Mon Sep 17 00:00:00 2001
From: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Date: Thu, 3 Mar 2011 21:51:34 +0100
Subject: [PATCH] Improve error message when gitfile has wrong format

Add information what format of .git file is expected.

Signed-off-by: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
---
 setup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/setup.c b/setup.c
index 021d013..d2d9d0b 100644
--- a/setup.c
+++ b/setup.c
@@ -291,7 +291,7 @@ const char *read_gitfile_gently(const char *path)
 		die("Error reading %s", path);
 	buf[len] = '\0';
 	if (prefixcmp(buf, "gitdir: "))
-		die("Invalid gitfile format: %s", path);
+		die("Invalid gitfile format: %s\nUse gitdir: <PATH>", path);
 	while (buf[len - 1] == '\n' || buf[len - 1] == '\r')
 		len--;
 	if (len < 9)
-- 
1.7.1


-- 
Piotr Krukowiecki

  reply	other threads:[~2011-03-03 21:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03 12:43 [PATCH/RFC] init, clone: support --real-git-dir for .git file Nguyễn Thái Ngọc Duy
2011-03-03 21:13 ` Piotr Krukowiecki [this message]
2011-03-03 23:31   ` Junio C Hamano
2011-03-04  7:41     ` Piotr Krukowiecki
2011-03-04 12:26       ` Nguyen Thai Ngoc Duy
2011-03-04 18:09         ` Piotr Krukowiecki
2011-03-04 18:41         ` Junio C Hamano
2011-03-04  4:19   ` Nguyen Thai Ngoc Duy
2011-03-04  0:08 ` Junio C Hamano
2011-03-04  4:13   ` Miles Bader
2011-03-04  4:33     ` Nguyen Thai Ngoc Duy
2011-03-04  4:23   ` Nguyen Thai Ngoc Duy
2011-03-04  6:00     ` Junio C Hamano
2011-03-04  6:39       ` Nguyen Thai Ngoc Duy
2011-03-04  6:57       ` Miles Bader

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=4D700469.7090807@gmail.com \
    --to=piotr.krukowiecki@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).