[Bug] git rev-parse --git-common-dir executed from a sub dir of the main worktree is wrong

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I found a case where it seems that the result of `git rev-parse
--git-common-dir` is incorrect.  If you execute the command from
within a subdirectory in the main worktree, it returns the path from
the root of the worktree to the current dir + "/.git".  (As a
refresher, running this command from the root of the worktree returns
".git").

I wrote a quick test to demonstrate the problem:


+test_expect_success 'git-common-dir inside sub-dir' '
+   (
+ mkdir -p path/to/child &&
+ cd path/to/child &&
+ echo "$(git rev-parse --show-toplevel)/.git" >expected &&
+ git rev-parse --git-common-dir >actual &&
+ test_cmp expected actual
+ )
+'
+

I suggest that we change the result of this call to _always_ return an
absolute path.  I would be willing to code this change, but I didn't
want to start anything that may be considered backwards-incompatible.

This seems related to
[1]http://thread.gmane.org/gmane.comp.version-control.git/286038
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]