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

[PATCH v3] enter_repo(): fix docs to match code

From
Paul Tan <pyokagan@gmail.com>
Date
Mar 31, 2015, 18:10 UTC
Message-ID
<1427825420-406-1-git-send-email-pyokagan@gmail.com>
In-Reply-To
<xmqq4mp1rrwj.fsf@gitster.dls.corp.google.com>
Hi,
On Wed, Apr 1, 2015 at 1:35 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> It appears to me that Peff's "squash" is nullifying everything you
> did, so a more truthful attribution might be
>
>         From: Jeff King <peff@peff.net>
>
>         commit log message
>
>         S-o-b: Jeff
>         S-o-b: Paul Tan
Thanks, didn't know that could be done. Fixed patch (and fixed scissors line) below,
-- >8 --
From: Jeff King <peff@peff.net>

In b3256eb (standardize and improve lookup rules for external local repos), enter_repo() was modified to use a different precedence ordering of suffixes for DWIM of the repository path, and to ensure that the repository path is actually valid instead of just testing for existence. However, the documentation was not modified to reflect these changes. As such, fix the documentation to match the code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
---
 path.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/path.c b/path.c
index e608993..595da81 100644
--- a/path.c
+++ b/path.c
@@ -303,14 +303,9 @@ return_null:
  * (3) "relative/path" to mean cwd relative directory; or
  * (4) "/absolute/path" to mean absolute directory.
  *
- * Unless "strict" is given, we try access() for existence of "%s.git/.git",
- * "%s/.git", "%s.git", "%s" in this order.  The first one that exists is
- * what we try.
- *
- * Second, we try chdir() to that.  Upon failure, we return NULL.
- *
- * Then, we try if the current directory is a valid git repository.
- * Upon failure, we return NULL.
+ * Unless "strict" is given, we check "%s/.git", "%s", "%s.git/.git", "%s.git"
+ * in this order. We select the first one that is a valid git repository, and
+ * chdir() to it. If none match, or we fail to chdir, we return NULL.
  *
  * If all goes well, we return the directory we used to chdir() (but
  * before ~user is expanded), avoiding getcwd() resolving symbolic
-- 
2.1.4
Previous: Junio C HamanoNext: Jeff King
Message 7 of 8 in “enter_repo(): fix suffix precedence documentation”
  1. enter_repo(): fix suffix precedence documentationPaul Tan, Mar 30, 2015
  2. Matthieu MoyMar 30, 2015
  3. enter_repo(): fix docs to match codePaul Tan, Mar 31, 2015
  4. Junio C HamanoMar 31, 2015
  5. Jeff KingMar 31, 2015
  6. Junio C HamanoMar 31, 2015
  7. enter_repo(): fix docs to match codePaul Tan, Mar 31, 2015
  8. Jeff KingMar 30, 2015

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.