From: Petr Baudis <pasky@suse.cz>
To: Junio C Hamano <junkio@cox.net>
Cc: <git@vger.kernel.org>
Subject: [PATCH] [RED] git-init: Cannot setup bare repository
Date: Sun, 26 Aug 2007 22:45:31 +0200 [thread overview]
Message-ID: <20070826204531.11592.36481.stgit@rover> (raw)
git-init is totally broken wrt. setting up bare repository - it thinks no
repository is bare (maybe I could coerce it to think some repositories
indeed are bare, but I have my doubts). This patch is more like a cry for
help, not something to be applied, though it works as a crude workaround if
you're hit by the same problem as me. Unfortunately it's hard to make sense
of the tangled git_working_tree_cfg, work_tree, is_bare_tree_cfg etc.
network of variables, so I don't have any clear idea about a proper fix nor
the time to figure it out. :-(
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
builtin-init-db.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/builtin-init-db.c b/builtin-init-db.c
index 0d9b1e0..3718355 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -299,11 +299,15 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
usage(init_db_usage);
}
- git_work_tree_cfg = xcalloc(PATH_MAX, 1);
- if (!getcwd(git_work_tree_cfg, PATH_MAX))
- die ("Cannot access current working directory.");
- if (access(get_git_work_tree(), X_OK))
- die ("Cannot access work tree '%s'", get_git_work_tree());
+ if (!strcmp(get_git_dir(), ".git")) {
+ git_work_tree_cfg = xcalloc(PATH_MAX, 1);
+ if (!getcwd(git_work_tree_cfg, PATH_MAX))
+ die ("Cannot access current working directory.");
+ if (access(get_git_work_tree(), X_OK))
+ die ("Cannot access work tree '%s'", get_git_work_tree());
+ } else {
+ git_work_tree_cfg = NULL;
+ }
/*
* Set up the default .git directory contents
next reply other threads:[~2007-08-26 20:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-26 20:45 Petr Baudis [this message]
2007-08-27 8:51 ` [PATCH] [RED] git-init: Cannot setup bare repository Johannes Schindelin
2007-08-27 9:55 ` Petr Baudis
2007-08-27 10:01 ` Junio C Hamano
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=20070826204531.11592.36481.stgit@rover \
--to=pasky@suse.cz \
--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 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).