* [PATCH] enter_repo(): fix suffix precedence documentation @ 2015-03-30 10:30 Paul Tan 2015-03-30 11:08 ` Matthieu Moy 2015-03-30 11:44 ` [PATCH] enter_repo(): fix suffix precedence documentation Jeff King 0 siblings, 2 replies; 8+ messages in thread From: Paul Tan @ 2015-03-30 10:30 UTC (permalink / raw) To: git; +Cc: Paul Tan The ordering of the list of suffixes tested in enter_repo() is documented as "%s.git/.git", "%s/.git", "%s.git", "%s". This does not match the ordering of the list of suffixes tested in the code which is "%s/.git", "%s", "%s.git/.git", "%s.git". Fix this. Signed-off-by: Paul Tan <pyokagan@gmail.com> --- path.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/path.c b/path.c index e608993..6479352 100644 --- a/path.c +++ b/path.c @@ -303,8 +303,8 @@ 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 + * Unless "strict" is given, we try access() for existence of "%s/.git", + * "%s", "%s.git/.git", "%s.git" in this order. The first one that exists is * what we try. * * Second, we try chdir() to that. Upon failure, we return NULL. -- 2.1.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] enter_repo(): fix suffix precedence documentation 2015-03-30 10:30 [PATCH] enter_repo(): fix suffix precedence documentation Paul Tan @ 2015-03-30 11:08 ` Matthieu Moy 2015-03-31 13:39 ` [PATCH v2] enter_repo(): fix docs to match code Paul Tan 2015-03-30 11:44 ` [PATCH] enter_repo(): fix suffix precedence documentation Jeff King 1 sibling, 1 reply; 8+ messages in thread From: Matthieu Moy @ 2015-03-30 11:08 UTC (permalink / raw) To: Paul Tan; +Cc: git Paul Tan <pyokagan@gmail.com> writes: > The ordering of the list of suffixes tested in enter_repo() is > documented as "%s.git/.git", "%s/.git", "%s.git", "%s". This does not > match the ordering of the list of suffixes tested in the code which is > "%s/.git", "%s", "%s.git/.git", "%s.git". Fix this. Indeed: static const char *suffix[] = { "/.git", "", ".git/.git", ".git", NULL, }; So the patch is clearly good. Thanks, -- Matthieu Moy http://www-verimag.imag.fr/~moy/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] enter_repo(): fix docs to match code 2015-03-30 11:08 ` Matthieu Moy @ 2015-03-31 13:39 ` Paul Tan 2015-03-31 17:35 ` Junio C Hamano 0 siblings, 1 reply; 8+ messages in thread From: Paul Tan @ 2015-03-31 13:39 UTC (permalink / raw) To: git; +Cc: Paul Tan, Jeff King On Mon, Mar 30, 2015 at 07:44:08AM -0400, Jeff King wrote: > Yes, this was adjusted in b3256eb (standardize and improve lookup rules > for external local repos, 2012-02-02), but I failed to update the > comment. > > Your patch is certainly an improvement, but I think there are more > inaccuracies in the comment caused by that commit. Maybe squash this on > top: Thanks for catching. I've squashed the patches and rewrote the commit message. -->8-- 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. Documentation contributed by Jeff King. 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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] enter_repo(): fix docs to match code 2015-03-31 13:39 ` [PATCH v2] enter_repo(): fix docs to match code Paul Tan @ 2015-03-31 17:35 ` Junio C Hamano 2015-03-31 17:41 ` Jeff King 2015-03-31 18:10 ` [PATCH v3] " Paul Tan 0 siblings, 2 replies; 8+ messages in thread From: Junio C Hamano @ 2015-03-31 17:35 UTC (permalink / raw) To: Paul Tan; +Cc: git, Jeff King Paul Tan <pyokagan@gmail.com> writes: > On Mon, Mar 30, 2015 at 07:44:08AM -0400, Jeff King wrote: >> Yes, this was adjusted in b3256eb (standardize and improve lookup rules >> for external local repos, 2012-02-02), but I failed to update the >> comment. >> >> Your patch is certainly an improvement, but I think there are more >> inaccuracies in the comment caused by that commit. Maybe squash this on >> top: > > Thanks for catching. > > I've squashed the patches and rewrote the commit message. > > -->8-- > > 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. > > Documentation contributed by Jeff King. > > Signed-off-by: Jeff King <peff@peff.net> > Signed-off-by: Paul Tan <pyokagan@gmail.com> > --- 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. > 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] enter_repo(): fix docs to match code 2015-03-31 17:35 ` Junio C Hamano @ 2015-03-31 17:41 ` Jeff King 2015-03-31 17:57 ` Junio C Hamano 2015-03-31 18:10 ` [PATCH v3] " Paul Tan 1 sibling, 1 reply; 8+ messages in thread From: Jeff King @ 2015-03-31 17:41 UTC (permalink / raw) To: Junio C Hamano; +Cc: Paul Tan, git On Tue, Mar 31, 2015 at 10:35:56AM -0700, Junio C Hamano wrote: > > 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. > > > > Documentation contributed by Jeff King. > > > > Signed-off-by: Jeff King <peff@peff.net> > > Signed-off-by: Paul Tan <pyokagan@gmail.com> > > --- > > It appears to me that Peff's "squash" is nullifying everything you > did, so a more truthful attribution might be I'm not sure that's true. The precedence changed, and the "is it valid" check changed. The fix for the first is from Paul, but the latter is from me. My squash (hopefully) retained his half. My half just took more words to change. I'm OK with the attribution either way (I do not need the credit, but am happy to take the blame). -Peff ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] enter_repo(): fix docs to match code 2015-03-31 17:41 ` Jeff King @ 2015-03-31 17:57 ` Junio C Hamano 0 siblings, 0 replies; 8+ messages in thread From: Junio C Hamano @ 2015-03-31 17:57 UTC (permalink / raw) To: Jeff King; +Cc: Paul Tan, git Jeff King <peff@peff.net> writes: > I'm not sure that's true. The precedence changed, and the "is it valid" > check changed. Yeah, I must have misread the review thread. I only noticed that the postimage does not have any lines that v1 changed from the original, but at the word level there indeed are these changes you listed above. Thanks. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3] enter_repo(): fix docs to match code 2015-03-31 17:35 ` Junio C Hamano 2015-03-31 17:41 ` Jeff King @ 2015-03-31 18:10 ` Paul Tan 1 sibling, 0 replies; 8+ messages in thread From: Paul Tan @ 2015-03-31 18:10 UTC (permalink / raw) To: Junio C Hamano; +Cc: Git List, Paul Tan, Jeff King Hi, On Wed, Apr 1, 2015 at 1:35 AM, Junio C Hamano <gitster@pobox.com> wrote: > 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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] enter_repo(): fix suffix precedence documentation 2015-03-30 10:30 [PATCH] enter_repo(): fix suffix precedence documentation Paul Tan 2015-03-30 11:08 ` Matthieu Moy @ 2015-03-30 11:44 ` Jeff King 1 sibling, 0 replies; 8+ messages in thread From: Jeff King @ 2015-03-30 11:44 UTC (permalink / raw) To: Paul Tan; +Cc: git On Mon, Mar 30, 2015 at 06:30:33PM +0800, Paul Tan wrote: > The ordering of the list of suffixes tested in enter_repo() is > documented as "%s.git/.git", "%s/.git", "%s.git", "%s". This does not > match the ordering of the list of suffixes tested in the code which is > "%s/.git", "%s", "%s.git/.git", "%s.git". Fix this. Yes, this was adjusted in b3256eb (standardize and improve lookup rules for external local repos, 2012-02-02), but I failed to update the comment. Your patch is certainly an improvement, but I think there are more inaccuracies in the comment caused by that commit. Maybe squash this on top: diff --git a/path.c b/path.c index 56f50bd..586f2c9 100644 --- a/path.c +++ b/path.c @@ -383,14 +383,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", - * "%s", "%s.git/.git", "%s.git" 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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-03-31 18:10 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-03-30 10:30 [PATCH] enter_repo(): fix suffix precedence documentation Paul Tan 2015-03-30 11:08 ` Matthieu Moy 2015-03-31 13:39 ` [PATCH v2] enter_repo(): fix docs to match code Paul Tan 2015-03-31 17:35 ` Junio C Hamano 2015-03-31 17:41 ` Jeff King 2015-03-31 17:57 ` Junio C Hamano 2015-03-31 18:10 ` [PATCH v3] " Paul Tan 2015-03-30 11:44 ` [PATCH] enter_repo(): fix suffix precedence documentation Jeff King
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.