Thread (3 messages) 3 messages, 2 authors, 2016-06-15

Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file

flat view

From: Piotr Krukowiecki <hidden>
Date: 2016-06-15 22:50:42
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 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 <redacted>
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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help