{"thread":{"id":"38702","subject":"git-describe considers WC dirty incorrectly when using --git-dir","startedAt":"2015-03-04T19:47:32Z","lastAt":"2015-03-04T20:12:43Z","messageCount":3,"participants":["Chris Pimlott","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"257009","messageId":"CACWYfsCO3O-x8zBsFXoSTFZ8GiaO6CpAszUHRtjM0dCp0Q8ogg@mail.gmail.com","threadId":"38702","inReplyTo":null,"subject":"git-describe considers WC dirty incorrectly when using --git-dir","fromName":"Chris Pimlott","fromEmail":"chris@pimlott.net","sentAt":"2015-03-04T19:47:32Z","receivedAt":"2015-03-04T19:47:32Z","isPatch":false,"sender":{"key":"chris@pimlott.net","avatar":null},"body":"It seems that git-describe always thinks that working copy is dirty if\nyou are not in the WC root and you explicitly specify the .git\ndirectory location using --git-dir:\n\n  # set up test repo\n  folio:~ chris$ mkdir repo && cd repo\n  folio:repo chris$ mkdir text && echo hi > text/hi.txt\n  folio:repo chris$ git init . && git add . && git commit -m \"text/hi.txt\"\n  Initialized empty Git repository in /home/chris/repo/.git/\n  [master (root-commit) c0edd63] text/hi.txt\n  1 file changed, 1 insertion(+)\n  create mode 100644 text/hi.txt\n\n  # git-describe from non-root directory\n  folio:repo chris$ cd text\n  folio:text chris$ git describe --always --dirty\n  c0edd63\n  folio:text chris$ git --git-dir=../.git describe --always --dirty\n  c0edd63-dirty\n  folio:text chris$ git --git-dir=$(git rev-parse\n--show-toplevel)/.git describe --always --dirty\n  c0edd63-dirty\n\n  # git-describe from root directory\n  folio:repo chris$ cd ..\n  folio:repo chris$ git describe --always --dirty\n  c0edd63\n  folio:repo chris$ git --git-dir=.git describe --always --dirty\n  c0edd63\n  folio:repo chris$ git --git-dir=$(git rev-parse\n--show-toplevel)/.git describe --always --dirty\n  c0edd63\n"},{"id":"257010","messageId":"xmqqoao88rol.fsf@gitster.dls.corp.google.com","threadId":"38702","inReplyTo":"CACWYfsCO3O-x8zBsFXoSTFZ8GiaO6CpAszUHRtjM0dCp0Q8ogg@mail.gmail.com","subject":"Re: git-describe considers WC dirty incorrectly when using --git-dir","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-03-04T19:54:02Z","receivedAt":"2015-03-04T19:54:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Chris Pimlott <chris@pimlott.net> writes:\n\n> It seems that git-describe always thinks that working copy is dirty if\n> you are not in the WC root and you explicitly specify the .git\n> directory location using --git-dir:\n>\n>   # set up test repo\n>   folio:~ chris$ mkdir repo && cd repo\n>   folio:repo chris$ mkdir text && echo hi > text/hi.txt\n>   folio:repo chris$ git init . && git add . && git commit -m \"text/hi.txt\"\n>   Initialized empty Git repository in /home/chris/repo/.git/\n>   [master (root-commit) c0edd63] text/hi.txt\n>   1 file changed, 1 insertion(+)\n>   create mode 100644 text/hi.txt\n>\n>   # git-describe from non-root directory\n>   folio:repo chris$ cd text\n>   folio:text chris$ git describe --always --dirty\n>   c0edd63\n>   folio:text chris$ git --git-dir=../.git describe --always --dirty\n>   c0edd63-dirty\n>   folio:text chris$ git --git-dir=$(git rev-parse\n> --show-toplevel)/.git describe --always --dirty\n>   c0edd63-dirty\n\nI have a feeling that this is not limited to describe at all.  With\nthe --git-dir option, you are telling Git that your GIT_DIR is over\nthere and (by not using --work-tree together with that option) you\nare telling Git that you do not want Git to guess where the working\ntree is (instead, you are telling Git that you are at the top of the\nworking tree), no?\n"},{"id":"257013","messageId":"CACWYfsBVTcJxykWde5nNirHTdV9-yoanGAb2zVevXeewTTJJzQ@mail.gmail.com","threadId":"38702","inReplyTo":"xmqqoao88rol.fsf@gitster.dls.corp.google.com","subject":"Re: git-describe considers WC dirty incorrectly when using --git-dir","fromName":"Chris Pimlott","fromEmail":"chris@pimlott.net","sentAt":"2015-03-04T20:12:43Z","receivedAt":"2015-03-04T20:12:43Z","isPatch":false,"sender":{"key":"chris@pimlott.net","avatar":null},"body":"On Wed, Mar 4, 2015 at 11:54 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Chris Pimlott <chris@pimlott.net> writes:\n>\n>>   folio:text chris$ git --git-dir=../.git describe --always --dirty\n>>   c0edd63-dirty\n>\n> I have a feeling that this is not limited to describe at all.  With\n> the --git-dir option, you are telling Git that your GIT_DIR is over\n> there and (by not using --work-tree together with that option) you\n> are telling Git that you do not want Git to guess where the working\n> tree is (instead, you are telling Git that you are at the top of the\n> working tree), no?\n\nAh, my apologies, you are correct.  I was not aware of --work-tree and\ndidn't realize that specifying --git-dir would turn off the normal\nworking tree discovery process.  Thanks!\n"}]}