* [PATCH] [RED] git-init: Cannot setup bare repository
@ 2007-08-26 20:45 Petr Baudis
2007-08-27 8:51 ` Johannes Schindelin
0 siblings, 1 reply; 4+ messages in thread
From: Petr Baudis @ 2007-08-26 20:45 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] [RED] git-init: Cannot setup bare repository
2007-08-26 20:45 [PATCH] [RED] git-init: Cannot setup bare repository Petr Baudis
@ 2007-08-27 8:51 ` Johannes Schindelin
2007-08-27 9:55 ` Petr Baudis
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2007-08-27 8:51 UTC (permalink / raw)
To: Petr Baudis; +Cc: Junio C Hamano, git
Hi,
On Sun, 26 Aug 2007, Petr Baudis wrote:
> 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).
You were too busy playing Go, probably, so you missed my patch which tried
to fix this issue. Alas, it broke more than it fixed, so it was just
worked around for git-clone --bare.
I'll have a more thorough go at it today.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [RED] git-init: Cannot setup bare repository
2007-08-27 8:51 ` Johannes Schindelin
@ 2007-08-27 9:55 ` Petr Baudis
2007-08-27 10:01 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Petr Baudis @ 2007-08-27 9:55 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, git
Hi,
On Mon, Aug 27, 2007 at 10:51:04AM CEST, Johannes Schindelin wrote:
> On Sun, 26 Aug 2007, Petr Baudis wrote:
>
> > 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).
>
> You were too busy playing Go, probably, so you missed my patch which tried
> to fix this issue. Alas, it broke more than it fixed, so it was just
> worked around for git-clone --bare.
AFAICS that patch is already applied as well; I tried to ask on IRC
for more fixes but seemed there is none and Junio almost threatened to
even release 1.5.3 with this bug. ;-) Well, I just needed something that
would fix this on repo.or.cz which totally broke after upgrade to new
Git version.
--
Petr "Pasky" Baudis
Early to rise and early to bed makes a male healthy and wealthy and dead.
-- James Thurber
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [RED] git-init: Cannot setup bare repository
2007-08-27 9:55 ` Petr Baudis
@ 2007-08-27 10:01 ` Junio C Hamano
0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-08-27 10:01 UTC (permalink / raw)
To: Petr Baudis; +Cc: Johannes Schindelin, git
Petr Baudis <pasky@suse.cz> writes:
> On Mon, Aug 27, 2007 at 10:51:04AM CEST, Johannes Schindelin wrote:
>> On Sun, 26 Aug 2007, Petr Baudis wrote:
>> ...
>> You were too busy playing Go, probably, so you missed my patch which tried
>> to fix this issue. Alas, it broke more than it fixed, so it was just
>> worked around for git-clone --bare.
>
> AFAICS that patch is already applied as well; I tried to ask on IRC
> for more fixes but seemed there is none and Junio almost threatened to
> even release 1.5.3 with this bug. ;-) Well, I just needed something that
> would fix this on repo.or.cz which totally broke after upgrade to new
> Git version.
Heh, "threaten" is a good word. Could you two help me with this
issue? I suspect you (and probably Shawn) have the most "old
fashioned" scripts that rather rely on pre-work-tree behaviour
and have better chance than others to catch unintended side
effects like the current "git --bare init" issues.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-08-27 10:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-26 20:45 [PATCH] [RED] git-init: Cannot setup bare repository Petr Baudis
2007-08-27 8:51 ` Johannes Schindelin
2007-08-27 9:55 ` Petr Baudis
2007-08-27 10:01 ` Junio C Hamano
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).