Re: [PATCH 35/42] rev-parse: prints --git-dir relative to user's cwd

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

 



>> 2010/10/28 Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx>:

>>> git-rev-parse.txt does not say much about this. But I'm sure
>>> git-sh-setup.sh wants "git rev-parse --git-dir" be relative to user's
>>> cwd.

Yes, $(git rev-parse --git-dir) should be relative to the caller's
working directory, or else git-sh-setup in the ! "$NONGIT_OK" case
will fail, as you noticed.

Maybe this can be clarified?

The current behavior is often to print an absolute path rather than
a ../../etc string, but callers must be ready to accept a relative
path, too.  The most common output is ".git" (from the toplevel of
an ordinary work tree).

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 4a27643..10321cd 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -136,7 +136,12 @@ appending `/{asterisk}`.
 	directory (typically a sequence of "../", or an empty string).
 
 --git-dir::
-	Show `$GIT_DIR` if defined else show the path to the .git directory.
+	Show `$GIT_DIR` if defined.  Otherwise, show the path to
+	the .git directory, relative to the current directory.
++
+If `$GIT_DIR` is not defined and the current directory
+is not detected to lie in a git repository or work tree,
+print a message to stderr and exit with nonzero status.
 
 --is-inside-git-dir::
 	When the current working directory is below the repository
--
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]