{"thread":{"id":"11835","subject":"[PATCH] Add platform-independent .git \"symlink\"","startedAt":"2008-02-02T10:36:19Z","lastAt":"2008-02-05T12:57:54Z","messageCount":29,"participants":["Lars Hjemli","Johannes Schindelin","Junio C Hamano","Shawn O. Pearce","Brandon Casey"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"67101","messageId":"1201948579-11807-1-git-send-email-hjemli@gmail.com","threadId":"11835","inReplyTo":null,"subject":"[PATCH] Add platform-independent .git \"symlink\"","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-02-02T10:36:19Z","receivedAt":"2008-02-02T10:36:19Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"This patch allows .git to be a regular textfile containing the path of\nthe real git directory (formatted like \"GITDIR: <path>\\n\"), which is\nuseful on platforms lacking support for real symlinks.\n\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n\nAll tests pass, but git-submodule needs to be updated to handle this\nfeature. Incidentally, git-submodule might also be the first command\nwanting to use this feature; it probably should clone submodules into\na bare repository in GIT_DIR/submodules/<modulename> of the containing\nrepository to prevent dataloss during submodule update etc.\n\n setup.c |   38 ++++++++++++++++++++++++++++++++++++++\n 1 files changed, 38 insertions(+), 0 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex adede16..87d6115 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -239,6 +239,38 @@ static int check_repository_format_gently(int *nongit_ok)\n }\n \n /*\n+ * Try to read the location of the git directory from the .git file,\n+ * return path to git directory if found.\n+ * Format of the .git file is\n+ *    GITDIR: <path>\\n\n+ */\n+static const char *read_gitfile_gently(const char *path)\n+{\n+\tstatic char buf[PATH_MAX + 10];  /* \"GITDIR: \" + \"\\n\" + \"\\0\" */\n+\tstruct stat st;\n+\tFILE *f;\n+\tsize_t len;\n+\n+\tif (stat(path, &st))\n+\t\treturn NULL;\n+\tif (!S_ISREG(st.st_mode) || st.st_size > PATH_MAX + 9)\n+\t\treturn NULL;\n+\tf = fopen(path, \"r\");\n+\tif (!f)\n+\t\treturn NULL;\n+\tlen = fread(buf, 1, st.st_size, f);\n+\tfclose(f);\n+\tif (len != st.st_size)\n+\t\treturn NULL;\n+\tif (len < 10 || buf[len - 1] != '\\n' || strncmp(buf, \"GITDIR: \", 8))\n+\t\treturn NULL;\n+\tbuf[len - 1] = '\\0';\n+\tif (!is_git_directory(buf + 8))\n+\t\treturn NULL;\n+\treturn buf + 8;\n+}\n+\n+/*\n  * We cannot decide in this function whether we are in the work tree or\n  * not, since the config can only be read _after_ this function was called.\n  */\n@@ -247,6 +279,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \tconst char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);\n \tstatic char cwd[PATH_MAX+1];\n \tconst char *gitdirenv;\n+\tconst char *gitfile_dir;\n \tint len, offset;\n \n \t/*\n@@ -302,6 +335,11 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t */\n \toffset = len = strlen(cwd);\n \tfor (;;) {\n+\t\tgitfile_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);\n+\t\tif (gitfile_dir) {\n+\t\t\tsetenv(GIT_DIR_ENVIRONMENT, gitfile_dir, 1);\n+\t\t\tbreak;\n+\t\t}\n \t\tif (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT))\n \t\t\tbreak;\n \t\tif (is_git_directory(\".\")) {\n-- \n1.5.4.GIT-dirty\n"},{"id":"67136","messageId":"1201964571-4801-1-git-send-email-hjemli@gmail.com","threadId":"11835","inReplyTo":"1201948579-11807-1-git-send-email-hjemli@gmail.com","subject":"[PATCH] Add tests for .git file","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-02-02T15:02:51Z","receivedAt":"2008-02-02T15:02:51Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"Verify that the basic plumbing works when .git is a file pointing at\nthe real git directory.\n\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n t/t0002-gitfile.sh |   71 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 71 insertions(+), 0 deletions(-)\n create mode 100755 t/t0002-gitfile.sh\n\ndiff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\nnew file mode 100755\nindex 0000000..55276c6\n--- /dev/null\n+++ b/t/t0002-gitfile.sh\n@@ -0,0 +1,71 @@\n+#!/bin/sh\n+\n+test_description='.git file\n+\n+Verify that plumbing commands work when .git is a file\n+'\n+. ./test-lib.sh\n+\n+chkfile() {\n+\tD=$(echo $1 | cut -b 1-2) &&\n+\tF=$(echo $1 | cut -b 3-40) &&\n+\tif test ! -f $REAL/objects/$D/$F\n+\tthen\n+\t\techo \"Object not found: $REAL/objects/$D/$F\"\n+\t\tfalse\n+\tfi\n+}\n+\n+test_expect_success 'setup' '\n+\tREAL=$(pwd)/.real &&\n+\tmv .git $REAL &&\n+\techo \"GITDIR: $REAL\" >.git\n+'\n+\n+test_expect_success 'check rev-parse --git-dir' '\n+\ttest \"$REAL\" = \"$(git rev-parse --git-dir)\"\n+'\n+\n+test_expect_success 'check hash-object' '\n+\techo \"foo\" >bar &&\n+\tSHA=$(cat bar | git hash-object -w --stdin) &&\n+\tchkfile $SHA\n+'\n+\n+test_expect_success 'check cat-file' '\n+\tgit cat-file blob $SHA >actual &&\n+\tdiff -u bar actual\n+'\n+\n+test_expect_success 'check update-index' '\n+\tif test -f $REAL/index\n+\tthen\n+\t\techo \"Hmm, $REAL/index exists?\"\n+\t\tfalse\n+\tfi &&\n+\trm -rf $REAL/objects/* &&\n+\tgit update-index --add bar &&\n+\tif ! test -f $REAL/index\n+\tthen\n+\t\techo \"$REAL/index not found\"\n+\t\tfalse\n+\tfi &&\n+\tchkfile $SHA\n+'\n+\n+test_expect_success 'check write-tree' '\n+\tSHA=$(git write-tree) &&\n+\tchkfile $SHA\n+'\n+\n+test_expect_success 'check commit-tree' '\n+\tSHA=$(echo \"commit bar\" | git commit-tree $SHA) &&\n+\tchkfile $SHA\n+'\n+\n+test_expect_success 'check rev-list' '\n+\techo $SHA >$REAL/HEAD &&\n+\ttest \"$SHA\" = \"$(git rev-list HEAD)\"\n+'\n+\n+test_done\n-- \n1.5.4.GIT-dirty\n"},{"id":"67139","messageId":"alpine.LSU.1.00.0802021550130.7372@racer.site","threadId":"11835","inReplyTo":"1201948579-11807-1-git-send-email-hjemli@gmail.com","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-02T15:56:13Z","receivedAt":"2008-02-02T15:56:13Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 2 Feb 2008, Lars Hjemli wrote:\n\n> This patch allows .git to be a regular textfile containing the path of \n> the real git directory (formatted like \"GITDIR: <path>\\n\"), which is \n> useful on platforms lacking support for real symlinks.\n\nWow, that looks easier than I thought...\n\n> +static const char *read_gitfile_gently(const char *path)\n> +{\n> +\tstatic char buf[PATH_MAX + 10];  /* \"GITDIR: \" + \"\\n\" + \"\\0\" */\n\nWhy say \"GITDIR:\"?  Do you want to be able to set other things there, too, \nlike GITWORKDIR?\n\n> +\tstruct stat st;\n> +\tFILE *f;\n> +\tsize_t len;\n> +\n> +\tif (stat(path, &st))\n> +\t\treturn NULL;\n> +\tif (!S_ISREG(st.st_mode) || st.st_size > PATH_MAX + 9)\n\nWhy make it complicated? You could just test for st.st_size >= \nsizeof(buf).\n\n> +\t\treturn NULL;\n> +\tf = fopen(path, \"r\");\n> +\tif (!f)\n> +\t\treturn NULL;\n> +\tlen = fread(buf, 1, st.st_size, f);\n> +\tfclose(f);\n> +\tif (len != st.st_size)\n> +\t\treturn NULL;\n\nShould this not rather use read_in_full()?\n\n> +\tif (len < 10 || buf[len - 1] != '\\n' || strncmp(buf, \"GITDIR: \", 8))\n> +\t\treturn NULL;\n> +\tbuf[len - 1] = '\\0';\n> +\tif (!is_git_directory(buf + 8))\n> +\t\treturn NULL;\n> +\treturn buf + 8;\n> +}\n\nShould this not make the git directory absolute, just in case?\n\nThanks,\nDscho\n"},{"id":"67149","messageId":"8c5c35580802020959v613b9e32v321e97f93f2af761@mail.gmail.com","threadId":"11835","inReplyTo":"alpine.LSU.1.00.0802021550130.7372@racer.site","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-02-02T17:59:05Z","receivedAt":"2008-02-02T17:59:05Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On Feb 2, 2008 4:56 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> On Sat, 2 Feb 2008, Lars Hjemli wrote:\n>\n> > +static const char *read_gitfile_gently(const char *path)\n> > +{\n> > +     static char buf[PATH_MAX + 10];  /* \"GITDIR: \" + \"\\n\" + \"\\0\" */\n>\n> Why say \"GITDIR:\"?  Do you want to be able to set other things there, too,\n> like GITWORKDIR?\n\nNot ATM, but it might become useful to specify some other bits of\nconfiguration in this file (especially if one uses multiple workdirs).\n\nYour other comments also made perfect sense so I'll send a reworked patch.\n\n--\nlarsh\n"},{"id":"67151","messageId":"1201975757-13771-1-git-send-email-hjemli@gmail.com","threadId":"11835","inReplyTo":"8c5c35580802020959v613b9e32v321e97f93f2af761@mail.gmail.com","subject":"[PATCH] Add platform-independent .git \"symlink\"","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-02-02T18:09:17Z","receivedAt":"2008-02-02T18:09:17Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"This patch allows .git to be a regular textfile containing the path of\nthe real git directory (formatted like \"GITDIR: <path>\\n\"), which is\nuseful on platforms lacking support for real symlinks.\n\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n setup.c |   38 ++++++++++++++++++++++++++++++++++++++\n 1 files changed, 38 insertions(+), 0 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex adede16..45a78c4 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -239,6 +239,38 @@ static int check_repository_format_gently(int *nongit_ok)\n }\n \n /*\n+ * Try to read the location of the git directory from the .git file,\n+ * return path to git directory if found.\n+ * Format of the .git file is\n+ *    GITDIR: <path>\\n\n+ */\n+static const char *read_gitfile_gently(const char *path)\n+{\n+\tstatic char buf[PATH_MAX + 10];  /* \"GITDIR: \" + \"\\n\" + \"\\0\" */\n+\tstruct stat st;\n+\tint fd;\n+\tsize_t len;\n+\n+\tif (stat(path, &st))\n+\t\treturn NULL;\n+\tif (!S_ISREG(st.st_mode) || st.st_size >= sizeof(buf))\n+\t\treturn NULL;\n+\tfd = open(path, O_RDONLY);\n+\tif (fd < 0)\n+\t\treturn NULL;\n+\tlen = read_in_full(fd, buf, sizeof(buf));\n+\tclose(fd);\n+\tif (len != st.st_size)\n+\t\treturn NULL;\n+\tif (len < 10 || buf[len - 1] != '\\n' || strncmp(buf, \"GITDIR: \", 8))\n+\t\treturn NULL;\n+\tbuf[len - 1] = '\\0';\n+\tif (!is_git_directory(buf + 8))\n+\t\treturn NULL;\n+\treturn make_absolute_path(buf + 8);\n+}\n+\n+/*\n  * We cannot decide in this function whether we are in the work tree or\n  * not, since the config can only be read _after_ this function was called.\n  */\n@@ -247,6 +279,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \tconst char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);\n \tstatic char cwd[PATH_MAX+1];\n \tconst char *gitdirenv;\n+\tconst char *gitfile_dir;\n \tint len, offset;\n \n \t/*\n@@ -302,6 +335,11 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t */\n \toffset = len = strlen(cwd);\n \tfor (;;) {\n+\t\tgitfile_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);\n+\t\tif (gitfile_dir) {\n+\t\t\tsetenv(GIT_DIR_ENVIRONMENT, gitfile_dir, 1);\n+\t\t\tbreak;\n+\t\t}\n \t\tif (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT))\n \t\t\tbreak;\n \t\tif (is_git_directory(\".\")) {\n-- \n1.5.4.4.gd2e29\n"},{"id":"67152","messageId":"alpine.LSU.1.00.0802021815510.7372@racer.site","threadId":"11835","inReplyTo":"1201975757-13771-1-git-send-email-hjemli@gmail.com","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-02T18:19:18Z","receivedAt":"2008-02-02T18:19:18Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 2 Feb 2008, Lars Hjemli wrote:\n\n> +\tif (len < 10 || buf[len - 1] != '\\n' || strncmp(buf, \"GITDIR: \", 8))\n\nSorry, missed that earlier: How about\n\n\tif (!len || buf[len-1] != '\\n' || prefixcmp(buf, \"GITDIR: \"))\n\ninstead?  (buf does not need be NUL terminated for the prefixcmp(), since \nwe just made sure it is LF terminated)\n\nThanks,\nDscho\n"},{"id":"67153","messageId":"alpine.LSU.1.00.0802021825220.7372@racer.site","threadId":"11835","inReplyTo":"alpine.LSU.1.00.0802021815510.7372@racer.site","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-02T18:34:46Z","receivedAt":"2008-02-02T18:34:46Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nBTW just to tell you why I am so excited with your patch: I have a patch \nto git-branch in my tree, which implements the git-new-workdir \nfunctionality (it's a patch to git-branch, not git-checkout, mainly \nbecause git-checkout is no builtin yet).\n\nNow, git-new-workdir works by having symlinks _in_ .git/, but not for \neverything.  .git/HEAD is specific to the workdir, of course.\n\nBut your patch made me realise that this is the wrong way to go about it.  \nSure, you do not need to change core git, and can use a script to make the \nnew working directory.  But there is no lock preventing the same ref being \nchecked out twice.\n\nHowver, having .git a file pointing to another git directory allows you to \nhave locks there.  And they can be actually pretty sensible locks, like\n\n\t.git/HEAD.<mangled-path>\n\nactually containing the symbolic ref describing which branch we're on in \nthat working directory.  Likewise, .git/index.<mangled-path> needs to hold \nthe current index.\n\nOf course, for this to work, you need to use different HEADs and indexes \nonly if .git was a file originally.\n\nBTW <mangled-path> could be a hash of the path, and for convenience, we \ncould store the path in .git/workdir.<mangled-path>.\n\nFood for thought.\n\nCiao,\nDscho\n"},{"id":"67154","messageId":"8c5c35580802021047o41a7de9fi84a6b33f0f779e2e@mail.gmail.com","threadId":"11835","inReplyTo":"alpine.LSU.1.00.0802021815510.7372@racer.site","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-02-02T18:47:23Z","receivedAt":"2008-02-02T18:47:23Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On Feb 2, 2008 7:19 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> Hi,\n>\n> On Sat, 2 Feb 2008, Lars Hjemli wrote:\n>\n> > +     if (len < 10 || buf[len - 1] != '\\n' || strncmp(buf, \"GITDIR: \", 8))\n>\n> Sorry, missed that earlier: How about\n>\n>         if (!len || buf[len-1] != '\\n' || prefixcmp(buf, \"GITDIR: \"))\n>\n> instead?  (buf does not need be NUL terminated for the prefixcmp(), since\n> we just made sure it is LF terminated)\n\nThat's true, although it feels a bit too clever for me ;-)\n\nMaybe this as a compromise?\n\n\tstatic char buf[PATH_MAX + 9];  /* \"GITDIR: \" + \"\\n\"  */\n...\n\tif (!len || buf[len - 1] != '\\n')\n\t\treturn NULL;\n\tbuf[len - 1] = '\\0';\n\tif (prefixcmp(buf, \"GITDIR: \"))\n\t\treturn NULL;\n\n--\nlarsh\n"},{"id":"67171","messageId":"alpine.LSU.1.00.0802030155240.7372@racer.site","threadId":"11835","inReplyTo":"8c5c35580802021047o41a7de9fi84a6b33f0f779e2e@mail.gmail.com","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-03T01:55:49Z","receivedAt":"2008-02-03T01:55:49Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 2 Feb 2008, Lars Hjemli wrote:\n\n> On Feb 2, 2008 7:19 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n>\n> > On Sat, 2 Feb 2008, Lars Hjemli wrote:\n> >\n> > > +     if (len < 10 || buf[len - 1] != '\\n' || strncmp(buf, \"GITDIR: \", 8))\n> >\n> > Sorry, missed that earlier: How about\n> >\n> >         if (!len || buf[len-1] != '\\n' || prefixcmp(buf, \"GITDIR: \"))\n> >\n> > instead?  (buf does not need be NUL terminated for the prefixcmp(), since\n> > we just made sure it is LF terminated)\n> \n> That's true, although it feels a bit too clever for me ;-)\n\n:-)\n\n> Maybe this as a compromise?\n> \n> \tstatic char buf[PATH_MAX + 9];  /* \"GITDIR: \" + \"\\n\"  */\n> ...\n> \tif (!len || buf[len - 1] != '\\n')\n> \t\treturn NULL;\n> \tbuf[len - 1] = '\\0';\n> \tif (prefixcmp(buf, \"GITDIR: \"))\n> \t\treturn NULL;\n\nSure!\n\nThanks,\nDscho\n"},{"id":"67285","messageId":"7vwsplporv.fsf@gitster.siamese.dyndns.org","threadId":"11835","inReplyTo":"8c5c35580802021047o41a7de9fi84a6b33f0f779e2e@mail.gmail.com","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-04T00:07:48Z","receivedAt":"2008-02-04T00:07:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Lars Hjemli\" <hjemli@gmail.com> writes:\n\n> Maybe this as a compromise?\n>\n> \tstatic char buf[PATH_MAX + 9];  /* \"GITDIR: \" + \"\\n\"  */\n> ...\n> \tif (!len || buf[len - 1] != '\\n')\n> \t\treturn NULL;\n> \tbuf[len - 1] = '\\0';\n> \tif (prefixcmp(buf, \"GITDIR: \"))\n> \t\treturn NULL;\n\nPerhaps that is easier to read.\n\nFor now I haven't picked up any of the \"how about this way\"\nrevisions.\n"},{"id":"67290","messageId":"alpine.LSU.1.00.0802040024030.7372@racer.site","threadId":"11835","inReplyTo":"7vwsplporv.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-04T00:24:37Z","receivedAt":"2008-02-04T00:24:37Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 3 Feb 2008, Junio C Hamano wrote:\n\n> \"Lars Hjemli\" <hjemli@gmail.com> writes:\n> \n> > Maybe this as a compromise?\n> >\n> > \tstatic char buf[PATH_MAX + 9];  /* \"GITDIR: \" + \"\\n\"  */\n> > ...\n> > \tif (!len || buf[len - 1] != '\\n')\n> > \t\treturn NULL;\n> > \tbuf[len - 1] = '\\0';\n> > \tif (prefixcmp(buf, \"GITDIR: \"))\n> > \t\treturn NULL;\n> \n> Perhaps that is easier to read.\n> \n> For now I haven't picked up any of the \"how about this way\"\n> revisions.\n\nYeah, I think all my comments have been addressed...  Lars, care to send a \nnew version?\n\nThanks,\nDscho\n"},{"id":"67302","messageId":"20080204013559.GE24004@spearce.org","threadId":"11835","inReplyTo":"alpine.LSU.1.00.0802040024030.7372@racer.site","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-02-04T01:35:59Z","receivedAt":"2008-02-04T01:35:59Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> On Sun, 3 Feb 2008, Junio C Hamano wrote:\n> \n> > \"Lars Hjemli\" <hjemli@gmail.com> writes:\n> > \n> > > Maybe this as a compromise?\n> > >\n> > > \tstatic char buf[PATH_MAX + 9];  /* \"GITDIR: \" + \"\\n\"  */\n> > > ...\n> > > \tif (!len || buf[len - 1] != '\\n')\n> > > \t\treturn NULL;\n> > > \tbuf[len - 1] = '\\0';\n> > > \tif (prefixcmp(buf, \"GITDIR: \"))\n> > > \t\treturn NULL;\n> > \n> > Perhaps that is easier to read.\n> > \n> > For now I haven't picked up any of the \"how about this way\"\n> > revisions.\n> \n> Yeah, I think all my comments have been addressed...  Lars, care to send a \n> new version?\n\nI would suggest a slightly different name, \"GIT_DIR: \", as the\nline prefix, because the environment variable is also GIT_DIR.\n\nBut that's just me.\n\n-- \nShawn.\n"},{"id":"67304","messageId":"7vr6fto5oe.fsf@gitster.siamese.dyndns.org","threadId":"11835","inReplyTo":"20080204013559.GE24004@spearce.org","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-04T01:45:37Z","receivedAt":"2008-02-04T01:45:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n>> On Sun, 3 Feb 2008, Junio C Hamano wrote:\n>> \n>> > \"Lars Hjemli\" <hjemli@gmail.com> writes:\n>> > \n>> > > Maybe this as a compromise?\n>> > >\n>> > > \tstatic char buf[PATH_MAX + 9];  /* \"GITDIR: \" + \"\\n\"  */\n>> > > ...\n>> > > \tif (!len || buf[len - 1] != '\\n')\n>> > > \t\treturn NULL;\n>> > > \tbuf[len - 1] = '\\0';\n>> > > \tif (prefixcmp(buf, \"GITDIR: \"))\n>> > > \t\treturn NULL;\n>> > \n>> > Perhaps that is easier to read.\n>> > \n>> > For now I haven't picked up any of the \"how about this way\"\n>> > revisions.\n>> \n>> Yeah, I think all my comments have been addressed...  Lars, care to send a \n>> new version?\n>\n> I would suggest a slightly different name, \"GIT_DIR: \", as the\n> line prefix, because the environment variable is also GIT_DIR.\n>\n> But that's just me.\n\nI think that was modelled after symref HEAD that would point at\nthe real ref with \"ref: refs/heads/master\", as if you have a\nsymlink whose value is \"refs/heads/master\".  So reusing \"ref: \"\nmight be Ok, and saying \"directory: \" or \"gitdir: \" would be\nalso Ok.\n\nIf we would want to reuse the mechanism in the future to allow\nsymlink challenged systems to use it in contrib/workdir/, we may\nwant to keep the name a bit more generic than \"gitdir: \".\n"},{"id":"67306","messageId":"20080204015707.GH24004@spearce.org","threadId":"11835","inReplyTo":"alpine.LSU.1.00.0802021825220.7372@racer.site","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-02-04T01:57:08Z","receivedAt":"2008-02-04T01:57:08Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> Howver, having .git a file pointing to another git directory allows you to \n> have locks there.  And they can be actually pretty sensible locks, like\n> \n> \t.git/HEAD.<mangled-path>\n> \n> actually containing the symbolic ref describing which branch we're on in \n> that working directory.  Likewise, .git/index.<mangled-path> needs to hold \n> the current index.\n> \n> Of course, for this to work, you need to use different HEADs and indexes \n> only if .git was a file originally.\n> \n> BTW <mangled-path> could be a hash of the path, and for convenience, we \n> could store the path in .git/workdir.<mangled-path>.\n\nThis I like.  Because my day-job coworkers and I make very heavy use of\ngit-new-workdir to manage our compile areas/working directories.  :)\n\nThe biggest problem with new-workdir is the master repository\ncannot see the HEAD, index or logs/HEAD of the working directories.\nConsequently it is possible for prune (or repack -a -d) to remove\nobjects that some workdir is still referring to.  Its not uncommon\nfor my HEAD reflogs to have stale commits in them.  Every once in\na while a user looses their HEAD entirely when it gets pruned away,\nas they had a workdir checked out on a detached HEAD.\n\nThe second biggest problem is checking out the same branch in two\ndifferent directories at once.  This becomes a problem only if you\nmodify the branch, but still, its a problem.\n\n\nI was thinking that we could add a WORKDIR_HASH to the .git file\nLars was proposing.  This hash would be the <mangled-path> suffix\nyou are talking about above, and would avoid the need to compute\nthe absolute path for the working directory every time we run a\nGit command.\n\nThe hash could be something simple, like the SHA-1 hash of the\nabsolute path at the time of workdir creation.  But it would be nice\nif we could recommend a specific value during workdir creation,\nso that the WORKDIR_HASH could start with a value that matches\nsomething the user would readily recognize.\n\n-- \nShawn.\n"},{"id":"67307","messageId":"20080204020032.GI24004@spearce.org","threadId":"11835","inReplyTo":"7vr6fto5oe.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-02-04T02:00:32Z","receivedAt":"2008-02-04T02:00:32Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n> >\n> > I would suggest a slightly different name, \"GIT_DIR: \", as the\n> > line prefix, because the environment variable is also GIT_DIR.\n> >\n> > But that's just me.\n> \n> I think that was modelled after symref HEAD that would point at\n> the real ref with \"ref: refs/heads/master\", as if you have a\n> symlink whose value is \"refs/heads/master\".  So reusing \"ref: \"\n> might be Ok, and saying \"directory: \" or \"gitdir: \" would be\n> also Ok.\n> \n> If we would want to reuse the mechanism in the future to allow\n> symlink challenged systems to use it in contrib/workdir/, we may\n> want to keep the name a bit more generic than \"gitdir: \".\n\nI could easily get behind \"gitdir: \" or \"directory: \".  Both are\nall lowercase, and thus look a lot like \"ref: \", which already has\nbeen in heavy use for quite some time.\n\nBut \"GITDIR: \" isn't very close to GIT_DIR (its environment based\nsister) or \"ref: \" (its file based very-distant cousin).\n\nAs a bike-shed painter I like to keep colors matching when possible.\n\n:-)\n\n-- \nShawn.\n"},{"id":"67314","messageId":"7vk5llmnf6.fsf@gitster.siamese.dyndns.org","threadId":"11835","inReplyTo":"20080204015707.GH24004@spearce.org","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-04T03:05:17Z","receivedAt":"2008-02-04T03:05:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> The second biggest problem is checking out the same branch in two\n> different directories at once.  This becomes a problem only if you\n> modify the branch, but still, its a problem.\n\nI agree.  The biggest benefit I am getting out of the workdir\nlayout is that it allows me to check out the same branch in two\ndirectories, and let me work further on one while the other one\nis compiling and running the testsuite.  The other \"compile and\ntest tree\" needs to be reset with --hard once I commit in the\n\"edit tree\", but by definition \"reset --hard\" is always a safe\noperation in a \"compile and test tree\".\n\nIn short, you need to know what you are doing.\n"},{"id":"67350","messageId":"8c5c35580802040359v1a5d8c42xfbc592245a8917c2@mail.gmail.com","threadId":"11835","inReplyTo":"alpine.LSU.1.00.0802040024030.7372@racer.site","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-02-04T11:59:52Z","receivedAt":"2008-02-04T11:59:52Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On Feb 4, 2008 1:24 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> On Sun, 3 Feb 2008, Junio C Hamano wrote:\n> > For now I haven't picked up any of the \"how about this way\"\n> > revisions.\n>\n> Yeah, I think all my comments have been addressed...  Lars, care to send a\n> new version?\n\nSure, but we should come to a conclusion on \"GITDIR\" vs. \"GIT_DIR\" vs.\n\"gitdir\" vs. \"directory\" vs. \"ref\". The reason I used \"GITDIR\" was to\nkeep the door open for additional parameters in the \"gitfile\" (but it\nshould obviously have been \"GIT_DIR\" for that usage since its value is\nused to specify $GIT_DIR). If it's more likely that we'll use this as\na general substitute for symlinks, I think \"ref\" is better due to the\nexisting symbolic refs.\n\nMy preference would be \"GIT_DIR\" (or \"git_dir\") since we also might\nwant the \"WORKDIR_HASH\" Shawn mentioned.\n\n-- \nlarsh\n"},{"id":"67364","messageId":"alpine.LSU.1.00.0802041434360.7372@racer.site","threadId":"11835","inReplyTo":"7vk5llmnf6.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-04T14:34:59Z","receivedAt":"2008-02-04T14:34:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 3 Feb 2008, Junio C Hamano wrote:\n\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n> \n> > The second biggest problem is checking out the same branch in two \n> > different directories at once.  This becomes a problem only if you \n> > modify the branch, but still, its a problem.\n> \n> I agree.  The biggest benefit I am getting out of the workdir layout is \n> that it allows me to check out the same branch in two directories, and \n> let me work further on one while the other one is compiling and running \n> the testsuite.  The other \"compile and test tree\" needs to be reset with \n> --hard once I commit in the \"edit tree\", but by definition \"reset \n> --hard\" is always a safe operation in a \"compile and test tree\".\n> \n> In short, you need to know what you are doing.\n\nBut that's exactly what you can use throw-away branches for.  I do.\n\nCiao,\nDscho\n"},{"id":"67365","messageId":"alpine.LSU.1.00.0802041436020.7372@racer.site","threadId":"11835","inReplyTo":"8c5c35580802040359v1a5d8c42xfbc592245a8917c2@mail.gmail.com","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-04T14:36:27Z","receivedAt":"2008-02-04T14:36:27Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 4 Feb 2008, Lars Hjemli wrote:\n\n> On Feb 4, 2008 1:24 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > On Sun, 3 Feb 2008, Junio C Hamano wrote:\n> > > For now I haven't picked up any of the \"how about this way\" \n> > > revisions.\n> >\n> > Yeah, I think all my comments have been addressed...  Lars, care to \n> > send a new version?\n> \n> Sure, but we should come to a conclusion on \"GITDIR\" vs. \"GIT_DIR\" vs. \n> \"gitdir\" vs. \"directory\" vs. \"ref\". The reason I used \"GITDIR\" was to \n> keep the door open for additional parameters in the \"gitfile\" (but it \n> should obviously have been \"GIT_DIR\" for that usage since its value is \n> used to specify $GIT_DIR). If it's more likely that we'll use this as a \n> general substitute for symlinks, I think \"ref\" is better due to the \n> existing symbolic refs.\n> \n> My preference would be \"GIT_DIR\" (or \"git_dir\") since we also might want \n> the \"WORKDIR_HASH\" Shawn mentioned.\n\nFWIW I like \"gitdir\" or \"git-dir\" best.\n\nCiao,\nDscho\n"},{"id":"67428","messageId":"47A78104.9050909@nrlssc.navy.mil","threadId":"11835","inReplyTo":"alpine.LSU.1.00.0802021825220.7372@racer.site","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-02-04T21:17:56Z","receivedAt":"2008-02-04T21:17:56Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Johannes Schindelin wrote:\n> Hi,\n> \n> BTW just to tell you why I am so excited with your patch: I have a patch \n> to git-branch in my tree, which implements the git-new-workdir \n> functionality (it's a patch to git-branch, not git-checkout, mainly \n> because git-checkout is no builtin yet).\n\nAre you planning something that works like:\n\n  $ cd <my_repo>\n  $ git branch\n    * master\n      other_branch\n  $ git checkout --new-workdir ../<other_work_dir> other_branch\n\n(not sure how it would work using git-branch).\n\nHave you thought about using git-clone instead?\n\nIt seems a good fit but would require a new option to specify a\nbranch to checkout (which I believe is a requested feature for\nclone). --shared seems like a good option name*, too bad it's\nalready taken. But how about --conjoined to communicate that the new\nrepo and the original repo are \"attached at the hip\"?\n\n  $ git clone --conjoined -b other_branch <my_repo> <other_work_dir>\n\n-brandon\n\n* I really do think \"shared\" is the most appropriate since _both_\n  repos would be sharing, rather than the current meaning or shared which\n  is just a short-hand for --reference and in which the original repo gets\n  nothing from the selfish \"sharer\".\n"},{"id":"67431","messageId":"alpine.LSU.1.00.0802042128170.8543@racer.site","threadId":"11835","inReplyTo":"47A78104.9050909@nrlssc.navy.mil","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-04T21:31:06Z","receivedAt":"2008-02-04T21:31:06Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 4 Feb 2008, Brandon Casey wrote:\n\n> Johannes Schindelin wrote:\n> \n> > BTW just to tell you why I am so excited with your patch: I have a \n> > patch to git-branch in my tree, which implements the git-new-workdir \n> > functionality (it's a patch to git-branch, not git-checkout, mainly \n> > because git-checkout is no builtin yet).\n> \n> Are you planning something that works like:\n> \n>   $ cd <my_repo>\n>   $ git branch\n>     * master\n>       other_branch\n>   $ git checkout --new-workdir ../<other_work_dir> other_branch\n> \n> (not sure how it would work using git-branch).\n\nSomething like this, yes.  In my local version of git, you can say \"git \nbranch --new-workdir=../bla new-branch [branch-point]\".\n\n> Have you thought about using git-clone instead?\n\nBriefly.  But this is not about cloning the repository.  It is about \nhaving an additional working directory for the current repository.\n\n> It seems a good fit but would require a new option to specify a branch \n> to checkout (which I believe is a requested feature for clone).\n\nIt is an often-requested feature for clone, but we have \"clone -n\" for \nnow, and nobody seemed to care deeply enough to actually do something \nabout it.\n\nBut really, clone is something different.  I _want_ the original \nrepository to know that there is another working directory.\n\nCiao,\nDscho\n"},{"id":"67435","messageId":"47A78CF9.6040001@nrlssc.navy.mil","threadId":"11835","inReplyTo":"alpine.LSU.1.00.0802042128170.8543@racer.site","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-02-04T22:08:57Z","receivedAt":"2008-02-04T22:08:57Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Johannes Schindelin wrote:\n> Hi,\n> \n> On Mon, 4 Feb 2008, Brandon Casey wrote:\n\n> In my local version of git, you can say \"git \n> branch --new-workdir=../bla new-branch [branch-point]\".\n\nAh, I see, you are creating a new branch too.\n\n>> Have you thought about using git-clone instead?\n> \n> Briefly.  But this is not about cloning the repository.  It is about \n> having an additional working directory for the current repository.\n\nI think that is true at the low level, but from a high level it feels\nsimilar to me.\n\nAfter your \"git branch --new-workdir=...\" you have something that acts\nexactly like a full-fledged repository. It is very much dependent on\nthe original repo, similarly to how a --shared repo is, and it now\nhas new semantics in that operations within the new repo have an effect\nin the original repo (and vice-versa). Making new repositories from\nexisting repositories is what git-clone does.\n\n  git-branch: makes new branches, or generally handles modifying branches.\ngit-checkout: modifies the contents of the working directory.\n   git-clone: makes new repositories from existing repositories.\n\nAlso, of the three, git-clone is the only one allowed to operate outside\nof the repo. The other two are required to be called from within a repo\n(or have GIT_DIR set), and currently only modify data within that repo.\nSo, allowing them to have an effect outside of the repo would extend\ntheir current scope of operation.\n\n>> It seems a good fit but would require a new option to specify a branch \n>> to checkout (which I believe is a requested feature for clone).\n> \n> It is an often-requested feature for clone, but we have \"clone -n\" for \n> now, and nobody seemed to care deeply enough to actually do something \n> about it.\n\nI'll probably do it if it is not beyond me.\n\n> I _want_ the original \n> repository to know that there is another working directory.\n\nYes, your ideas are much better than simply adding the functionality of\nthe git-new-workdir script (which is what I was planning on doing btw :)\n\n-brandon\n"},{"id":"67437","messageId":"alpine.LSU.1.00.0802042218280.8543@racer.site","threadId":"11835","inReplyTo":"47A78CF9.6040001@nrlssc.navy.mil","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-04T22:19:37Z","receivedAt":"2008-02-04T22:19:37Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 4 Feb 2008, Brandon Casey wrote:\n\n> Johannes Schindelin wrote:\n> > \n> > On Mon, 4 Feb 2008, Brandon Casey wrote:\n> \n> >> Have you thought about using git-clone instead?\n> > \n> > Briefly.  But this is not about cloning the repository.  It is about \n> > having an additional working directory for the current repository.\n> \n> I think that is true at the low level, but from a high level it feels \n> similar to me.\n> \n> [...]\n> \n> > I _want_ the original repository to know that there is another working \n> > directory.\n> \n> Yes, your ideas are much better than simply adding the functionality of \n> the git-new-workdir script (which is what I was planning on doing btw :)\n\nSomehow these two statements do not work together.  Either you have a \nclone, or you accept that a new working directory is actually working on \nthe _same_ repository.\n\nCiao,\nDscho\n"},{"id":"67443","messageId":"47A79541.6070900@nrlssc.navy.mil","threadId":"11835","inReplyTo":"alpine.LSU.1.00.0802042218280.8543@racer.site","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-02-04T22:44:17Z","receivedAt":"2008-02-04T22:44:17Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Johannes Schindelin wrote:\n> Hi,\n> \n> On Mon, 4 Feb 2008, Brandon Casey wrote:\n> \n>> Johannes Schindelin wrote:\n>>> On Mon, 4 Feb 2008, Brandon Casey wrote:\n>>>> Have you thought about using git-clone instead?\n>>> Briefly.  But this is not about cloning the repository.  It is about \n>>> having an additional working directory for the current repository.\n>> I think that is true at the low level, but from a high level it feels \n>> similar to me.\n>>\n>> [...]\n>>\n>>> I _want_ the original repository to know that there is another working \n>>> directory.\n>> Yes, your ideas are much better than simply adding the functionality of \n>> the git-new-workdir script (which is what I was planning on doing btw :)\n> \n> Somehow these two statements do not work together.  Either you have a \n> clone, or you accept that a new working directory is actually working on \n> the _same_ repository.\n\nWhen we talk about clones we are not always talking about a strict \"full\"\nclone. We have at least:\n\n\t1) Full clone repository (with/without hardlinks, each is completely\n\t   independent)\n\t2) --shared/--reference (dependent on original repo, fragile)\n\t3) shallow repository (mostly independent)\n\nIf your statement above is rephrased to \"I _want_ the original repository to\nknow that it has conjoined siblings.\", then we have a new repository type:\n\n\t4) conjoined repository (it has multiple sibling repositories each\n\t   with their own working directory, but they all share and modify the\n\t   same .git directory)\n\n-brandon\n"},{"id":"67445","messageId":"47A79820.50405@nrlssc.navy.mil","threadId":"11835","inReplyTo":"47A79541.6070900@nrlssc.navy.mil","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-02-04T22:56:32Z","receivedAt":"2008-02-04T22:56:32Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Brandon Casey wrote:\n> Johannes Schindelin wrote:\n\n> If your statement above is rephrased to \"I _want_ the original repository to\n> know that it has conjoined siblings.\", then we have a new repository type:\n> \n> \t4) conjoined repository (it has multiple sibling repositories each\n> \t   with their own working directory, but they all share and modify the\n> \t   same .git directory)\n\nBy the way, none of the repositories has to \"own\" the .git directory. This is\nmade much easier by Lars's new changes. All of the repos could contain a\n.git symlink file which points to some other directory.\n\nI'm not saying this would be the common case, just with the .git directory\nnot residing within _any_ of the repositories/work-dirs it really blurs any\ndifference between them. They would all be equals, even though some may have\nbeen created _from_ the others. (if that makes sense)\n\n-brandon\n"},{"id":"67459","messageId":"alpine.LSU.1.00.0802050047340.8543@racer.site","threadId":"11835","inReplyTo":"47A79541.6070900@nrlssc.navy.mil","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-05T00:49:36Z","receivedAt":"2008-02-05T00:49:36Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 4 Feb 2008, Brandon Casey wrote:\n\n> When we talk about clones we are not always talking about a strict \n> \"full\" clone.\n\nHere, sir, we disagree.  I tend to like the fact that a clone is a clone \nis a clone.  Which BTW is the reason why I do not like requests to \"clone\" \nonly one branch: this is not a clone.\n\n> If your statement above is rephrased to \"I _want_ the original \n> repository to know that it has conjoined siblings.\", then we have a new \n> repository type:\n> \n> \t4) conjoined repository (it has multiple sibling repositories each\n> \t   with their own working directory, but they all share and modify the\n> \t   same .git directory)\n\nNo.  The repository does not even need a working directory (in which case \nwe call it \"bare\").  Up until now, it _can_ have _one_ working directory.  \nWith my plans, it can have more than one.\n\nCiao,\nDscho\n"},{"id":"67460","messageId":"alpine.LSU.1.00.0802050049420.8543@racer.site","threadId":"11835","inReplyTo":"47A79820.50405@nrlssc.navy.mil","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-05T00:51:12Z","receivedAt":"2008-02-05T00:51:12Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 4 Feb 2008, Brandon Casey wrote:\n\n> By the way, none of the repositories has to \"own\" the .git directory. \n> This is made much easier by Lars's new changes. All of the repos could \n> contain a .git symlink file which points to some other directory.\n\nFirst, the repository _is_ the .git directory.  Second, we already had \nGIT_DIR and --git-dir, which made it as easy...\n\nCiao,\nDscho\n \n"},{"id":"67471","messageId":"47A7CD29.40306@nrlssc.navy.mil","threadId":"11835","inReplyTo":"alpine.LSU.1.00.0802050047340.8543@racer.site","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-02-05T02:42:49Z","receivedAt":"2008-02-05T02:42:49Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Johannes Schindelin wrote:\n> Hi,\n> \n> On Mon, 4 Feb 2008, Brandon Casey wrote:\n> \n>> When we talk about clones we are not always talking about a strict \n>> \"full\" clone.\n> \n> Here, sir, we disagree.  I tend to like the fact that a clone is a clone \n> is a clone.  Which BTW is the reason why I do not like requests to \"clone\" \n> only one branch: this is not a clone.\n\nIt seems the git-clone utility has been extended to create more than just\nclones in that case.\n\nMy use of the term \"clone\" with respect to git, is to refer to the product\nof the git-clone utility. With that in mind, git-clone produces all of the\nrepo/work-dir combinations I described.\n\nThe strict (or precise) definition of \"clone\" seems like a subset of the\nmore generic \"create new repository/workdir from existing repository\". The\ndifferent options then allow you to control how the new repo/workdir is\nstructured.\n\nWe don't currently have a generic \"create new repository/workdir from\nexisting repository\" command. So people have been using git-clone to\ncreate new repository/workdir's and calling the result clones, even\nthough they could have produced the same result by running some sequence\nof mkdir, git init, and git pull.\n\n>> If your statement above is rephrased to \"I _want_ the original \n>> repository to know that it has conjoined siblings.\", then we have a new \n>> repository type:\n>>\n>> \t4) conjoined repository (it has multiple sibling repositories each\n>> \t   with their own working directory, but they all share and modify the\n>> \t   same .git directory)\n> \n> No.  The repository does not even need a working directory (in which case \n> we call it \"bare\").\n\nThe additional term \"bare\" that is used with such a repository without a\nworking directory implies to me that this is a \"special\" or \"uncommon\"\nrepository configuration.\n\nI think in many places in the documentation and it seems in common use on\nthe mailing list, the contents of the directory created by git-clone is\ninformally referred to as the repository. This is even though most people\nunderstand that the precise definition of repository is the .git directory\nand the rest of the contents are the working directory.\n\nSo I hope you excuse me for referring to the result of git-clone as a\nrepository. I'll try to think of something else to call it (above I used\nrepo/workdir).\n\nNone of that changes my opinion that a descent model for the user interface\nis to have two high-level commands that create repo/workdir's.\n\n     git-init: creates a new repo/workdir from scratch.\n    git-clone: creates a new repo/workdir from an existing repository.\n\nOr the opinion that git-clone is a closer operation to creating a new working\ndirectory and associating it with a repository than either git-branch or\ngit-checkout, which in normal usage (i.e. _not_ setting GIT_DIR or using\n--git-dir) operate within a working directory.\n\nWith that, I think I have described my thinking well enough, so I won't continue\nany more unless you really ask a question.\n\n>  Up until now, it _can_ have _one_ working directory.  \n> With my plans, it can have more than one.\n\nI'm looking forward to your plans, since I find the git-new-workdir script very\nuseful.\n\n-brandon\n"},{"id":"67508","messageId":"alpine.LSU.1.00.0802051256080.8543@racer.site","threadId":"11835","inReplyTo":"47A7CD29.40306@nrlssc.navy.mil","subject":"Re: [PATCH] Add platform-independent .git \"symlink\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-05T12:57:54Z","receivedAt":"2008-02-05T12:57:54Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 4 Feb 2008, Brandon Casey wrote:\n\n> Johannes Schindelin wrote:\n> \n> > On Mon, 4 Feb 2008, Brandon Casey wrote:\n> > \n> >> If your statement above is rephrased to \"I _want_ the original \n> >> repository to know that it has conjoined siblings.\", then we have a \n> >> new repository type:\n> >>\n> >> \t4) conjoined repository (it has multiple sibling repositories each\n> >> \t   with their own working directory, but they all share and modify the\n> >> \t   same .git directory)\n> > \n> > No.  The repository does not even need a working directory (in which case \n> > we call it \"bare\").\n> \n> The additional term \"bare\" that is used with such a repository without a \n> working directory implies to me that this is a \"special\" or \"uncommon\" \n> repository configuration.\n\nBy the same reasoning, a \"good day\" would be a \"special\" or \"uncommon\" \nday.\n\n> So I hope you excuse me for referring to the result of git-clone as a \n> repository. I'll try to think of something else to call it (above I used \n> repo/workdir).\n\nBut that's what I am saying: a git-clone clones a repository.  If you \nhappen to clone without the \"--bare\" option, it will additionally create a \nworking directory.\n\nHth,\nDscho\n"}]}