{"thread":{"id":"20166","subject":"bug with .git file and aliases","startedAt":"2009-07-20T13:54:12Z","lastAt":"2009-08-11T10:37:07Z","messageCount":13,"participants":["Geoffrey Irving","Santi Béjar","Jeff King","Johannes Schindelin","Michael J Gruber","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"118312","messageId":"7f9d599f0907200654q2e068e6aq3051c122f6596053@mail.gmail.com","threadId":"20166","inReplyTo":null,"subject":"bug with .git file and aliases","fromName":"Geoffrey Irving","fromEmail":"irving@naml.us","sentAt":"2009-07-20T13:54:12Z","receivedAt":"2009-07-20T13:54:12Z","isPatch":false,"sender":{"key":"irving@naml.us","avatar":"https://gravatar.com/avatar/52d7452fcd134aac0fa12f57a3bb7ef5f3f7e73ca0ab36736d06c6a6132de718?d=mp&s=160"},"body":"git 1.6.3.3 has a bug related to .git file support and aliases.\nSpecifically, if you make an alias for status and call it from a\nsubdirectory, git status chdirs into the true .git dir but then\nchdir's back to the wrong place in order to run the lstats for status.\n The result is that git status thinks all files have disappeared.\n\nHere's a self-contained test script:\n\n    #!/bin/bash\n    set -x\n\n    # make a simple repository\n    mkdir repo\n    cd repo\n    git init\n    mkdir a\n    echo content > a/b\n    git add a/b\n    git commit -m \"a commit\"\n\n    # replace the gitdir with a gitfile\n    mv .git ../repo.git\n    echo gitdir: `pwd`.git > .git\n\n    # normal git status works\n    cd a\n    git status\n\n    # an alias for git status fails\n    git config alias.st status\n    git st\n\nwhich produces output\n\ntop:tmp% ./bug\n++ mkdir repo\n++ cd repo\n++ git init\nInitialized empty Git repository in /Users/irving/tmp/tmp/repo/.git/\n++ mkdir a\n++ echo content\n++ git add a/b\n++ git commit -m 'a commit'\n[master (root-commit) 6b07ec4] a commit\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 a/b\n++ mv .git ../repo.git\n+++ pwd\n++ echo gitdir: /Users/irving/tmp/tmp/repo.git\n++ cd a\n++ git status\n# On branch master\nnothing to commit (working directory clean)\n++ git config alias.st status\n++ git st\n# On branch master\n# Changed but not updated:\n#   (use \"git add/rm <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#\tdeleted:    a/b\n#\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#\tb\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n.git file support also doesn't work on a repository with no commits\n(which is why the test script makes a commit normally before switching\nto a gitfile).  However, I care about this second problem much less,\nand didn't notice it until I made the test script.\n\nFinally, huge thanks to Lars for implementing this.  I'm storing git\nworking directories inside vesta, and symlink support is currently\ndisabled.  It's very pleasant to grep through the source and find that\nsomeone already fixed exactly my problem. :)\n\nGeoffrey\n"},{"id":"118313","messageId":"adf1fd3d0907200704sb097a99h1ab8f118be5854f9@mail.gmail.com","threadId":"20166","inReplyTo":"7f9d599f0907200654q2e068e6aq3051c122f6596053@mail.gmail.com","subject":"Re: bug with .git file and aliases","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-07-20T14:04:52Z","receivedAt":"2009-07-20T14:04:52Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/7/20 Geoffrey Irving <irving@naml.us>:\n> git 1.6.3.3 has a bug related to .git file support and aliases.\n> Specifically, if you make an alias for status and call it from a\n> subdirectory, git status chdirs into the true .git dir but then\n> chdir's back to the wrong place in order to run the lstats for status.\n>  The result is that git status thinks all files have disappeared.\n>\n> Here's a self-contained test script:\n>\n>    #!/bin/bash\n>    set -x\n>\n>    # make a simple repository\n>    mkdir repo\n>    cd repo\n>    git init\n>    mkdir a\n>    echo content > a/b\n>    git add a/b\n>    git commit -m \"a commit\"\n>\n>    # replace the gitdir with a gitfile\n>    mv .git ../repo.git\n>    echo gitdir: `pwd`.git > .git\n>\n>    # normal git status works\n>    cd a\n>    git status\n>\n>    # an alias for git status fails\n>    git config alias.st status\n>    git st\n\nI suspect that the $GIR_DIR and .git file works equally in this\naspect, so you should specify where is the workdir in .git/config with\nrespect the repository:\n\ngit config core.workdir `pwd`\n\nHTH,\nSanti\n"},{"id":"118315","messageId":"7f9d599f0907200727v5b258a73n3fa664f134c0eead@mail.gmail.com","threadId":"20166","inReplyTo":"adf1fd3d0907200704sb097a99h1ab8f118be5854f9@mail.gmail.com","subject":"Re: bug with .git file and aliases","fromName":"Geoffrey Irving","fromEmail":"irving@naml.us","sentAt":"2009-07-20T14:27:16Z","receivedAt":"2009-07-20T14:27:16Z","isPatch":false,"sender":{"key":"irving@naml.us","avatar":"https://gravatar.com/avatar/52d7452fcd134aac0fa12f57a3bb7ef5f3f7e73ca0ab36736d06c6a6132de718?d=mp&s=160"},"body":"On Mon, Jul 20, 2009 at 10:04 AM, Santi Béjar<santi@agolina.net> wrote:\n> I suspect that the $GIR_DIR and .git file works equally in this\n> aspect, so you should specify where is the workdir in .git/config with\n> respect the repository:\n>\n> git config core.workdir `pwd`\n\nNope, that has no effect.\n\nBy the way, I can work around this problem by using\n\n    git config alias.st \"!git status\"\n\nbut unfortunately that has slightly different behavior (it ignores pwd).\n\nGeoffrey\n"},{"id":"118320","messageId":"adf1fd3d0907200818l429e701ds6a42ec49f02d5ba9@mail.gmail.com","threadId":"20166","inReplyTo":"7f9d599f0907200727v5b258a73n3fa664f134c0eead@mail.gmail.com","subject":"Re: bug with .git file and aliases","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-07-20T15:18:28Z","receivedAt":"2009-07-20T15:18:28Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/7/20 Geoffrey Irving <irving@naml.us>:\n> On Mon, Jul 20, 2009 at 10:04 AM, Santi Béjar<santi@agolina.net> wrote:\n>> I suspect that the $GIR_DIR and .git file works equally in this\n>> aspect, so you should specify where is the workdir in .git/config with\n>> respect the repository:\n>>\n>> git config core.workdir `pwd`\n>\n> Nope, that has no effect.\n\nHere it has the desired effect. From where did you run the above\ncommand? What is the output of:\n\ngit config core.workdir\n\n?\n\nIt should output the path of the repo, not of the \"a\" subdirectory.\n\nHTH,\nSanti\n"},{"id":"118321","messageId":"20090720152117.GB5347@coredump.intra.peff.net","threadId":"20166","inReplyTo":"7f9d599f0907200654q2e068e6aq3051c122f6596053@mail.gmail.com","subject":"Re: bug with .git file and aliases","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-07-20T15:21:17Z","receivedAt":"2009-07-20T15:21:17Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jul 20, 2009 at 09:54:12AM -0400, Geoffrey Irving wrote:\n\n> git 1.6.3.3 has a bug related to .git file support and aliases.\n> Specifically, if you make an alias for status and call it from a\n> subdirectory, git status chdirs into the true .git dir but then\n> chdir's back to the wrong place in order to run the lstats for status.\n>  The result is that git status thinks all files have disappeared.\n\nYeah, this is a known problem. The problem is that the 'git' wrapper\nsets up the environment only partially when running aliases, and then\nthe resulting command ends up confused about where the worktree is. I\nreally don't remember the specifics, but you can probably find some\ndiscussion in the list archives.  Fixing it, IIRC, required some\nrefactoring of the setup code (which I had hoped to get to at some\npoint, but I am way behind on my git todo list).\n\nHmm. Poking around a bit, this seems related, but I don't know why I\nnever followed up:\n\n  http://article.gmane.org/gmane.comp.version-control.git/72792\n\n-Peff\n"},{"id":"118324","messageId":"7f9d599f0907200825j69ee3c9cj4aef26796c3917d6@mail.gmail.com","threadId":"20166","inReplyTo":"adf1fd3d0907200818l429e701ds6a42ec49f02d5ba9@mail.gmail.com","subject":"Re: bug with .git file and aliases","fromName":"Geoffrey Irving","fromEmail":"irving@naml.us","sentAt":"2009-07-20T15:25:33Z","receivedAt":"2009-07-20T15:25:33Z","isPatch":false,"sender":{"key":"irving@naml.us","avatar":"https://gravatar.com/avatar/52d7452fcd134aac0fa12f57a3bb7ef5f3f7e73ca0ab36736d06c6a6132de718?d=mp&s=160"},"body":"On Mon, Jul 20, 2009 at 11:18 AM, Santi Béjar<santi@agolina.net> wrote:\n> 2009/7/20 Geoffrey Irving <irving@naml.us>:\n>> On Mon, Jul 20, 2009 at 10:04 AM, Santi Béjar<santi@agolina.net> wrote:\n>>> I suspect that the $GIR_DIR and .git file works equally in this\n>>> aspect, so you should specify where is the workdir in .git/config with\n>>> respect the repository:\n>>>\n>>> git config core.workdir `pwd`\n>>\n>> Nope, that has no effect.\n>\n> Here it has the desired effect. From where did you run the above\n> command? What is the output of:\n>\n> git config core.workdir\n\ntop:a% git config core.workdir\n/Users/irving/tmp/tmp/repo\ntop:a% git st\n# On branch master\n# Changed but not updated:\n#   (use \"git add/rm <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#\tdeleted:    a/b\n#\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#\tb\n\nIt doesn't matter, though, since setting workdir should not be necessary.\n\nGeoffrey\n"},{"id":"120206","messageId":"7f9d599f0908101322i46384247m303e28955f88bbb@mail.gmail.com","threadId":"20166","inReplyTo":"20090720152117.GB5347@coredump.intra.peff.net","subject":"Re: bug with .git file and aliases","fromName":"Geoffrey Irving","fromEmail":"irving@naml.us","sentAt":"2009-08-10T20:22:01Z","receivedAt":"2009-08-10T20:22:01Z","isPatch":false,"sender":{"key":"irving@naml.us","avatar":"https://gravatar.com/avatar/52d7452fcd134aac0fa12f57a3bb7ef5f3f7e73ca0ab36736d06c6a6132de718?d=mp&s=160"},"body":"On Mon, Jul 20, 2009 at 11:21 AM, Jeff King<peff@peff.net> wrote:\n> On Mon, Jul 20, 2009 at 09:54:12AM -0400, Geoffrey Irving wrote:\n>\n>> git 1.6.3.3 has a bug related to .git file support and aliases.\n>> Specifically, if you make an alias for status and call it from a\n>> subdirectory, git status chdirs into the true .git dir but then\n>> chdir's back to the wrong place in order to run the lstats for status.\n>>  The result is that git status thinks all files have disappeared.\n>\n> Yeah, this is a known problem. The problem is that the 'git' wrapper\n> sets up the environment only partially when running aliases, and then\n> the resulting command ends up confused about where the worktree is. I\n> really don't remember the specifics, but you can probably find some\n> discussion in the list archives.  Fixing it, IIRC, required some\n> refactoring of the setup code (which I had hoped to get to at some\n> point, but I am way behind on my git todo list).\n\nThe attached patch fixes the bug for me.  I'll leave it to others to\ndetermine whether this is a good way to fix the problem.\n\nThanks,\nGeoffrey\n\n\nFrom ec47aa09e5bc8d9a8c07cca9f8ef17a9898819c1 Mon Sep 17 00:00:00 2001\nFrom: Geoffrey Irving <irving@naml.us>\nDate: Mon, 10 Aug 2009 15:59:21 -0400\nSubject: [PATCH] setup.c: fix work tree setup for .git-files and aliases\n\nWhen .git-files and aliases are used together, the setup machinery\ngets confused and ends up with the wrong work_tree.  Specifically,\ngit_work_tree_cfg is set to the correct value first, but set_work_tree\nresets git_work_tree_cfg to the current directory, which (at least in\nthis case) is incorrect.\n\nset_work_tree now detects this case by checking to see if\ngit_work_tree_cfg is already set.  If so, it leaves git_work_tree_cfg\nunchanged and instead uses the current directory to compute and return\nthe correct prefix (where we are relative to the work tree).\n\nSigned-off-by: Geoffrey Irving <irving@naml.us>\n---\n setup.c |   15 +++++++++++++--\n 1 files changed, 13 insertions(+), 2 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex e3781b6..97f7eb1 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -198,13 +198,24 @@ int is_inside_work_tree(void)\n static const char *set_work_tree(const char *dir)\n {\n \tchar buffer[PATH_MAX + 1];\n+\tsize_t offset;\n \n \tif (!getcwd(buffer, sizeof(buffer)))\n \t\tdie (\"Could not get the current working directory\");\n-\tgit_work_tree_cfg = xstrdup(buffer);\n \tinside_work_tree = 1;\n \n-\treturn NULL;\n+\tif (!git_work_tree_cfg) {\n+\t\tgit_work_tree_cfg = xstrdup(buffer);\n+\t\treturn NULL;\n+\t} else {\n+\t\toffset = strlen(git_work_tree_cfg);\n+\t\tif (memcmp(git_work_tree_cfg, buffer, offset)\n+\t\t\t|| (buffer[offset] && buffer[offset] != '/'))\n+\t\t\tdie (\"fatal: not inside work tree (should not happen)\");\n+\t\tif (!buffer[offset] || !buffer[offset+1])\n+\t\t\treturn NULL;\n+\t\treturn xstrdup(strcat(buffer + offset + 1, \"/\"));\n+\t}\n }\n \n void setup_work_tree(void)\n-- \n1.6.3.3\n\n"},{"id":"120209","messageId":"alpine.DEB.1.00.0908110101110.8306@pacific.mpi-cbg.de","threadId":"20166","inReplyTo":"7f9d599f0908101322i46384247m303e28955f88bbb@mail.gmail.com","subject":"Re: bug with .git file and aliases","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-08-10T23:05:38Z","receivedAt":"2009-08-10T23:05:38Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 10 Aug 2009, Geoffrey Irving wrote:\n\n> On Mon, Jul 20, 2009 at 11:21 AM, Jeff King<peff@peff.net> wrote:\n> > On Mon, Jul 20, 2009 at 09:54:12AM -0400, Geoffrey Irving wrote:\n> >\n> >> git 1.6.3.3 has a bug related to .git file support and aliases.\n> >> Specifically, if you make an alias for status and call it from a\n> >> subdirectory, git status chdirs into the true .git dir but then\n> >> chdir's back to the wrong place in order to run the lstats for status.\n> >>  The result is that git status thinks all files have disappeared.\n> >\n> > Yeah, this is a known problem. The problem is that the 'git' wrapper\n> > sets up the environment only partially when running aliases, and then\n> > the resulting command ends up confused about where the worktree is. I\n> > really don't remember the specifics, but you can probably find some\n> > discussion in the list archives.  Fixing it, IIRC, required some\n> > refactoring of the setup code (which I had hoped to get to at some\n> > point, but I am way behind on my git todo list).\n> \n> The attached patch fixes the bug for me.  I'll leave it to others to\n> determine whether this is a good way to fix the problem.\n\nNote that you made it particularly hard to comment on your patch by not \ngranting us the wish stated in Documentation/SubmittingPatches, namely to \ninline your patch.\n\nI'll just forego inlining it myself, as I am way past my bed-time and \ncannot be bothered.\n\nHowever, I think that it is necessary to comment on your patch.\n\nThere is a few style issues, such as declaring offset outside of the \nblock that is the only user, and there is the issue that you go out of \nyour way to append a slash if you're resetting the work tree, but not when \nnot resetting it.\n\nBut the bigger issue is that you now broke overriding the work tree via \nthe command line.\n\nThe proper fix, of course, is to avoid calling the function with the wrong \npath to begin with.\n\nCiao,\nDscho\n"},{"id":"120233","messageId":"7f9d599f0908102037s51f0380te56463706f794c8a@mail.gmail.com","threadId":"20166","inReplyTo":"alpine.DEB.1.00.0908110101110.8306@pacific.mpi-cbg.de","subject":"Re: bug with .git file and aliases","fromName":"Geoffrey Irving","fromEmail":"irving@naml.us","sentAt":"2009-08-11T03:37:54Z","receivedAt":"2009-08-11T03:37:54Z","isPatch":false,"sender":{"key":"irving@naml.us","avatar":"https://gravatar.com/avatar/52d7452fcd134aac0fa12f57a3bb7ef5f3f7e73ca0ab36736d06c6a6132de718?d=mp&s=160"},"body":"On Mon, Aug 10, 2009 at 7:05 PM, Johannes\nSchindelin<Johannes.Schindelin@gmx.de> wrote:\n> Hi,\n>\n> On Mon, 10 Aug 2009, Geoffrey Irving wrote:\n>\n>> On Mon, Jul 20, 2009 at 11:21 AM, Jeff King<peff@peff.net> wrote:\n>> > On Mon, Jul 20, 2009 at 09:54:12AM -0400, Geoffrey Irving wrote:\n>> >\n>> >> git 1.6.3.3 has a bug related to .git file support and aliases.\n>> >> Specifically, if you make an alias for status and call it from a\n>> >> subdirectory, git status chdirs into the true .git dir but then\n>> >> chdir's back to the wrong place in order to run the lstats for status.\n>> >>  The result is that git status thinks all files have disappeared.\n>> >\n>> > Yeah, this is a known problem. The problem is that the 'git' wrapper\n>> > sets up the environment only partially when running aliases, and then\n>> > the resulting command ends up confused about where the worktree is. I\n>> > really don't remember the specifics, but you can probably find some\n>> > discussion in the list archives.  Fixing it, IIRC, required some\n>> > refactoring of the setup code (which I had hoped to get to at some\n>> > point, but I am way behind on my git todo list).\n>>\n>> The attached patch fixes the bug for me.  I'll leave it to others to\n>> determine whether this is a good way to fix the problem.\n>\n> Note that you made it particularly hard to comment on your patch by not\n> granting us the wish stated in Documentation/SubmittingPatches, namely to\n> inline your patch.\n>\n> I'll just forego inlining it myself, as I am way past my bed-time and\n> cannot be bothered.\n\nOops.  Here's the inlined patch with offset fixed, for others:\n\nFrom ec47aa09e5bc8d9a8c07cca9f8ef17a9898819c1 Mon Sep 17 00:00:00 2001\nFrom: Geoffrey Irving <irving@naml.us>\nDate: Mon, 10 Aug 2009 15:59:21 -0400\nSubject: [PATCH] setup.c: fix work tree setup for .git-files and aliases\n\nWhen .git-files and aliases are used together, the setup machinery\ngets confused and ends up with the wrong work_tree.  Specifically,\ngit_work_tree_cfg is set to the correct value first, but set_work_tree\nresets git_work_tree_cfg to the current directory, which (at least in\nthis case) is incorrect.\n\nset_work_tree now detects this case by checking to see if\ngit_work_tree_cfg is already set.  If so, it leaves git_work_tree_cfg\nunchanged and instead uses the current directory to compute and return\nthe correct prefix (where we are relative to the work tree).\n\nSigned-off-by: Geoffrey Irving <irving@naml.us>\n---\n setup.c |   15 +++++++++++++--\n 1 files changed, 13 insertions(+), 2 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex e3781b6..97f7eb1 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -198,13 +198,24 @@ int is_inside_work_tree(void)\n static const char *set_work_tree(const char *dir)\n {\n \tchar buffer[PATH_MAX + 1];\n\n \tif (!getcwd(buffer, sizeof(buffer)))\n \t\tdie (\"Could not get the current working directory\");\n-\tgit_work_tree_cfg = xstrdup(buffer);\n \tinside_work_tree = 1;\n\n-\treturn NULL;\n+\tif (!git_work_tree_cfg) {\n+\t\tgit_work_tree_cfg = xstrdup(buffer);\n+\t\treturn NULL;\n+\t} else {\n+\t\tsize_t offset = strlen(git_work_tree_cfg);\n+\t\tif (memcmp(git_work_tree_cfg, buffer, offset)\n+\t\t\t|| (buffer[offset] && buffer[offset] != '/'))\n+\t\t\tdie (\"fatal: not inside work tree (should not happen)\");\n+\t\tif (!buffer[offset] || !buffer[offset+1])\n+\t\t\treturn NULL;\n+\t\treturn xstrdup(strcat(buffer + offset + 1, \"/\"));\n+\t}\n }\n\n void setup_work_tree(void)\n-- \n1.6.3.3\n\n> However, I think that it is necessary to comment on your patch.\n>\n> There is a few style issues, such as declaring offset outside of the\n> block that is the only user, and there is the issue that you go out of\n> your way to append a slash if you're resetting the work tree, but not when\n> not resetting it.\n>\n> But the bigger issue is that you now broke overriding the work tree via\n> the command line.\n>\n> The proper fix, of course, is to avoid calling the function with the wrong\n> path to begin with.\n\nI'm happy that the correct fix is obvious, and apologize for missing it.\n\nGeoffrey\n"},{"id":"120245","messageId":"alpine.DEB.1.00.0908111030240.4638@intel-tinevez-2-302","threadId":"20166","inReplyTo":"7f9d599f0908102037s51f0380te56463706f794c8a@mail.gmail.com","subject":"Re: bug with .git file and aliases","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-08-11T08:33:02Z","receivedAt":"2009-08-11T08:33:02Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 10 Aug 2009, Geoffrey Irving wrote:\n\n> On Mon, Aug 10, 2009 at 7:05 PM, Johannes\n> Schindelin<Johannes.Schindelin@gmx.de> wrote:\n>\n> > The proper fix, of course, is to avoid calling the function with the \n> > wrong path to begin with.\n> \n> I'm happy that the correct fix is obvious, and apologize for missing it.\n\nNo, no, I said that it is obvious what should be fixed (you do not want \nto break perfectly valid workflows such as having a worktree set in the \nconfig, but overriding it via git's --work-tree option).  The fix is not \nobvious, unfortunately.\n\nSee also http://thread.gmane.org/gmane.comp.version-control.git/102269 for \nsome discussion on the same topic.\n\nCiao,\nDscho\n"},{"id":"120251","messageId":"4A814216.20708@drmicha.warpmail.net","threadId":"20166","inReplyTo":"20090720152117.GB5347@coredump.intra.peff.net","subject":"Re: bug with .git file and aliases","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-08-11T10:04:06Z","receivedAt":"2009-08-11T10:04:06Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jeff King venit, vidit, dixit 20.07.2009 17:21:\n> On Mon, Jul 20, 2009 at 09:54:12AM -0400, Geoffrey Irving wrote:\n> \n>> git 1.6.3.3 has a bug related to .git file support and aliases.\n>> Specifically, if you make an alias for status and call it from a\n>> subdirectory, git status chdirs into the true .git dir but then\n>> chdir's back to the wrong place in order to run the lstats for status.\n>>  The result is that git status thinks all files have disappeared.\n> \n> Yeah, this is a known problem. The problem is that the 'git' wrapper\n> sets up the environment only partially when running aliases, and then\n> the resulting command ends up confused about where the worktree is. I\n> really don't remember the specifics, but you can probably find some\n> discussion in the list archives.  Fixing it, IIRC, required some\n> refactoring of the setup code (which I had hoped to get to at some\n> point, but I am way behind on my git todo list).\n> \n> Hmm. Poking around a bit, this seems related, but I don't know why I\n> never followed up:\n> \n>   http://article.gmane.org/gmane.comp.version-control.git/72792\n> \n> -Peff\n\n...because it was up to the brave git-on-win folks to decide whether\nsetenv() on win would be rewritten to not use putenv() when the value is\n\"\". J&J, has anything happened on the front or is it likely to? (I'm\nsorry I can't offer help, only moral support...)\n\nJeff's patch from Feb. 08 still applies more or less cleanly (with\nobvious adjustments) and makes the relevant tests pass (on Linux).\n\nMichael\n"},{"id":"120252","messageId":"4A81474C.70804@viscovery.net","threadId":"20166","inReplyTo":"4A814216.20708@drmicha.warpmail.net","subject":"Re: bug with .git file and aliases","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-08-11T10:26:20Z","receivedAt":"2009-08-11T10:26:20Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Michael J Gruber schrieb:\n> ...because it was up to the brave git-on-win folks to decide whether\n> setenv() on win would be rewritten to not use putenv() when the value is\n> \"\". J&J, has anything happened on the front or is it likely to? (I'm\n> sorry I can't offer help, only moral support...)\n\nNothing has changed since. Nothing is likely to happen until there is a\nneed to touch compat/setenv.c, like, for example, a test in the test suite\nthat fails only on Windows...\n\n-- Hannes\n"},{"id":"120229","messageId":"4A8149D3.1050103@drmicha.warpmail.net","threadId":"20166","inReplyTo":"4A81474C.70804@viscovery.net","subject":"Re: bug with .git file and aliases","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-08-11T10:37:07Z","receivedAt":"2009-08-11T10:37:07Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Johannes Sixt venit, vidit, dixit 11.08.2009 12:26:\n> Michael J Gruber schrieb:\n>> ...because it was up to the brave git-on-win folks to decide whether\n>> setenv() on win would be rewritten to not use putenv() when the value is\n>> \"\". J&J, has anything happened on the front or is it likely to? (I'm\n>> sorry I can't offer help, only moral support...)\n> \n> Nothing has changed since. Nothing is likely to happen until there is a\n> need to touch compat/setenv.c, like, for example, a test in the test suite\n> that fails only on Windows...\n\n...well, that can be taken care of quickly. Go, Jeff, go :)\n\nMichael\n"}]}