{"thread":{"id":"26647","subject":"[PATCH/RFC] init, clone: support --real-git-dir for .git file","startedAt":"2011-03-03T12:43:21Z","lastAt":"2011-03-04T18:41:59Z","messageCount":15,"participants":["Nguyễn Thái Ngọc Duy","Piotr Krukowiecki","Junio C Hamano","Miles Bader","Nguyen Thai Ngoc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"162719","messageId":"1299156201-12149-1-git-send-email-pclouds@gmail.com","threadId":"26647","inReplyTo":null,"subject":"[PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-03-03T12:43:21Z","receivedAt":"2011-03-03T12:43:21Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Instead of creating the repository at $GIT_DIR, --real-git-dir will\ntell git to put the repository there, then make $GIT_DIR a .git file\nthat points to --real-git-dir.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n This makes '.git symbolic link' (what's its official name?) more\n convenient to use. Previously whenever I need to create a .git link,\n I need to open docs to see its format. Now all I need to do is\n\n  git init --real-git-dir=/where/real/git/is\n  git clone --real-git-dir=/where/real/git/is something\n\n I intend to make 'git init --real-git-dir' move current repo to\n somewhere else if called on existing repo.\n\n Long term I'd like to see a init/clone hook, where I can tell git\n \"when I ask you to create a repo/worktree at foo, put the real repo\n at ~/git/foo\"\n\n I could use a better option name too, any suggestions?\n\n builtin/clone.c   |    7 ++++++-\n builtin/init-db.c |   38 +++++++++++++++++++++++++++++++++++++-\n cache.h           |    1 +\n 3 files changed, 44 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 60d9a64..74e487a 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -42,6 +42,7 @@ static int option_local, option_no_hardlinks, option_shared, option_recursive;\n static char *option_template, *option_reference, *option_depth;\n static char *option_origin = NULL;\n static char *option_branch = NULL;\n+static const char *real_git_dir;\n static char *option_upload_pack = \"git-upload-pack\";\n static int option_verbosity;\n static int option_progress;\n@@ -80,6 +81,8 @@ static struct option builtin_clone_options[] = {\n \t\t   \"path to git-upload-pack on the remote\"),\n \tOPT_STRING(0, \"depth\", &option_depth, \"depth\",\n \t\t    \"create a shallow clone of that depth\"),\n+\tOPT_STRING(0, \"real-git-dir\", &real_git_dir, \"git-dir\",\n+\t\t   \"directory where real repository is cloned to\"),\n \n \tOPT_END()\n };\n@@ -466,7 +469,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \n \tif (safe_create_leading_directories_const(git_dir) < 0)\n \t\tdie(\"could not create leading directories of '%s'\", git_dir);\n-\tset_git_dir(make_absolute_path(git_dir));\n+\tset_git_dir_init(git_dir, real_git_dir);\n+\tif (real_git_dir)\n+\t\tgit_dir = real_git_dir;\n \n \tif (0 <= option_verbosity)\n \t\tprintf(\"Cloning into %s%s...\\n\",\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex fbeb380..7a0fb50 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -21,6 +21,7 @@\n static int init_is_bare_repository = 0;\n static int init_shared_repository = -1;\n static const char *init_db_template_dir;\n+static const char *git_link;\n \n static void safe_create_dir(const char *dir, int share)\n {\n@@ -311,10 +312,42 @@ static void create_object_directory(void)\n \tfree(path);\n }\n \n+int set_git_dir_init(const char *git_dir, const char *real_git_dir)\n+{\n+\tif (real_git_dir) {\n+\t\tstruct stat st;\n+\n+\t\tif (!stat(git_dir, &st))\n+\t\t\tdie(\"%s already exists\", git_dir);\n+\t\tgit_link = git_dir;\n+\t}\n+\telse {\n+\t\treal_git_dir = git_dir;\n+\t\tgit_link = NULL;\n+\t}\n+\tset_git_dir(make_absolute_path(real_git_dir));\n+\treturn 0;\n+}\n+\n int init_db(const char *template_dir, unsigned int flags)\n {\n \tint reinit;\n \n+\tif (git_link) {\n+\t\tstruct stat st;\n+\t\tFILE *fp;\n+\n+\t\t/* TODO: allow --real-git-dir to move repo elsewhere */\n+\t\tif (!lstat(git_link, &st))\n+\t\t\tdie(\"%s already exists\", git_link);\n+\n+\t\tfp = fopen(git_link, \"w\");\n+\t\tif (!fp)\n+\t\t\tdie(\"Could not create git link %s\", git_link);\n+\t\tfprintf(fp, \"gitdir: %s\\n\", get_git_dir());\n+\t\tfclose(fp);\n+\t}\n+\n \tsafe_create_dir(get_git_dir(), 0);\n \n \tinit_is_bare_repository = is_bare_repository();\n@@ -414,6 +447,7 @@ static const char *const init_db_usage[] = {\n int cmd_init_db(int argc, const char **argv, const char *prefix)\n {\n \tconst char *git_dir;\n+\tconst char *real_git_dir = NULL;\n \tconst char *work_tree;\n \tconst char *template_dir = NULL;\n \tunsigned int flags = 0;\n@@ -427,6 +461,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \t\t\t\"specify that the git repository is to be shared amongst several users\",\n \t\t\tPARSE_OPT_OPTARG | PARSE_OPT_NONEG, shared_callback, 0},\n \t\tOPT_BIT('q', \"quiet\", &flags, \"be quiet\", INIT_DB_QUIET),\n+\t\tOPT_STRING(0, \"real-git-dir\", &real_git_dir, \"git-dir\",\n+\t\t\t   \"directory where real .git is initialized\"),\n \t\tOPT_END()\n \t};\n \n@@ -522,7 +558,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \t\t\tset_git_work_tree(make_absolute_path(work_tree));\n \t}\n \n-\tset_git_dir(make_absolute_path(git_dir));\n+\tset_git_dir_init(git_dir, real_git_dir);\n \n \treturn init_db(template_dir, flags);\n }\ndiff --git a/cache.h b/cache.h\nindex 08a9022..0b006b8 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -436,6 +436,7 @@ extern void verify_non_filename(const char *prefix, const char *name);\n \n #define INIT_DB_QUIET 0x0001\n \n+extern int set_git_dir_init(const char *git_dir, const char *real_git_dir);\n extern int init_db(const char *template_dir, unsigned int flags);\n \n #define alloc_nr(x) (((x)+16)*3/2)\n-- \n1.7.4.74.g639db\n"},{"id":"162737","messageId":"4D700469.7090807@gmail.com","threadId":"26647","inReplyTo":"1299156201-12149-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Piotr Krukowiecki","fromEmail":"piotr.krukowiecki@gmail.com","sentAt":"2011-03-03T21:13:13Z","receivedAt":"2011-03-03T21:13:13Z","isPatch":true,"sender":{"key":"piotr.krukowiecki@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3259959?v=4"},"body":"W dniu 03.03.2011 13:43, Nguyễn Thái Ngọc Duy pisze:\n> Instead of creating the repository at $GIT_DIR, --real-git-dir will\n> tell git to put the repository there, then make $GIT_DIR a .git file\n> that points to --real-git-dir.\n> \n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  This makes '.git symbolic link' (what's its official name?) more\n>  convenient to use. Previously whenever I need to create a .git link,\n>  I need to open docs to see its format. Now all I need to do is\n\nTook me a while to find documentation for .git file format. Probably my\nfault, missed the gitrepository-layout link.\n\nAnyway, tried following:\n   $ echo path > .git\n   $ git info\n   fatal: Invalid gitfile format: .git\n\nMaybe one solution is to improve the message - patch attached:\n   $ git info\n   fatal: Invalid gitfile format: .git\n   Use gitdir: <PATH>\n\n \n>   git init --real-git-dir=/where/real/git/is\n>   git clone --real-git-dir=/where/real/git/is something\n> \n>  I intend to make 'git init --real-git-dir' move current repo to\n>  somewhere else if called on existing repo.\n> \n>  Long term I'd like to see a init/clone hook, where I can tell git\n>  \"when I ask you to create a repo/worktree at foo, put the real repo\n>  at ~/git/foo\"\n\nIs this needed? As I understand\n    git init --real-git-dir=/where/real/git/is\n\nshould do the same as\n    git --git-dir=/where/real/git/is && \\\n    echo \"gitdir: /where/real/git/is\" > ${GIT_DIR:-.git} \n\nThe other actions seems to be similarly simple.\n\n\n>  I could use a better option name too, any suggestions?\n\nI don't understand why is this needed. It's a bit complicated at first as well.\nAdds extra layer to already existing .gitdir/.gitfile/GIT_DIR/--git-dir\n\n\n---8<---\nFrom e83caf00dc007b9a2e515bb718f0d9ddb080891e Mon Sep 17 00:00:00 2001\nFrom: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>\nDate: Thu, 3 Mar 2011 21:51:34 +0100\nSubject: [PATCH] Improve error message when gitfile has wrong format\n\nAdd information what format of .git file is expected.\n\nSigned-off-by: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>\n---\n setup.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 021d013..d2d9d0b 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -291,7 +291,7 @@ const char *read_gitfile_gently(const char *path)\n \t\tdie(\"Error reading %s\", path);\n \tbuf[len] = '\\0';\n \tif (prefixcmp(buf, \"gitdir: \"))\n-\t\tdie(\"Invalid gitfile format: %s\", path);\n+\t\tdie(\"Invalid gitfile format: %s\\nUse gitdir: <PATH>\", path);\n \twhile (buf[len - 1] == '\\n' || buf[len - 1] == '\\r')\n \t\tlen--;\n \tif (len < 9)\n-- \n1.7.1\n\n\n-- \nPiotr Krukowiecki\n"},{"id":"162742","messageId":"7vhbbj93yb.fsf@alter.siamese.dyndns.org","threadId":"26647","inReplyTo":"4D700469.7090807@gmail.com","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-03T23:31:08Z","receivedAt":"2011-03-03T23:31:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:\n\n> From: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>\n> Date: Thu, 3 Mar 2011 21:51:34 +0100\n> Subject: [PATCH] Improve error message when gitfile has wrong format\n>\n> Add information what format of .git file is expected.\n\nDon't do this.  We don't want to _add_ places that needs to be updated\nwhen we need to update our internal implementation.\n"},{"id":"162743","messageId":"7v8vwv927a.fsf@alter.siamese.dyndns.org","threadId":"26647","inReplyTo":"1299156201-12149-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-04T00:08:57Z","receivedAt":"2011-03-04T00:08:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n\n> Instead of creating the repository at $GIT_DIR, --real-git-dir will\n> tell git to put the repository there, then make $GIT_DIR a .git file\n> that points to --real-git-dir.\n\nJust like you, I am also bad at naming things, so I cannot offhand suggest\na better name, even though I _know_ --real-git-dir sounds horrible.\n\nThe naming aside, the feature is what we have wanted to have for a long\ntime and is way overdue.  Thanks for showing how small-impact the\nnecessary changes are.\n\n\"submodule init subpro\" should be able to use this to clone a submodule\nwith:\n\n\tgit clone --xxx=.git/modules/subpro.git subpro\n\nWhen we need to switch to a revision without that submodule, after making\nsure that there is no precious file in subpro/ directory, we would:\n\n\trm -rf subpro/\n\nNow, what do we need to switch back to a revision with that submodule?  It\nwould involve something like this:\n\n\t... after checking if we already have .git/modules/subpro.git\n        ... and seeing that we do ...\n\n\tmkdir subpro\n\tcommit=$(git rev-parse :subpro)\n        echo 'gitdir: ../.git/modules/subpro.git' >subpro/.git\n\tcd subpro && git checkout $commit^0\n\nThe above four lines packaged for \"git submodule\" script would be a useful\nthing to have, especially because then nobody has to write the \"echo\" part.\n\n>  I intend to make 'git init --real-git-dir' move current repo to\n>  somewhere else if called on existing repo.\n\nI don't know if that is useful in real life.  Do you have a concrete use\ncase (like the one I showed an example above) in mind?\n"},{"id":"162751","messageId":"buozkpb8qvn.fsf@dhlpc061.dev.necel.com","threadId":"26647","inReplyTo":"7v8vwv927a.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2011-03-04T04:13:32Z","receivedAt":"2011-03-04T04:13:32Z","isPatch":true,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n>> Instead of creating the repository at $GIT_DIR, --real-git-dir will\n>> tell git to put the repository there, then make $GIT_DIR a .git file\n>> that points to --real-git-dir.\n>\n> Just like you, I am also bad at naming things, so I cannot offhand suggest\n> a better name, even though I _know_ --real-git-dir sounds horrible.\n\n--separate-git-dir  ?\n\n[Terms like \"separate source dir\" and \"separate build dir\" seems to be\ncommon when talking about build systems, and it seems a somewhat\nsimilar situation -- separation of usually co-located information.]\n\n-miles\n\n-- \nIt wasn't the Exxon Valdez captain's driving that caused the Alaskan oil spill.\nIt was yours.  [Greenpeace advertisement, New York Times, 25 February 1990]\n"},{"id":"162752","messageId":"AANLkTikaD5oxx2bwx0R3x_1p1KnfBFqJJ2xtNiWW4-SC@mail.gmail.com","threadId":"26647","inReplyTo":"4D700469.7090807@gmail.com","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-03-04T04:19:06Z","receivedAt":"2011-03-04T04:19:06Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/3/4 Piotr Krukowiecki <piotr.krukowiecki@gmail.com>:\n>>  This makes '.git symbolic link' (what's its official name?) more\n>>  convenient to use. Previously whenever I need to create a .git link,\n>>  I need to open docs to see its format. Now all I need to do is\n>\n> Took me a while to find documentation for .git file format. Probably my\n> fault, missed the gitrepository-layout link.\n\nExactly why I wrote this patch. I do remember there is a prefix before\nthe path, but what is it? gitdir: or git-dir: or dir:? No I don't want\nto look at the document every time I need to create a link. Trial and\nerror is not preferred either. Also manual manipulation on repos\nshould be avoided if possible.\n-- \nDuy\n"},{"id":"162753","messageId":"AANLkTimG7Hg4YxJbMVaXVkZ1CRb0ttK6RAYEoRQ_4iW4@mail.gmail.com","threadId":"26647","inReplyTo":"7v8vwv927a.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-03-04T04:23:18Z","receivedAt":"2011-03-04T04:23:18Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/3/4 Junio C Hamano <gitster@pobox.com>:\n>>  I intend to make 'git init --real-git-dir' move current repo to\n>>  somewhere else if called on existing repo.\n>\n> I don't know if that is useful in real life.  Do you have a concrete use\n> case (like the one I showed an example above) in mind?\n\nMoving .git away from existing repos/worktrees I have.\n-- \nDuy\n"},{"id":"162754","messageId":"AANLkTik3A3x=L-nuXrnmp6Zpxs+AB2ig2zY4KxJpUFBf@mail.gmail.com","threadId":"26647","inReplyTo":"buozkpb8qvn.fsf@dhlpc061.dev.necel.com","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-03-04T04:33:13Z","receivedAt":"2011-03-04T04:33:13Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/3/4 Miles Bader <miles@gnu.org>:\n> Junio C Hamano <gitster@pobox.com> writes:\n>>> Instead of creating the repository at $GIT_DIR, --real-git-dir will\n>>> tell git to put the repository there, then make $GIT_DIR a .git file\n>>> that points to --real-git-dir.\n>>\n>> Just like you, I am also bad at naming things, so I cannot offhand suggest\n>> a better name, even though I _know_ --real-git-dir sounds horrible.\n>\n> --separate-git-dir  ?\n>\n> [Terms like \"separate source dir\" and \"separate build dir\" seems to be\n> common when talking about build systems, and it seems a somewhat\n> similar situation -- separation of usually co-located information.]\n\nSounds good.\n-- \nDuy\n"},{"id":"162755","messageId":"7v4o7j8lxg.fsf@alter.siamese.dyndns.org","threadId":"26647","inReplyTo":"AANLkTimG7Hg4YxJbMVaXVkZ1CRb0ttK6RAYEoRQ_4iW4@mail.gmail.com","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-04T06:00:27Z","receivedAt":"2011-03-04T06:00:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n\n> Moving .git away from existing repos/worktrees I have.\n\nYou are only saying you want to move it, not saying why you want to move\nit.\n\nThat is not an explanation _why_ it is useful to be able to do so.\n"},{"id":"162756","messageId":"AANLkTik3+g10ihwc4wZK0bFBKr0TMBF9M5BtzW_O1vBA@mail.gmail.com","threadId":"26647","inReplyTo":"7v4o7j8lxg.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-03-04T06:39:39Z","receivedAt":"2011-03-04T06:39:39Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Mar 4, 2011 at 1:00 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n>\n>> Moving .git away from existing repos/worktrees I have.\n>\n> You are only saying you want to move it, not saying why you want to move\n> it.\n>\n> That is not an explanation _why_ it is useful to be able to do so.\n\nThe same reason why I don't want to place .git close to worktree in\nthe first place (paranoid, throwaway worktree, disk constraint...). If\nI'm going to make a policy that \"there must be no .git under ~/w\", new\nrepos with --real-git-dir are ok, but what about old repos?\n-- \nDuy\n"},{"id":"162757","messageId":"buoaahb8jb3.fsf@dhlpc061.dev.necel.com","threadId":"26647","inReplyTo":"7v4o7j8lxg.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2011-03-04T06:57:04Z","receivedAt":"2011-03-04T06:57:04Z","isPatch":true,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n> You are only saying you want to move it, not saying why you want to move\n> it.\n>\n> That is not an explanation _why_ it is useful to be able to do so.\n\nHmm, one scenario would be when you want to \"manage\" a work tree using a\nrelatively-passive tool that might barf over the contents (large, weird,\nfiles...) of a .git dir.  E.g., eclipse or something (well I guess\neclipse might actually have direct git support these days, but you get\nthe idea).\n\n-Miles\n\n-- \nPoliteness, n. The most acceptable hypocrisy.\n"},{"id":"162758","messageId":"AANLkTin8Gnbyji4sz6cnWLcAzC2RAS_wnd_o3avDvsvG@mail.gmail.com","threadId":"26647","inReplyTo":"7vhbbj93yb.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Piotr Krukowiecki","fromEmail":"piotr.krukowiecki@gmail.com","sentAt":"2011-03-04T07:41:50Z","receivedAt":"2011-03-04T07:41:50Z","isPatch":true,"sender":{"key":"piotr.krukowiecki@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3259959?v=4"},"body":"2011/3/4 Junio C Hamano <gitster@pobox.com>:\n> Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:\n>\n>> From: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>\n>> Date: Thu, 3 Mar 2011 21:51:34 +0100\n>> Subject: [PATCH] Improve error message when gitfile has wrong format\n>>\n>> Add information what format of .git file is expected.\n>\n> Don't do this.  We don't want to _add_ places that needs to be updated\n> when we need to update our internal implementation.\n\nI thought it was user-level file, like $GIT_DIR\n\nI'm not into data duplication, but in this case the message is next to the\nprevious use:\n\n       if (prefixcmp(buf, \"gitdir: \"))\n               die(\"Invalid gitfile format: %s\\nUse gitdir: <PATH>\", path);\n\n\nBTW I think it might be enough to have just path in the .git file. If\n.git has path\nto a correct git repo then chances it's coincidence are quite low.\n(The format does not matter if it's internal file of course)\n\n-- \nPiotrek\n"},{"id":"162764","messageId":"AANLkTiksQg1U=uAEVJG8fyjd7HpsTqgBOdyh6wrEMSED@mail.gmail.com","threadId":"26647","inReplyTo":"AANLkTin8Gnbyji4sz6cnWLcAzC2RAS_wnd_o3avDvsvG@mail.gmail.com","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-03-04T12:26:16Z","receivedAt":"2011-03-04T12:26:16Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/3/4 Piotr Krukowiecki <piotr.krukowiecki@gmail.com>:\n> I thought it was user-level file, like $GIT_DIR\n>\n> I'm not into data duplication, but in this case the message is next to the\n> previous use:\n>\n>       if (prefixcmp(buf, \"gitdir: \"))\n>               die(\"Invalid gitfile format: %s\\nUse gitdir: <PATH>\", path);\n>\n>\n> BTW I think it might be enough to have just path in the .git file. If\n> .git has path\n> to a correct git repo then chances it's coincidence are quite low.\n> (The format does not matter if it's internal file of course)\n\nIt's actually good that path is prefixed by gitdir. I imagine once\nsuperproject is supported, .git file in subprojects will have another\nline\n\nsupergitdir: /path/to/superproject\n-- \nDuy\n"},{"id":"162782","messageId":"AANLkTinQCZXYAbndLuRVVEr6NTRA8aaypFfvtqNjknLQ@mail.gmail.com","threadId":"26647","inReplyTo":"AANLkTiksQg1U=uAEVJG8fyjd7HpsTqgBOdyh6wrEMSED@mail.gmail.com","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Piotr Krukowiecki","fromEmail":"piotr.krukowiecki@gmail.com","sentAt":"2011-03-04T18:09:21Z","receivedAt":"2011-03-04T18:09:21Z","isPatch":true,"sender":{"key":"piotr.krukowiecki@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3259959?v=4"},"body":"On Fri, Mar 4, 2011 at 1:26 PM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> 2011/3/4 Piotr Krukowiecki <piotr.krukowiecki@gmail.com>:\n>> I thought it was user-level file, like $GIT_DIR\n>>\n>> I'm not into data duplication, but in this case the message is next to the\n>> previous use:\n>>\n>>       if (prefixcmp(buf, \"gitdir: \"))\n>>               die(\"Invalid gitfile format: %s\\nUse gitdir: <PATH>\", path);\n>>\n>>\n>> BTW I think it might be enough to have just path in the .git file. If\n>> .git has path\n>> to a correct git repo then chances it's coincidence are quite low.\n>> (The format does not matter if it's internal file of course)\n>\n> It's actually good that path is prefixed by gitdir. I imagine once\n> superproject is supported, .git file in subprojects will have another\n> line\n>\n> supergitdir: /path/to/superproject\n\nWhy would it be better than keeping this information under .git/, in config\nor other specific file?\n\n\n\n-- \nPiotrek\n"},{"id":"162785","messageId":"7vaaha7mo8.fsf@alter.siamese.dyndns.org","threadId":"26647","inReplyTo":"AANLkTiksQg1U=uAEVJG8fyjd7HpsTqgBOdyh6wrEMSED@mail.gmail.com","subject":"Re: [PATCH/RFC] init, clone: support --real-git-dir for .git file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-04T18:41:59Z","receivedAt":"2011-03-04T18:41:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n\n> It's actually good that path is prefixed by gitdir. I imagine once\n> superproject is supported, .git file in subprojects will have another\n> line\n>\n> supergitdir: /path/to/superproject\n\nNo.  On a platform with usable symbolic links, you should also be able to\nsolve \"this version of the superproject has the submodule, but that\nversion does not, and we checkout the other version\" with symlinking .git\nwithout using a gitdir file at all, just like we can use .git/HEAD symlink\nto denote the current branch.\n\nAlso, gitdir file is not for sole consumption of the submodule feature.\nKeep separate things separate, and don't try to tie unrelated concepts\ntogether.\n"}]}