{"thread":{"id":"10609","subject":"[PATCH] Add missing inside_work_tree setting in setup_git_directory_gently","startedAt":"2007-11-03T10:03:23Z","lastAt":"2007-11-09T11:34:07Z","messageCount":11,"participants":["Nguyễn Thái Ngọc Duy","Johannes Schindelin","Junio C Hamano","Nguyen Thai Ngoc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"58090","messageId":"20071103100323.GA25305@laptop","threadId":"10609","inReplyTo":null,"subject":"[PATCH] Add missing inside_work_tree setting in setup_git_directory_gently","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2007-11-03T10:03:23Z","receivedAt":"2007-11-03T10:03:23Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Without this, work_tree handling code in setup_git_directory\nwill be activated. If you stay in root work tree (no prefix),\nit does not harm. It does if you work from a subdirectory though.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Turns out my patch on NEED_WORK_TREE is fixing a wrong place.\n\n setup.c |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 145eca5..6f8f769 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -240,6 +240,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t\t\tif (chdir(work_tree_env) < 0)\n \t\t\t\tdie (\"Could not chdir to %s\", work_tree_env);\n \t\t\tstrcat(buffer, \"/\");\n+\t\t\tinside_work_tree = 1;\n \t\t\treturn retval;\n \t\t}\n \t\tif (nongit_ok) {\n-- \n1.5.3.rc4.3.gab089\n"},{"id":"58102","messageId":"Pine.LNX.4.64.0711031138150.4362@racer.site","threadId":"10609","inReplyTo":"20071103100323.GA25305@laptop","subject":"Re: [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-11-03T11:38:51Z","receivedAt":"2007-11-03T11:38:51Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 3 Nov 2007, Nguyễn Thái Ngọc Duy wrote:\n\n> Without this, work_tree handling code in setup_git_directory\n> will be activated. If you stay in root work tree (no prefix),\n> it does not harm. It does if you work from a subdirectory though.\n> \n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  Turns out my patch on NEED_WORK_TREE is fixing a wrong place.\n> \n>  setup.c |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n> \n> diff --git a/setup.c b/setup.c\n> index 145eca5..6f8f769 100644\n> --- a/setup.c\n> +++ b/setup.c\n> @@ -240,6 +240,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n>  \t\t\tif (chdir(work_tree_env) < 0)\n>  \t\t\t\tdie (\"Could not chdir to %s\", work_tree_env);\n>  \t\t\tstrcat(buffer, \"/\");\n> +\t\t\tinside_work_tree = 1;\n\nI really have to wonder why this is needed, as it should be deduced \n(correctly!) when you ask is_inside_work_tree().\n\nCiao,\nDscho"},{"id":"58114","messageId":"Pine.LNX.4.64.0711031211520.4362@racer.site","threadId":"10609","inReplyTo":"fcaeb9bf0711030457se2f5f5bpd9aa463e878cd621@mail.gmail.com","subject":"Re: [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-11-03T12:16:30Z","receivedAt":"2007-11-03T12:16:30Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 3 Nov 2007, Nguyen Thai Ngoc Duy wrote:\n\n> On 11/3/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n>\n> > On Sat, 3 Nov 2007, Nguyễn Thái Ngọc Duy wrote:\n> >\n> > > Without this, work_tree handling code in setup_git_directory will be \n> > > activated. If you stay in root work tree (no prefix), it does not \n> > > harm. It does if you work from a subdirectory though.\n> > >\n> > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> > > ---\n> > >  Turns out my patch on NEED_WORK_TREE is fixing a wrong place.\n> > >\n> > >  setup.c |    1 +\n> > >  1 files changed, 1 insertions(+), 0 deletions(-)\n> > >\n> > > diff --git a/setup.c b/setup.c\n> > > index 145eca5..6f8f769 100644\n> > > --- a/setup.c\n> > > +++ b/setup.c\n> > > @@ -240,6 +240,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n> > >                       if (chdir(work_tree_env) < 0)\n> > >                               die (\"Could not chdir to %s\", work_tree_env);\n> > >                       strcat(buffer, \"/\");\n> > > +                     inside_work_tree = 1;\n> >\n> > I really have to wonder why this is needed, as it should be deduced\n> > (correctly!) when you ask is_inside_work_tree().\n> \n> Because setup_git_directory() does not? From what I see,\n> setup_git_directory() calls setup_git_directory_gently() then check\n> for inside_work_tree variable almost immediately\n> (check_repository_format() does not seem to ask\n> is_inside_work_tree()).\n\nAh, I see the problem.\n\n>From your commit message I assumed that you fixed the wrong spot... Which \nyou did not.  It would have helped me if the message had read:\n\n\tWhen both GIT_DIR and GIT_WORK_TREE are set, and \n\tsetup_git_directory_gently() changes the current working \n\tdirectory accordingly, it should also set inside_work_tree = 1.\n\nYour fix is the proper one, but it not only fixes setup_git_directory(), \nbut all callers of setup_git_directory_gently().\n\nThanks,\nDscho\n"},{"id":"58129","messageId":"20071103131806.GA25109@laptop","threadId":"10609","inReplyTo":"20071103100323.GA25305@laptop","subject":"[PATCH] Add missing inside_work_tree setting in setup_git_directory_gently","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2007-11-03T13:18:06Z","receivedAt":"2007-11-03T13:18:06Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"When both GIT_DIR and GIT_WORK_TREE are set, and\nsetup_git_directory_gently() changes the current working\ndirectory accordingly, it should also set inside_work_tree = 1.\n\nWithout this, work_tree handling code in setup_git_directory()\nwill be activated. If you stay in root work tree (no prefix),\nit does not harm. It does if you work from a subdirectory though.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Updated commit message accordingly\n\n setup.c |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 145eca5..6f8f769 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -240,6 +240,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n \t\t\tif (chdir(work_tree_env) < 0)\n \t\t\t\tdie (\"Could not chdir to %s\", work_tree_env);\n \t\t\tstrcat(buffer, \"/\");\n+\t\t\tinside_work_tree = 1;\n \t\t\treturn retval;\n \t\t}\n \t\tif (nongit_ok) {\n-- \n1.5.3.rc4.3.gab089\n"},{"id":"58131","messageId":"Pine.LNX.4.64.0711031325150.4362@racer.site","threadId":"10609","inReplyTo":"20071103131806.GA25109@laptop","subject":"Re: [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-11-03T13:25:24Z","receivedAt":"2007-11-03T13:25:24Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 3 Nov 2007, Nguyễn Thái Ngọc Duy wrote:\n\n> When both GIT_DIR and GIT_WORK_TREE are set, and\n> setup_git_directory_gently() changes the current working\n> directory accordingly, it should also set inside_work_tree = 1.\n> \n> Without this, work_tree handling code in setup_git_directory()\n> will be activated. If you stay in root work tree (no prefix),\n> it does not harm. It does if you work from a subdirectory though.\n> \n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  Updated commit message accordingly\n\nThanks,\nDscho"},{"id":"58208","messageId":"7vir4ivdcr.fsf@gitster.siamese.dyndns.org","threadId":"10609","inReplyTo":"20071103131806.GA25109@laptop","subject":"Re: [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-11-04T04:33:40Z","receivedAt":"2007-11-04T04:33:40Z","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> When both GIT_DIR and GIT_WORK_TREE are set, and\n> setup_git_directory_gently() changes the current working\n> directory accordingly, it should also set inside_work_tree = 1.\n>\n> Without this, work_tree handling code in setup_git_directory()\n> will be activated. If you stay in root work tree (no prefix),\n> it does not harm. It does if you work from a subdirectory though.\n\nPlease add automated test script for this, thanks.\n"},{"id":"58220","messageId":"20071104070307.GA26071@laptop","threadId":"10609","inReplyTo":"7vir4ivdcr.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2007-11-04T07:03:07Z","receivedAt":"2007-11-04T07:03:07Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Nov 03, 2007 at 09:33:40PM -0700, Junio C Hamano wrote:\n> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n> \n> > When both GIT_DIR and GIT_WORK_TREE are set, and\n> > setup_git_directory_gently() changes the current working\n> > directory accordingly, it should also set inside_work_tree = 1.\n> >\n> > Without this, work_tree handling code in setup_git_directory()\n> > will be activated. If you stay in root work tree (no prefix),\n> > it does not harm. It does if you work from a subdirectory though.\n> \n> Please add automated test script for this, thanks.\n> \n\nThank you for reminding.  I tried to put a test in\nt1501-worktree.sh and found out core.worktree can override\ninside_work_tree previously set by setup_git_directory_gently(),\nactivating the worktree code in setup_git_directory() again.\n\nThis made me think setup_git_directory_gently() should use\nget_git_work_tree() instead. But then git_work_tree_cfg may not be\ninitialized when get_git_work_tree() is called (starting from\nsetup_git_directory(), git_work_tree_cfg is initialized in\ncheck_repository_format_version(), which is called _after_\nsetup_git_directory_gently()).\n\nThe interaction between these variables and functions is really beyond\nmy knowledge. Johannes, can you have a look at this? In theory the\nfollowing test should pass:\n\ndiff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh\nindex 7ee3820..bdb7720 100755\n--- a/t/t1501-worktree.sh\n+++ b/t/t1501-worktree.sh\n@@ -103,6 +103,11 @@ test_expect_success 'repo finds its work tree from work tree, too' '\n \t test sub/dir/tracked = \"$(git ls-files)\")\n '\n \n+test_expect_success 'Try a command from subdir in worktree' '\n+\t(cd repo.git/work/sub &&\n+\tGIT_DIR=../.. GIT_WORK_TREE=.. git blame dir/tracked)\n+'\n+\n test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' '\n \tcd repo.git/work/sub/dir &&\n \tGIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \\\n-- \nDuy\n"},{"id":"58719","messageId":"7vve8daisu.fsf@gitster.siamese.dyndns.org","threadId":"10609","inReplyTo":"20071104070307.GA26071@laptop","subject":"Re: [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-11-07T20:42:57Z","receivedAt":"2007-11-07T20:42:57Z","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> On Sat, Nov 03, 2007 at 09:33:40PM -0700, Junio C Hamano wrote:\n>> \n>> Please add automated test script for this, thanks.\n>\n> Thank you for reminding.  I tried to put a test in\n> t1501-worktree.sh and found out core.worktree can override\n> inside_work_tree previously set by setup_git_directory_gently(),\n> activating the worktree code in setup_git_directory() again.\n>\n> This made me think setup_git_directory_gently() should use\n> get_git_work_tree() instead. But then git_work_tree_cfg may not be\n> initialized when get_git_work_tree() is called (starting from\n> setup_git_directory(), git_work_tree_cfg is initialized in\n> check_repository_format_version(), which is called _after_\n> setup_git_directory_gently()).\n>\n> The interaction between these variables and functions is really beyond\n> my knowledge. Johannes, can you have a look at this? In theory the\n> following test should pass:\n>\n> diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh\n> index 7ee3820..bdb7720 100755\n> --- a/t/t1501-worktree.sh\n> +++ b/t/t1501-worktree.sh\n> @@ -103,6 +103,11 @@ test_expect_success 'repo finds its work tree from work tree, too' '\n>  \t test sub/dir/tracked = \"$(git ls-files)\")\n>  '\n>  \n> +test_expect_success 'Try a command from subdir in worktree' '\n> +\t(cd repo.git/work/sub &&\n> +\tGIT_DIR=../.. GIT_WORK_TREE=.. git blame dir/tracked)\n> +'\n> +\n>  test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' '\n>  \tcd repo.git/work/sub/dir &&\n>  \tGIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \\\n\nI am wondering what happened to this thread...\n"},{"id":"58724","messageId":"Pine.LNX.4.64.0711072053490.4362@racer.site","threadId":"10609","inReplyTo":"7vve8daisu.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-11-07T20:54:08Z","receivedAt":"2007-11-07T20:54:08Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 7 Nov 2007, Junio C Hamano wrote:\n\n> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n> \n> > On Sat, Nov 03, 2007 at 09:33:40PM -0700, Junio C Hamano wrote:\n> >> \n> >> Please add automated test script for this, thanks.\n> >\n> > Thank you for reminding.  I tried to put a test in\n> > t1501-worktree.sh and found out core.worktree can override\n> > inside_work_tree previously set by setup_git_directory_gently(),\n> > activating the worktree code in setup_git_directory() again.\n> >\n> > This made me think setup_git_directory_gently() should use\n> > get_git_work_tree() instead. But then git_work_tree_cfg may not be\n> > initialized when get_git_work_tree() is called (starting from\n> > setup_git_directory(), git_work_tree_cfg is initialized in\n> > check_repository_format_version(), which is called _after_\n> > setup_git_directory_gently()).\n> >\n> > The interaction between these variables and functions is really beyond\n> > my knowledge. Johannes, can you have a look at this? In theory the\n> > following test should pass:\n> >\n> > diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh\n> > index 7ee3820..bdb7720 100755\n> > --- a/t/t1501-worktree.sh\n> > +++ b/t/t1501-worktree.sh\n> > @@ -103,6 +103,11 @@ test_expect_success 'repo finds its work tree from work tree, too' '\n> >  \t test sub/dir/tracked = \"$(git ls-files)\")\n> >  '\n> >  \n> > +test_expect_success 'Try a command from subdir in worktree' '\n> > +\t(cd repo.git/work/sub &&\n> > +\tGIT_DIR=../.. GIT_WORK_TREE=.. git blame dir/tracked)\n> > +'\n> > +\n> >  test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' '\n> >  \tcd repo.git/work/sub/dir &&\n> >  \tGIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \\\n> \n> I am wondering what happened to this thread...\n\nIt is still in my inbox, waiting for a time where I can actually \nconcentrate.\n\nCiao,\nDscho\n"},{"id":"59031","messageId":"Pine.LNX.4.64.0711091129450.4362@racer.site","threadId":"10609","inReplyTo":"20071104070307.GA26071@laptop","subject":"Re: [PATCH] Add missing inside_work_tree setting in setup_git_directory_gently","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-11-09T11:32:24Z","receivedAt":"2007-11-09T11:32:24Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 4 Nov 2007, Nguyen Thai Ngoc Duy wrote:\n\n> On Sat, Nov 03, 2007 at 09:33:40PM -0700, Junio C Hamano wrote:\n> > Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n> > \n> > > When both GIT_DIR and GIT_WORK_TREE are set, and\n> > > setup_git_directory_gently() changes the current working\n> > > directory accordingly, it should also set inside_work_tree = 1.\n> > >\n> > > Without this, work_tree handling code in setup_git_directory()\n> > > will be activated. If you stay in root work tree (no prefix),\n> > > it does not harm. It does if you work from a subdirectory though.\n> > \n> > Please add automated test script for this, thanks.\n> > \n> \n> Thank you for reminding.  I tried to put a test in\n> t1501-worktree.sh and found out core.worktree can override\n> inside_work_tree previously set by setup_git_directory_gently(),\n> activating the worktree code in setup_git_directory() again.\n> \n> This made me think setup_git_directory_gently() should use\n> get_git_work_tree() instead. But then git_work_tree_cfg may not be\n> initialized when get_git_work_tree() is called (starting from\n> setup_git_directory(), git_work_tree_cfg is initialized in\n> check_repository_format_version(), which is called _after_\n> setup_git_directory_gently()).\n> \n> The interaction between these variables and functions is really beyond\n> my knowledge. Johannes, can you have a look at this? In theory the\n> following test should pass:\n> \n> diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh\n> index 7ee3820..bdb7720 100755\n> --- a/t/t1501-worktree.sh\n> +++ b/t/t1501-worktree.sh\n> @@ -103,6 +103,11 @@ test_expect_success 'repo finds its work tree from work tree, too' '\n>  \t test sub/dir/tracked = \"$(git ls-files)\")\n>  '\n>  \n> +test_expect_success 'Try a command from subdir in worktree' '\n> +\t(cd repo.git/work/sub &&\n> +\tGIT_DIR=../.. GIT_WORK_TREE=.. git blame dir/tracked)\n> +'\n> +\n>  test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' '\n>  \tcd repo.git/work/sub/dir &&\n>  \tGIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \\\n\nThis does not really test work_tree, but if blame uses the work_tree \nmachinery correctly.\n\nI will send out a patch to builtin-blame.c in a minute.\n\nHowever, this test case still fails, since blame needs a HEAD revision!  \nAnd in t1501 there is no commit done yet.\n\nCiao,\nDscho\n"},{"id":"59032","messageId":"Pine.LNX.4.64.0711091132290.4362@racer.site","threadId":"10609","inReplyTo":"20071104070307.GA26071@laptop","subject":"[PATCH] builtin-blame: set up the work_tree before the first file access","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-11-09T11:34:07Z","receivedAt":"2007-11-09T11:34:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWe check in cmd_blame() if the specified path is there, but we\nfailed to set up the working tree before that.\n\nWhile at it, make setup_work_tree() just return if it was run\nbefore.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tIMO both this patch and the recent patch to call setup_work_tree() \n\tare needed.  Only the second call to setup_work_tree() will know \n\tif there was no revision specified, and the first one will know if \n\ta -- has been seen.\n\n builtin-blame.c |    1 +\n setup.c         |   10 ++++++++--\n 2 files changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-blame.c b/builtin-blame.c\nindex 55a3c0b..ba80bf8 100644\n--- a/builtin-blame.c\n+++ b/builtin-blame.c\n@@ -2295,6 +2295,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)\n \t\t\telse if (i != argc - 1)\n \t\t\t\tusage(blame_usage); /* garbage at end */\n \n+\t\t\tsetup_work_tree();\n \t\t\tif (!has_path_in_work_tree(path))\n \t\t\t\tdie(\"cannot stat path %s: %s\",\n \t\t\t\t    path, strerror(errno));\ndiff --git a/setup.c b/setup.c\nindex 084d722..1421a2c 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -207,12 +207,18 @@ static const char *set_work_tree(const char *dir)\n }\n \n void setup_work_tree(void) {\n-\tconst char *work_tree = get_git_work_tree();\n-\tconst char *git_dir = get_git_dir();\n+\tconst char *work_tree, *git_dir;\n+\tstatic int initialized = 0;\n+\n+\tif (initialized)\n+\t\treturn;\n+\twork_tree = get_git_work_tree();\n+\tgit_dir = get_git_dir();\n \tif (!is_absolute_path(git_dir))\n \t\tset_git_dir(make_absolute_path(git_dir));\n \tif (!work_tree || chdir(work_tree))\n \t\tdie(\"This operation must be run in a work tree\");\n+\tinitialized = 1;\n }\n \n /*\n-- \n1.5.3.5.1645.g1f4df\n"}]}