From: Junio C Hamano <gitster@pobox.com>
To: Chris Pimlott <chris@pimlott.net>
Cc: git@vger.kernel.org
Subject: Re: git-describe considers WC dirty incorrectly when using --git-dir
Date: Wed, 04 Mar 2015 11:54:02 -0800 [thread overview]
Message-ID: <xmqqoao88rol.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CACWYfsCO3O-x8zBsFXoSTFZ8GiaO6CpAszUHRtjM0dCp0Q8ogg@mail.gmail.com> (Chris Pimlott's message of "Wed, 4 Mar 2015 11:47:32 -0800")
Chris Pimlott <chris@pimlott.net> writes:
> It seems that git-describe always thinks that working copy is dirty if
> you are not in the WC root and you explicitly specify the .git
> directory location using --git-dir:
>
> # set up test repo
> folio:~ chris$ mkdir repo && cd repo
> folio:repo chris$ mkdir text && echo hi > text/hi.txt
> folio:repo chris$ git init . && git add . && git commit -m "text/hi.txt"
> Initialized empty Git repository in /home/chris/repo/.git/
> [master (root-commit) c0edd63] text/hi.txt
> 1 file changed, 1 insertion(+)
> create mode 100644 text/hi.txt
>
> # git-describe from non-root directory
> folio:repo chris$ cd text
> folio:text chris$ git describe --always --dirty
> c0edd63
> folio:text chris$ git --git-dir=../.git describe --always --dirty
> c0edd63-dirty
> folio:text chris$ git --git-dir=$(git rev-parse
> --show-toplevel)/.git describe --always --dirty
> c0edd63-dirty
I have a feeling that this is not limited to describe at all. With
the --git-dir option, you are telling Git that your GIT_DIR is over
there and (by not using --work-tree together with that option) you
are telling Git that you do not want Git to guess where the working
tree is (instead, you are telling Git that you are at the top of the
working tree), no?
next prev parent reply other threads:[~2015-03-04 19:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-04 19:47 git-describe considers WC dirty incorrectly when using --git-dir Chris Pimlott
2015-03-04 19:54 ` Junio C Hamano [this message]
2015-03-04 20:12 ` Chris Pimlott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqoao88rol.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=chris@pimlott.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox