Skip to content

Commit 80d868b

Browse files
jrngitster
authored andcommitted
git-rev-parse.txt: clarify --git-dir
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 <[email protected]> Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e0d769d commit 80d868b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Documentation/git-rev-parse.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ appending `/{asterisk}`.
136136
directory (typically a sequence of "../", or an empty string).
137137

138138
--git-dir::
139-
Show `$GIT_DIR` if defined else show the path to the .git directory.
139+
Show `$GIT_DIR` if defined. Otherwise show the path to
140+
the .git directory, relative to the current directory.
141+
+
142+
If `$GIT_DIR` is not defined and the current directory
143+
is not detected to lie in a git repository or work tree
144+
print a message to stderr and exit with nonzero status.
140145

141146
--is-inside-git-dir::
142147
When the current working directory is below the repository

0 commit comments

Comments
 (0)