Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.

2005-08-04 Thread Johannes Schindelin

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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.

2005-08-04 Thread Junio C Hamano
[EMAIL PROTECTED] 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.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.

2005-08-04 Thread Junio C Hamano
Johannes Schindelin <[EMAIL PROTECTED]> 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.



-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.

2005-08-04 Thread barkalow
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*
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.

2005-08-04 Thread Johannes Schindelin

Hi,

On Thu, 4 Aug 2005, Junio C Hamano wrote:


Johannes Schindelin <[EMAIL PROTECTED]> 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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.

2005-08-04 Thread Junio C Hamano
Johannes Schindelin <[EMAIL PROTECTED]> 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.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.

2005-08-04 Thread Johannes Schindelin

Hi,

On Thu, 4 Aug 2005, Junio C Hamano wrote:


Johannes Schindelin <[EMAIL PROTECTED]> 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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.

2005-08-04 Thread Junio C Hamano
Johannes Schindelin <[EMAIL PROTECTED]> 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


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.

2005-08-04 Thread Johannes Schindelin

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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Use the template mechanism to set up refs/ hierarchy as well.

2005-08-02 Thread Junio C Hamano
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 <[EMAIL PROTECTED]>
---

 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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html