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

Reply via email to