* git-describe considers WC dirty incorrectly when using --git-dir
@ 2015-03-04 19:47 Chris Pimlott
2015-03-04 19:54 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Chris Pimlott @ 2015-03-04 19:47 UTC (permalink / raw)
To: git
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
# git-describe from root directory
folio:repo chris$ cd ..
folio:repo chris$ git describe --always --dirty
c0edd63
folio:repo chris$ git --git-dir=.git describe --always --dirty
c0edd63
folio:repo chris$ git --git-dir=$(git rev-parse
--show-toplevel)/.git describe --always --dirty
c0edd63
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git-describe considers WC dirty incorrectly when using --git-dir
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
2015-03-04 20:12 ` Chris Pimlott
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2015-03-04 19:54 UTC (permalink / raw)
To: Chris Pimlott; +Cc: git
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?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git-describe considers WC dirty incorrectly when using --git-dir
2015-03-04 19:54 ` Junio C Hamano
@ 2015-03-04 20:12 ` Chris Pimlott
0 siblings, 0 replies; 3+ messages in thread
From: Chris Pimlott @ 2015-03-04 20:12 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, Mar 4, 2015 at 11:54 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Chris Pimlott <chris@pimlott.net> writes:
>
>> folio:text chris$ git --git-dir=../.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?
Ah, my apologies, you are correct. I was not aware of --work-tree and
didn't realize that specifying --git-dir would turn off the normal
working tree discovery process. Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-04 20:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-03-04 20:12 ` Chris Pimlott
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox