git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/9] git-rev-parse.txt: clarify --git-dir

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Nov 1, 2010, 06:26 UTC
Message-ID
<1288592794-24221-1-git-send-email-pclouds@gmail.com>
In-Reply-To
<AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com>
From: Jonathan Nieder <jrnieder@gmail.com>

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@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 2010/10/30 Sverre Rabbelier <srabbelier@gmail.com>:
 > Heya,
 >
 > 2010/10/28 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:
 >> This helps break things some more. Eventually all repo setup logic
 >> should be centralized in setup_* functions. This helps push all the
 >> bugs back to setup_* functions.
 >
 > I don't know about this, do we really want to willingly break the test
 > suite (and fixing it later)? Perhaps we can review this as-is and then
 > squash the commits before they are merged to next so that there is no
 > breakage? We could even attach the original commits as notes :).
 OK. Take 2. I think it is bisectable this time. This replaces
 35-42 (the fixing part, no need to resend 34 unchanged patches). More notes
 on each patch.
 Documentation/git-rev-parse.txt |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 341ca90..a41f024 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
-- 
1.7.3.2.210.g045198
Previous: Nguyen Thai Ngoc DuyNext: Nguyễn Thái Ngọc Duy
Message 45 of 60 in “repo setup test cases and fixes”
  1. 00/42 repo setup test cases and fixesNguyễn Thái Ngọc Duy, Oct 29, 2010
  2. 01/42 builtins: print setup info if repo is foundNguyễn Thái Ngọc Duy, Oct 29, 2010
  3. 02/42 Add t1510 and basic rules that run repo setupNguyễn Thái Ngọc Duy, Oct 29, 2010
  4. 03/42 t1510: setup case #0Nguyễn Thái Ngọc Duy, Oct 29, 2010
  5. 04/42 t1510: setup case #1Nguyễn Thái Ngọc Duy, Oct 29, 2010
  6. 05/42 t1510: setup case #2Nguyễn Thái Ngọc Duy, Oct 29, 2010
  7. 06/42 t1510: setup case #3Nguyễn Thái Ngọc Duy, Oct 29, 2010
  8. 07/42 t1510: setup case #4Nguyễn Thái Ngọc Duy, Oct 29, 2010
  9. 08/42 t1510: setup case #5Nguyễn Thái Ngọc Duy, Oct 29, 2010
  10. 09/42 t1510: setup case #6Nguyễn Thái Ngọc Duy, Oct 29, 2010
  11. 10/42 t1510: setup case #7Nguyễn Thái Ngọc Duy, Oct 29, 2010
  12. 11/42 t1510: setup case #8Nguyễn Thái Ngọc Duy, Oct 29, 2010
  13. 12/42 t1510: setup case #9Nguyễn Thái Ngọc Duy, Oct 29, 2010
  14. 13/42 t1510: setup case #10Nguyễn Thái Ngọc Duy, Oct 29, 2010
  15. 14/42 t1510: setup case #11Nguyễn Thái Ngọc Duy, Oct 29, 2010
  16. 15/42 t1510: setup case #12Nguyễn Thái Ngọc Duy, Oct 29, 2010
  17. 16/42 t1510: setup case #13Nguyễn Thái Ngọc Duy, Oct 29, 2010
  18. 17/42 t1510: setup case #14Nguyễn Thái Ngọc Duy, Oct 29, 2010
  19. 18/42 t1510: setup case #15Nguyễn Thái Ngọc Duy, Oct 29, 2010
  20. 19/42 t1510: setup case #16Nguyễn Thái Ngọc Duy, Oct 29, 2010
  21. 20/42 t1510: setup case #17Nguyễn Thái Ngọc Duy, Oct 29, 2010
  22. 21/42 t1510: setup case #18Nguyễn Thái Ngọc Duy, Oct 29, 2010
  23. 22/42 t1510: setup case #19Nguyễn Thái Ngọc Duy, Oct 29, 2010
  24. 23/42 t1510: setup case #20Nguyễn Thái Ngọc Duy, Oct 29, 2010
  25. 24/42 t1510: setup case #21Nguyễn Thái Ngọc Duy, Oct 29, 2010
  26. 25/42 t1510: setup case #22Nguyễn Thái Ngọc Duy, Oct 29, 2010
  27. 26/42 t1510: setup case #23Nguyễn Thái Ngọc Duy, Oct 29, 2010
  28. 27/42 t1510: setup case #24Nguyễn Thái Ngọc Duy, Oct 29, 2010
  29. 28/42 t1510: setup case #25Nguyễn Thái Ngọc Duy, Oct 29, 2010
  30. 29/42 t1510: setup case #26Nguyễn Thái Ngọc Duy, Oct 29, 2010
  31. 30/42 t1510: setup case #27Nguyễn Thái Ngọc Duy, Oct 29, 2010
  32. 31/42 t1510: setup case #28Nguyễn Thái Ngọc Duy, Oct 29, 2010
  33. 32/42 t1510: setup case #29Nguyễn Thái Ngọc Duy, Oct 29, 2010
  34. 33/42 t1510: setup case #30Nguyễn Thái Ngọc Duy, Oct 29, 2010
  35. 34/42 t1510: setup case #31Nguyễn Thái Ngọc Duy, Oct 29, 2010
  36. 35/42 rev-parse: prints --git-dir relative to user's cwdNguyễn Thái Ngọc Duy, Oct 29, 2010
  37. Sverre RabbelierOct 29, 2010
  38. Nguyen Thai Ngoc DuyOct 30, 2010
  39. Jonathan NiederOct 30, 2010
  40. 36/42 Add git_config_early()Nguyễn Thái Ngọc Duy, Oct 29, 2010
  41. 37/42 Use git_config_early() instead of git_config() during repo setupNguyễn Thái Ngọc Duy, Oct 29, 2010
  42. 38/42 Remove all logic from get_git_work_tree()Nguyễn Thái Ngọc Duy, Oct 29, 2010
  43. Sverre RabbelierOct 29, 2010
  44. Nguyen Thai Ngoc DuyOct 30, 2010
  45. 1/9 git-rev-parse.txt: clarify --git-dirNguyễn Thái Ngọc Duy, Nov 1, 2010
  46. 2/9 rev-parse: prints --git-dir relative to user's cwdNguyễn Thái Ngọc Duy, Nov 1, 2010
  47. 3/9 Add git_config_early()Nguyễn Thái Ngọc Duy, Nov 1, 2010
  48. 4/9 Use git_config_early() instead of git_config() during repo setupNguyễn Thái Ngọc Duy, Nov 1, 2010
  49. 5/9 setup: limit get_git_work_tree()'s to explicit setup case onlyNguyễn Thái Ngọc Duy, Nov 1, 2010
  50. 6/9 setup: clean up setup_bare_git_dir()Nguyễn Thái Ngọc Duy, Nov 1, 2010
  51. 7/9 setup: clean up setup_discovered_git_dir()Nguyễn Thái Ngọc Duy, Nov 1, 2010
  52. 8/9 setup: rework setup_explicit_git_dir()Nguyễn Thái Ngọc Duy, Nov 1, 2010
  53. 9/9 Remove all logic from get_git_work_tree()Nguyễn Thái Ngọc Duy, Nov 1, 2010
  54. 39/42 setup: clean up setup_bare_git_dir()Nguyễn Thái Ngọc Duy, Oct 29, 2010
  55. 40/42 setup: clean up setup_discovered_git_dir()Nguyễn Thái Ngọc Duy, Oct 29, 2010
  56. 41/42 setup: rework setup_explicit_git_dir()Nguyễn Thái Ngọc Duy, Oct 29, 2010
  57. 42/42 t1510: all failed tests are now fixedNguyễn Thái Ngọc Duy, Oct 29, 2010
  58. Nguyen Thai Ngoc DuyOct 29, 2010
  59. Sverre RabbelierOct 29, 2010
  60. Jonathan NiederOct 29, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.