{"thread":{"id":"1404","subject":"[PATCH] Use the template mechanism to set up refs/ hierarchy as well.","startedAt":"2005-08-03T06:28:35Z","lastAt":"2005-08-05T00:35:10Z","messageCount":10,"participants":["Junio C Hamano","Johannes Schindelin","barkalow@iabervon.org"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"6745","messageId":"7v3bprjzzg.fsf@assigned-by-dhcp.cox.net","threadId":"1404","inReplyTo":null,"subject":"[PATCH] Use the template mechanism to set up refs/ hierarchy as well.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-03T06:28:35Z","receivedAt":"2005-08-03T06:28:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This may be controversial from the robustness standpoint, so I\nam placing it in the proposed update queue first.  Discussions\non the list very welcomed.\n\nOnce the alternate object pool mechanism is taught to use\n$GIT_DIR/info/alt file (instead of/in addition to the\nenvironment variable), this would help people setting up\nrepositories for underling developers.  They can prepare a\nstandard template info/alt that points at the project-wide base\nobject pool that is shared, and have people point\nGIT_TEMPLATE_DIRECTORY at the project standard template\ndirectory.\n\n------------\nThis removes the hardcoded set of refs/ directory structure that\nis created by git-init-db and move it to the template\nmechanism.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n init-db.c            |   22 ----------------------\n t/t5400-send-pack.sh |   16 +++++++++++++++-\n templates/Makefile   |    4 ++++\n 3 files changed, 19 insertions(+), 23 deletions(-)\n\nde8b5bf5605274d29b835947932b9b6c109f5d9f\ndiff --git a/init-db.c b/init-db.c\n--- a/init-db.c\n+++ b/init-db.c\n@@ -167,28 +167,6 @@ static void create_default_files(const c\n \n \tif (len && path[len-1] != '/')\n \t\tpath[len++] = '/';\n-\n-\t/*\n-\t * Create .git/refs/{heads,tags}\n-\t */\n-\tstrcpy(path + len, \"refs\");\n-\tsafe_create_dir(path);\n-\tstrcpy(path + len, \"refs/heads\");\n-\tsafe_create_dir(path);\n-\tstrcpy(path + len, \"refs/tags\");\n-\tsafe_create_dir(path);\n-\n-\t/*\n-\t * Create the default symlink from \".git/HEAD\" to the \"master\"\n-\t * branch\n-\t */\n-\tstrcpy(path + len, \"HEAD\");\n-\tif (symlink(\"refs/heads/master\", path) < 0) {\n-\t\tif (errno != EEXIST) {\n-\t\t\tperror(path);\n-\t\t\texit(1);\n-\t\t}\n-\t}\n \tcopy_templates(path);\n }\n \ndiff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh\n--- a/t/t5400-send-pack.sh\n+++ b/t/t5400-send-pack.sh\n@@ -8,6 +8,18 @@ test_description='See why rewinding head\n '\n . ./test-lib.sh\n \n+# This part is needed to test before installing templates.\n+mkdir -p templates/refs/heads\n+ln -s refs/heads/master templates/HEAD\n+mkdir -p templates/hooks\n+echo '#!/bin/sh\n+echo we are here >$GIT_DIR/we-are-here' >templates/hooks/post-update\n+chmod +x templates/hooks/post-update\n+\n+GIT_TEMPLATE_DIRECTORY=`pwd`/templates/\n+export GIT_TEMPLATE_DIRECTORY\n+git-init-db\n+\n cnt='1'\n test_expect_success setup '\n \ttree=$(git-write-tree) &&\n@@ -50,5 +62,7 @@ test_expect_success \\\n \tfi &&\n \t# this should update\n \tgit-send-pack --force ./victim/.git/ master &&\n-\tcmp victim/.git/refs/heads/master .git/refs/heads/master\n+\tcmp victim/.git/refs/heads/master .git/refs/heads/master &&\n+\t# and post-update should have run\n+\ttest -f victim/.git/we-are-here\n '\ndiff --git a/templates/Makefile b/templates/Makefile\n--- a/templates/Makefile\n+++ b/templates/Makefile\n@@ -17,3 +17,7 @@ install:\n \t\t$(dest)$(templatedir)/hooks/$(patsubst hooks--%,%,$s);)\n \t$(INSTALL) -d -m755 $(dest)$(templatedir)/info\n \t$(INSTALL) -d -m755 $(dest)$(templatedir)/branches\n+\t$(INSTALL) -d -m755 $(dest)$(templatedir)/refs/heads\n+\t$(INSTALL) -d -m755 $(dest)$(templatedir)/refs/tags\n+\trm -f $(dest)$(templatedir)/HEAD && \\\n+\tln -s refs/heads/master $(dest)$(templatedir)/HEAD\n"},{"id":"6799","messageId":"Pine.LNX.4.63.0508042038200.23886@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1404","inReplyTo":"7v3bprjzzg.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-04T18:41:09Z","receivedAt":"2005-08-04T18:41:09Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 2 Aug 2005, Junio C Hamano wrote:\n\n> This may be controversial from the robustness standpoint, so I\n> am placing it in the proposed update queue first.  Discussions\n> on the list very welcomed.\n\nI'd vote against it: As of now, I can perfectly do\n\nexport PATH=$PATH:/whereever/my/git/is\ngit-init-db\n\nwhich would not work with this patch. I don't mind the templating \nmechanism per se, though. It should make life easier for new bees.\nLet's just make sure git-init-db is usable without installing \nanything.\n\nCiao,\nDscho\n"},{"id":"6803","messageId":"7vll3hxykj.fsf@assigned-by-dhcp.cox.net","threadId":"1404","inReplyTo":"Pine.LNX.4.63.0508042038200.23886@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-04T19:59:56Z","receivedAt":"2005-08-04T19:59:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> This may be controversial from the robustness standpoint, so I\n>> am placing it in the proposed update queue first.  Discussions\n>> on the list very welcomed.\n>\n> I'd vote against it: As of now, I can perfectly do\n>\n> export PATH=$PATH:/whereever/my/git/is\n> git-init-db\n>\n> which would not work with this patch.\n\nI take it to mean that you do not mind building but would want\nto try it out before installing.\n\nYes, that is similar to what I meant by \"robustness\".  Maybe we\ncould do two things to make it palatable:\n\n * Instead of $src/templates/Makefile installing in place, give\n   it a real 'build' target that creates $src/templates/blt/\n   hierarchy and build things there (I expect we would need some\n   templates that needs installation specific customization\n   later, and really want to avoid making $src/templates\n   something that is copied straight out).  \"make install\" would\n   copy it out to the final destination.\n\n * Make git-init-db create an absolute minimum $GIT_DIR\n   structure itself, if the template directory is not available,\n   possibly with a warning.\n\nThen, your post-build pre-installation trial can go like this:\n\n    $ make\n    $ PATH=`pwd`:\"$PATH\"\n    $ GIT_TEMPLATE_DIRECTORY=`pwd`/templates/blt\n    $ export PATH GIT_TEMPLATE_DIRECTORY\n    $ cd /where/ever\n    $ git-init-db\n"},{"id":"6806","messageId":"Pine.LNX.4.63.0508042215430.24657@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1404","inReplyTo":"7vll3hxykj.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-04T20:19:10Z","receivedAt":"2005-08-04T20:19:10Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 4 Aug 2005, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>\n>>> This may be controversial from the robustness standpoint, so I\n>>> am placing it in the proposed update queue first.  Discussions\n>>> on the list very welcomed.\n>>\n>> I'd vote against it: As of now, I can perfectly do\n>>\n>> export PATH=$PATH:/whereever/my/git/is\n>> git-init-db\n>>\n>> which would not work with this patch.\n>\n> I take it to mean that you do not mind building but would want\n> to try it out before installing.\n\nI'd like to not being forced to install git. Scenario: I have an SSH \naccount on a remote machine. I am not root there, but I'd like to \nsynchronize my work with git. I can not install git.\n\n> * Make git-init-db create an absolute minimum $GIT_DIR\n>   structure itself, if the template directory is not available,\n>   possibly with a warning.\n\nThis would be exactly what I'd like. Let git-init-db create \n.git/objects/[0-9a-f]{2}/, .git/refs/heads/, .git/refs/tags and .git/HEAD. \nEverything else is taken from the templates directory, if that exists. I \nwould not warn if it does not.\n\nCiao,\nDscho\n"},{"id":"6810","messageId":"7v7jf1xw90.fsf@assigned-by-dhcp.cox.net","threadId":"1404","inReplyTo":"Pine.LNX.4.63.0508042215430.24657@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-04T20:50:03Z","receivedAt":"2005-08-04T20:50:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> I'd like to not being forced to install git. Scenario: I have an SSH \n> account on a remote machine. I am not root there, but I'd like to \n> synchronize my work with git. I can not install git.\n\nSorry, but now you completely lost me.  You want git, you are\nnot root, you cannot install git system wide, so you run git\ninstalled in your $HOME/bin somewhere instead.  I think I am\nfollowing you correctly up to this point.\n\nBut if that is the case, I do not see where your objections to\nthe template directory installed somewhere under $HOME/etc comes\nfrom, which is what the default Makefile does, or at least\nattempts to.\n"},{"id":"6813","messageId":"Pine.LNX.4.63.0508042311370.24861@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1404","inReplyTo":"7v7jf1xw90.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-04T21:13:47Z","receivedAt":"2005-08-04T21:13:47Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 4 Aug 2005, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>\n>> I'd like to not being forced to install git. Scenario: I have an SSH\n>> account on a remote machine. I am not root there, but I'd like to\n>> synchronize my work with git. I can not install git.\n>\n> Sorry, but now you completely lost me.  You want git, you are\n> not root, you cannot install git system wide, so you run git\n> installed in your $HOME/bin somewhere instead.  I think I am\n> following you correctly up to this point.\n>\n> But if that is the case, I do not see where your objections to\n> the template directory installed somewhere under $HOME/etc comes\n> from, which is what the default Makefile does, or at least\n> attempts to.\n\nSorry, I am so used to not installing in my home because of small quotas \n:-(\n\nAnyway, my usual setup is that I check git out from my private branch, add \nthat directory to my path, and every once in a while do a \"git pull origin \n&& make test\". Right now, it works.\n\nCiao,\nDscho\n"},{"id":"6822","messageId":"7vmznxwfka.fsf@assigned-by-dhcp.cox.net","threadId":"1404","inReplyTo":"Pine.LNX.4.63.0508042311370.24861@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-04T21:35:49Z","receivedAt":"2005-08-04T21:35:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Sorry, I am so used to not installing in my home because of small quotas \n> :-(\n>\n> Anyway, my usual setup is that I check git out from my private branch, add \n> that directory to my path, and every once in a while do a \"git pull origin \n> && make test\". Right now, it works.\n\nOh, I see.  Then the \"templates/Makefile building into\ntemplates/blt and then installing if you say make install\"\napproach I described earlier would hopefully work perfectly well\nfor you.  Just like you tack the $src to your $PATH, you can\ndefine GIT_TEMPLATE_DIRECTORY to $src/templates/blt.  Problem\nsolved.\n"},{"id":"6818","messageId":"Pine.LNX.4.62.0508041804120.23721@iabervon.org","threadId":"1404","inReplyTo":"Pine.LNX.4.63.0508042215430.24657@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.","fromName":"","fromEmail":"barkalow@iabervon.org","sentAt":"2005-08-04T22:08:47Z","receivedAt":"2005-08-04T22:08:47Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Thu, 4 Aug 2005, Johannes Schindelin wrote:\n\n> > * Make git-init-db create an absolute minimum $GIT_DIR\n> > structure itself, if the template directory is not available,\n> > possibly with a warning.\n> \n> This would be exactly what I'd like. Let git-init-db create\n> .git/objects/[0-9a-f]{2}/, .git/refs/heads/, .git/refs/tags and .git/HEAD.\n> Everything else is taken from the templates directory, if that exists. I would\n> not warn if it does not.\n\nAre .git/refs/heads and .git/refs/tags still needed? I seem to recall a \npatch to create subdirectories of .git/refs on demand (needed for \ntags/v99/1). I'd say just .git/objects/(everything), .git/refs, and \n.git/info.\n\n(Plus template, if available, of course)\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"6834","messageId":"7vll3hqlo6.fsf@assigned-by-dhcp.cox.net","threadId":"1404","inReplyTo":"Pine.LNX.4.62.0508041804120.23721@iabervon.org","subject":"Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-05T00:20:25Z","receivedAt":"2005-08-05T00:20:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"barkalow@iabervon.org writes:\n\n> ... I seem to recall a patch to create subdirectories of\n> .git/refs on demand (needed for tags/v99/1). I'd say just\n> .git/objects/(everything), .git/refs, and .git/info.\n\nHaving thought about this a bit more, I am inclined to drop\nthis.  I see the template mechanism to be something that lets\nsite and project policy makers set up the repositories to suit\ntheir taste, by having their users point their own template\ndirectory via the GIT_TEMPLATE_DIRECTORY environment variable.\nHow $GIT_DIR/refs/heads/ and $GIT_DIR/refs/tags/ are used are\nquite deeply ingrained in the core tools, and there is no point\npretending as if they can be overridden; they are not.\n\nAs Daniel says, refs/*/ are created mostly on-demand [*1*], so\nit is not strictly necessary to create \"heads\" and \"tags\"\nupfront, but they are so basic that I'd feel comfortable to keep\nthem part of what are done by git-init-db.\n\n\n[Footnote]\n\n*1* I fixed one in receive-pack recently, but please fix things\nif you find any of the core tools assume that the leading paths\nalready exist.\n"},{"id":"6835","messageId":"Pine.LNX.4.63.0508050234460.25689@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1404","inReplyTo":"7vmznxwfka.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Use the template mechanism to set up refs/ hierarchy as well.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-05T00:35:10Z","receivedAt":"2005-08-05T00:35:10Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 4 Aug 2005, Junio C Hamano wrote:\n\n> Oh, I see.  Then the \"templates/Makefile building into\n> templates/blt and then installing if you say make install\"\n> approach I described earlier would hopefully work perfectly well\n> for you.  Just like you tack the $src to your $PATH, you can\n> define GIT_TEMPLATE_DIRECTORY to $src/templates/blt.  Problem\n> solved.\n\nYes. Call me an idiot.\n\nYours truly,\nDscho\n"}]}