* [PATCH] Use the template mechanism to set up refs/ hierarchy as well.
@ 2005-08-03 6:28 Junio C Hamano
2005-08-04 18:41 ` Johannes Schindelin
0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2005-08-03 6:28 UTC (permalink / raw)
To: git
This may be controversial from the robustness standpoint, so I
am placing it in the proposed update queue first. Discussions
on the list very welcomed.
Once the alternate object pool mechanism is taught to use
$GIT_DIR/info/alt file (instead of/in addition to the
environment variable), this would help people setting up
repositories for underling developers. They can prepare a
standard template info/alt that points at the project-wide base
object pool that is shared, and have people point
GIT_TEMPLATE_DIRECTORY at the project standard template
directory.
------------
This removes the hardcoded set of refs/ directory structure that
is created by git-init-db and move it to the template
mechanism.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
init-db.c | 22 ----------------------
t/t5400-send-pack.sh | 16 +++++++++++++++-
templates/Makefile | 4 ++++
3 files changed, 19 insertions(+), 23 deletions(-)
de8b5bf5605274d29b835947932b9b6c109f5d9f
diff --git a/init-db.c b/init-db.c
--- a/init-db.c
+++ b/init-db.c
@@ -167,28 +167,6 @@ static void create_default_files(const c
if (len && path[len-1] != '/')
path[len++] = '/';
-
- /*
- * Create .git/refs/{heads,tags}
- */
- strcpy(path + len, "refs");
- safe_create_dir(path);
- strcpy(path + len, "refs/heads");
- safe_create_dir(path);
- strcpy(path + len, "refs/tags");
- safe_create_dir(path);
-
- /*
- * Create the default symlink from ".git/HEAD" to the "master"
- * branch
- */
- strcpy(path + len, "HEAD");
- if (symlink("refs/heads/master", path) < 0) {
- if (errno != EEXIST) {
- perror(path);
- exit(1);
- }
- }
copy_templates(path);
}
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -8,6 +8,18 @@ test_description='See why rewinding head
'
. ./test-lib.sh
+# This part is needed to test before installing templates.
+mkdir -p templates/refs/heads
+ln -s refs/heads/master templates/HEAD
+mkdir -p templates/hooks
+echo '#!/bin/sh
+echo we are here >$GIT_DIR/we-are-here' >templates/hooks/post-update
+chmod +x templates/hooks/post-update
+
+GIT_TEMPLATE_DIRECTORY=`pwd`/templates/
+export GIT_TEMPLATE_DIRECTORY
+git-init-db
+
cnt='1'
test_expect_success setup '
tree=$(git-write-tree) &&
@@ -50,5 +62,7 @@ test_expect_success \
fi &&
# this should update
git-send-pack --force ./victim/.git/ master &&
- cmp victim/.git/refs/heads/master .git/refs/heads/master
+ cmp victim/.git/refs/heads/master .git/refs/heads/master &&
+ # and post-update should have run
+ test -f victim/.git/we-are-here
'
diff --git a/templates/Makefile b/templates/Makefile
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -17,3 +17,7 @@ install:
$(dest)$(templatedir)/hooks/$(patsubst hooks--%,%,$s);)
$(INSTALL) -d -m755 $(dest)$(templatedir)/info
$(INSTALL) -d -m755 $(dest)$(templatedir)/branches
+ $(INSTALL) -d -m755 $(dest)$(templatedir)/refs/heads
+ $(INSTALL) -d -m755 $(dest)$(templatedir)/refs/tags
+ rm -f $(dest)$(templatedir)/HEAD && \
+ ln -s refs/heads/master $(dest)$(templatedir)/HEAD
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.
2005-08-03 6:28 [PATCH] Use the template mechanism to set up refs/ hierarchy as well Junio C Hamano
@ 2005-08-04 18:41 ` Johannes Schindelin
2005-08-04 19:59 ` Junio C Hamano
0 siblings, 1 reply; 10+ messages in thread
From: Johannes Schindelin @ 2005-08-04 18:41 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hi,
On Tue, 2 Aug 2005, Junio C Hamano wrote:
> This may be controversial from the robustness standpoint, so I
> am placing it in the proposed update queue first. Discussions
> on the list very welcomed.
I'd vote against it: As of now, I can perfectly do
export PATH=$PATH:/whereever/my/git/is
git-init-db
which would not work with this patch. I don't mind the templating
mechanism per se, though. It should make life easier for new bees.
Let's just make sure git-init-db is usable without installing
anything.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.
2005-08-04 18:41 ` Johannes Schindelin
@ 2005-08-04 19:59 ` Junio C Hamano
2005-08-04 20:19 ` Johannes Schindelin
0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2005-08-04 19:59 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>> This may be controversial from the robustness standpoint, so I
>> am placing it in the proposed update queue first. Discussions
>> on the list very welcomed.
>
> I'd vote against it: As of now, I can perfectly do
>
> export PATH=$PATH:/whereever/my/git/is
> git-init-db
>
> which would not work with this patch.
I take it to mean that you do not mind building but would want
to try it out before installing.
Yes, that is similar to what I meant by "robustness". Maybe we
could do two things to make it palatable:
* Instead of $src/templates/Makefile installing in place, give
it a real 'build' target that creates $src/templates/blt/
hierarchy and build things there (I expect we would need some
templates that needs installation specific customization
later, and really want to avoid making $src/templates
something that is copied straight out). "make install" would
copy it out to the final destination.
* Make git-init-db create an absolute minimum $GIT_DIR
structure itself, if the template directory is not available,
possibly with a warning.
Then, your post-build pre-installation trial can go like this:
$ make
$ PATH=`pwd`:"$PATH"
$ GIT_TEMPLATE_DIRECTORY=`pwd`/templates/blt
$ export PATH GIT_TEMPLATE_DIRECTORY
$ cd /where/ever
$ git-init-db
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.
2005-08-04 19:59 ` Junio C Hamano
@ 2005-08-04 20:19 ` Johannes Schindelin
2005-08-04 20:50 ` Junio C Hamano
2005-08-04 22:08 ` barkalow
0 siblings, 2 replies; 10+ messages in thread
From: Johannes Schindelin @ 2005-08-04 20:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hi,
On Thu, 4 Aug 2005, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>>> This may be controversial from the robustness standpoint, so I
>>> am placing it in the proposed update queue first. Discussions
>>> on the list very welcomed.
>>
>> I'd vote against it: As of now, I can perfectly do
>>
>> export PATH=$PATH:/whereever/my/git/is
>> git-init-db
>>
>> which would not work with this patch.
>
> I take it to mean that you do not mind building but would want
> to try it out before installing.
I'd like to not being forced to install git. Scenario: I have an SSH
account on a remote machine. I am not root there, but I'd like to
synchronize my work with git. I can not install git.
> * Make git-init-db create an absolute minimum $GIT_DIR
> structure itself, if the template directory is not available,
> possibly with a warning.
This would be exactly what I'd like. Let git-init-db create
.git/objects/[0-9a-f]{2}/, .git/refs/heads/, .git/refs/tags and .git/HEAD.
Everything else is taken from the templates directory, if that exists. I
would not warn if it does not.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.
2005-08-04 20:19 ` Johannes Schindelin
@ 2005-08-04 20:50 ` Junio C Hamano
2005-08-04 21:13 ` Johannes Schindelin
2005-08-04 22:08 ` barkalow
1 sibling, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2005-08-04 20:50 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> I'd like to not being forced to install git. Scenario: I have an SSH
> account on a remote machine. I am not root there, but I'd like to
> synchronize my work with git. I can not install git.
Sorry, but now you completely lost me. You want git, you are
not root, you cannot install git system wide, so you run git
installed in your $HOME/bin somewhere instead. I think I am
following you correctly up to this point.
But if that is the case, I do not see where your objections to
the template directory installed somewhere under $HOME/etc comes
from, which is what the default Makefile does, or at least
attempts to.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.
2005-08-04 20:50 ` Junio C Hamano
@ 2005-08-04 21:13 ` Johannes Schindelin
2005-08-04 21:35 ` Junio C Hamano
0 siblings, 1 reply; 10+ messages in thread
From: Johannes Schindelin @ 2005-08-04 21:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hi,
On Thu, 4 Aug 2005, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> I'd like to not being forced to install git. Scenario: I have an SSH
>> account on a remote machine. I am not root there, but I'd like to
>> synchronize my work with git. I can not install git.
>
> Sorry, but now you completely lost me. You want git, you are
> not root, you cannot install git system wide, so you run git
> installed in your $HOME/bin somewhere instead. I think I am
> following you correctly up to this point.
>
> But if that is the case, I do not see where your objections to
> the template directory installed somewhere under $HOME/etc comes
> from, which is what the default Makefile does, or at least
> attempts to.
Sorry, I am so used to not installing in my home because of small quotas
:-(
Anyway, my usual setup is that I check git out from my private branch, add
that directory to my path, and every once in a while do a "git pull origin
&& make test". Right now, it works.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.
2005-08-04 21:13 ` Johannes Schindelin
@ 2005-08-04 21:35 ` Junio C Hamano
2005-08-05 0:35 ` Johannes Schindelin
0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2005-08-04 21:35 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Sorry, I am so used to not installing in my home because of small quotas
> :-(
>
> Anyway, my usual setup is that I check git out from my private branch, add
> that directory to my path, and every once in a while do a "git pull origin
> && make test". Right now, it works.
Oh, I see. Then the "templates/Makefile building into
templates/blt and then installing if you say make install"
approach I described earlier would hopefully work perfectly well
for you. Just like you tack the $src to your $PATH, you can
define GIT_TEMPLATE_DIRECTORY to $src/templates/blt. Problem
solved.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.
2005-08-04 21:35 ` Junio C Hamano
@ 2005-08-05 0:35 ` Johannes Schindelin
0 siblings, 0 replies; 10+ messages in thread
From: Johannes Schindelin @ 2005-08-05 0:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hi,
On Thu, 4 Aug 2005, Junio C Hamano wrote:
> Oh, I see. Then the "templates/Makefile building into
> templates/blt and then installing if you say make install"
> approach I described earlier would hopefully work perfectly well
> for you. Just like you tack the $src to your $PATH, you can
> define GIT_TEMPLATE_DIRECTORY to $src/templates/blt. Problem
> solved.
Yes. Call me an idiot.
Yours truly,
Dscho
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.
2005-08-04 20:19 ` Johannes Schindelin
2005-08-04 20:50 ` Junio C Hamano
@ 2005-08-04 22:08 ` barkalow
2005-08-05 0:20 ` Junio C Hamano
1 sibling, 1 reply; 10+ messages in thread
From: barkalow @ 2005-08-04 22:08 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, git
On Thu, 4 Aug 2005, Johannes Schindelin wrote:
> > * Make git-init-db create an absolute minimum $GIT_DIR
> > structure itself, if the template directory is not available,
> > possibly with a warning.
>
> This would be exactly what I'd like. Let git-init-db create
> .git/objects/[0-9a-f]{2}/, .git/refs/heads/, .git/refs/tags and .git/HEAD.
> Everything else is taken from the templates directory, if that exists. I would
> not warn if it does not.
Are .git/refs/heads and .git/refs/tags still needed? I seem to recall a
patch to create subdirectories of .git/refs on demand (needed for
tags/v99/1). I'd say just .git/objects/(everything), .git/refs, and
.git/info.
(Plus template, if available, of course)
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.
2005-08-04 22:08 ` barkalow
@ 2005-08-05 0:20 ` Junio C Hamano
0 siblings, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2005-08-05 0:20 UTC (permalink / raw)
To: git; +Cc: barkalow, Johannes Schindelin
barkalow@iabervon.org writes:
> ... I seem to recall a patch to create subdirectories of
> .git/refs on demand (needed for tags/v99/1). I'd say just
> .git/objects/(everything), .git/refs, and .git/info.
Having thought about this a bit more, I am inclined to drop
this. I see the template mechanism to be something that lets
site and project policy makers set up the repositories to suit
their taste, by having their users point their own template
directory via the GIT_TEMPLATE_DIRECTORY environment variable.
How $GIT_DIR/refs/heads/ and $GIT_DIR/refs/tags/ are used are
quite deeply ingrained in the core tools, and there is no point
pretending as if they can be overridden; they are not.
As Daniel says, refs/*/ are created mostly on-demand [*1*], so
it is not strictly necessary to create "heads" and "tags"
upfront, but they are so basic that I'd feel comfortable to keep
them part of what are done by git-init-db.
[Footnote]
*1* I fixed one in receive-pack recently, but please fix things
if you find any of the core tools assume that the leading paths
already exist.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-08-05 0:35 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-03 6:28 [PATCH] Use the template mechanism to set up refs/ hierarchy as well Junio C Hamano
2005-08-04 18:41 ` Johannes Schindelin
2005-08-04 19:59 ` Junio C Hamano
2005-08-04 20:19 ` Johannes Schindelin
2005-08-04 20:50 ` Junio C Hamano
2005-08-04 21:13 ` Johannes Schindelin
2005-08-04 21:35 ` Junio C Hamano
2005-08-05 0:35 ` Johannes Schindelin
2005-08-04 22:08 ` barkalow
2005-08-05 0:20 ` 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