git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-fetch should not strip off ".git" extension
@ 2008-10-18 11:59 Leo Razoumov
  2008-10-20 10:36 ` Andreas Ericsson
  0 siblings, 1 reply; 13+ messages in thread
From: Leo Razoumov @ 2008-10-18 11:59 UTC (permalink / raw)
  To: Junio C Hamano, git

When source git repository has extension ".git" like in "MyRepo.git"
"git fetch" will drop ".git" extension and refer to it as "MyRepo".

Example:

sh$ git fetch -v ../MyRepo.git master
From ../MyRepo
 * branch            master     -> FETCH_HEAD

sh$ cat .git/FETCH_HEAD
6eb10bd105f2ef7f64c595100c0a850c5b3cfeb9           branch 'master' of ../MyRepo

Please, note that "git fetch" writes "../MyRepo" instead of "../MyRepo.git"

My workflow makes it convenient to have two distinct repositories
(1) "MyRepo"      => where I work daily (WIP)
(2) "MyRepo.git" => --bare repository accessible to others. "MyRepo"
pushes ready changes to "MyRepo.git"
Dropping ".git" extension causes confusion between these two quite
similarly named repositories.

This problem can be easily solved by the patch below that removes the
code that strips off ".git" extension.

--Leo--

----8<-------------------

 builtin-fetch--tool.c |    2 --
 builtin-fetch.c       |    2 --
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
index 7460ab7..5d0b95f 100644
--- a/builtin-fetch--tool.c
+++ b/builtin-fetch--tool.c
@@ -160,8 +160,6 @@ static int append_fetch_head(FILE *fp,
 	for (i = remote_len - 1; remote[i] == '/' && 0 <= i; i--)
 		;
 	remote_len = i + 1;
-	if (4 < i && !strncmp(".git", remote + i - 3, 4))
-		remote_len = i - 3;

 	note_len = 0;
 	if (*what) {
diff --git a/builtin-fetch.c b/builtin-fetch.c
index ee93d3a..28123a5 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -348,8 +348,6 @@ static int store_updated_refs(const char *url,
const char *remote_name,
 		for (i = url_len - 1; url[i] == '/' && 0 <= i; i--)
 			;
 		url_len = i + 1;
-		if (4 < i && !strncmp(".git", url + i - 3, 4))
-			url_len = i - 3;

 		note_len = 0;
 		if (*what) {

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-18 11:59 [PATCH] git-fetch should not strip off ".git" extension Leo Razoumov
@ 2008-10-20 10:36 ` Andreas Ericsson
  2008-10-20 15:08   ` Leo Razoumov
  2008-10-20 18:37   ` Junio C Hamano
  0 siblings, 2 replies; 13+ messages in thread
From: Andreas Ericsson @ 2008-10-20 10:36 UTC (permalink / raw)
  To: SLONIK.AZ; +Cc: Junio C Hamano, git

Leo Razoumov wrote:
> When source git repository has extension ".git" like in "MyRepo.git"
> "git fetch" will drop ".git" extension and refer to it as "MyRepo".
> 
> Example:
> 
> sh$ git fetch -v ../MyRepo.git master
> From ../MyRepo
>  * branch            master     -> FETCH_HEAD
> 
> sh$ cat .git/FETCH_HEAD
> 6eb10bd105f2ef7f64c595100c0a850c5b3cfeb9           branch 'master' of ../MyRepo
> 
> Please, note that "git fetch" writes "../MyRepo" instead of "../MyRepo.git"
> 
> My workflow makes it convenient to have two distinct repositories
> (1) "MyRepo"      => where I work daily (WIP)
> (2) "MyRepo.git" => --bare repository accessible to others. "MyRepo"
> pushes ready changes to "MyRepo.git"
> Dropping ".git" extension causes confusion between these two quite
> similarly named repositories.
> 
> This problem can be easily solved by the patch below that removes the
> code that strips off ".git" extension.
> 
> --Leo--
> 
> ----8<-------------------
> 
>  builtin-fetch--tool.c |    2 --
>  builtin-fetch.c       |    2 --
>  2 files changed, 0 insertions(+), 4 deletions(-)
> 
> diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
> index 7460ab7..5d0b95f 100644
> --- a/builtin-fetch--tool.c
> +++ b/builtin-fetch--tool.c
> @@ -160,8 +160,6 @@ static int append_fetch_head(FILE *fp,
>  	for (i = remote_len - 1; remote[i] == '/' && 0 <= i; i--)
>  		;
>  	remote_len = i + 1;
> -	if (4 < i && !strncmp(".git", remote + i - 3, 4))
> -		remote_len = i - 3;
> 
>  	note_len = 0;
>  	if (*what) {
> diff --git a/builtin-fetch.c b/builtin-fetch.c
> index ee93d3a..28123a5 100644
> --- a/builtin-fetch.c
> +++ b/builtin-fetch.c
> @@ -348,8 +348,6 @@ static int store_updated_refs(const char *url,
> const char *remote_name,
>  		for (i = url_len - 1; url[i] == '/' && 0 <= i; i--)
>  			;
>  		url_len = i + 1;
> -		if (4 < i && !strncmp(".git", url + i - 3, 4))
> -			url_len = i - 3;
> 

Will this still play nicely with

   git clone foo.git

?

Otherwise, please also fix the fallout from this patch.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-20 10:36 ` Andreas Ericsson
@ 2008-10-20 15:08   ` Leo Razoumov
  2008-10-20 18:37   ` Junio C Hamano
  1 sibling, 0 replies; 13+ messages in thread
From: Leo Razoumov @ 2008-10-20 15:08 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: Junio C Hamano, git

On 10/20/08, Andreas Ericsson <ae@op5.se> wrote:
> [..snip..]]
>  Will this still play nicely with
>
>   git clone foo.git
>
>  ?
>
>  Otherwise, please also fix the fallout from this patch.
>
>  --

Andreas,
thanks for the comment. I have been testing this patch for over two
weeks already and so far encountered no problems. I routinely perform
"git clone foo.git" and it works correctly creating new repo "foo" and
properly populating it.

--Leo--

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-20 10:36 ` Andreas Ericsson
  2008-10-20 15:08   ` Leo Razoumov
@ 2008-10-20 18:37   ` Junio C Hamano
  2008-10-21 10:23     ` Leo Razoumov
  1 sibling, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2008-10-20 18:37 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: SLONIK.AZ, git

Andreas Ericsson <ae@op5.se> writes:

>>...
>>
>>  builtin-fetch--tool.c |    2 --
>>  builtin-fetch.c       |    2 --
>>  2 files changed, 0 insertions(+), 4 deletions(-)
>>
>> diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
>> index 7460ab7..5d0b95f 100644
>> --- a/builtin-fetch--tool.c
>> +++ b/builtin-fetch--tool.c
>> @@ -160,8 +160,6 @@ static int append_fetch_head(FILE *fp,
>>  	for (i = remote_len - 1; remote[i] == '/' && 0 <= i; i--)
>>  		;
>>  	remote_len = i + 1;
>> -	if (4 < i && !strncmp(".git", remote + i - 3, 4))
>> -		remote_len = i - 3;
>>
>>  	note_len = 0;
>>  	if (*what) {
>> diff --git a/builtin-fetch.c b/builtin-fetch.c
>> index ee93d3a..28123a5 100644
>> --- a/builtin-fetch.c
>> +++ b/builtin-fetch.c
>> @@ -348,8 +348,6 @@ static int store_updated_refs(const char *url,
>> const char *remote_name,
>>  		for (i = url_len - 1; url[i] == '/' && 0 <= i; i--)
>>  			;
>>  		url_len = i + 1;
>> -		if (4 < i && !strncmp(".git", url + i - 3, 4))
>> -			url_len = i - 3;
>>
> 
> Will this still play nicely with
>
>   git clone foo.git
>
> ?

I think it would.

As far as I can tell, the only thing the patch changes is to disable the
long established "repository name clean-up" feature in the autogenerated
merge messages (iow, input to "fmt-merge-msg").

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-20 18:37   ` Junio C Hamano
@ 2008-10-21 10:23     ` Leo Razoumov
  2008-10-21 16:56       ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Leo Razoumov @ 2008-10-21 10:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Andreas Ericsson, git

On 10/20/08, Junio C Hamano <gitster@pobox.com> wrote:
> Andreas Ericsson <ae@op5.se> writes:
>
>  >>...
>
> >>
>  >>  builtin-fetch--tool.c |    2 --
>  >>  builtin-fetch.c       |    2 --
>  >>  2 files changed, 0 insertions(+), 4 deletions(-)
>  >>
>  >> diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
>  >> index 7460ab7..5d0b95f 100644
>  >> --- a/builtin-fetch--tool.c
>  >> +++ b/builtin-fetch--tool.c
>  >> @@ -160,8 +160,6 @@ static int append_fetch_head(FILE *fp,
>  >>      for (i = remote_len - 1; remote[i] == '/' && 0 <= i; i--)
>  >>              ;
>  >>      remote_len = i + 1;
>  >> -    if (4 < i && !strncmp(".git", remote + i - 3, 4))
>  >> -            remote_len = i - 3;
>  >>
>  >>      note_len = 0;
>  >>      if (*what) {
>  >> diff --git a/builtin-fetch.c b/builtin-fetch.c
>  >> index ee93d3a..28123a5 100644
>  >> --- a/builtin-fetch.c
>  >> +++ b/builtin-fetch.c
>  >> @@ -348,8 +348,6 @@ static int store_updated_refs(const char *url,
>  >> const char *remote_name,
>  >>              for (i = url_len - 1; url[i] == '/' && 0 <= i; i--)
>  >>                      ;
>  >>              url_len = i + 1;
>  >> -            if (4 < i && !strncmp(".git", url + i - 3, 4))
>  >> -                    url_len = i - 3;
>  >>
>  >
>  > Will this still play nicely with
>  >
>  >   git clone foo.git
>  >
>  > ?
>
>
> I think it would.
>
>  As far as I can tell, the only thing the patch changes is to disable the
>  long established "repository name clean-up" feature in the autogenerated
>  merge messages (iow, input to "fmt-merge-msg").

Even though the old behavior is "long established", it introduces
unnecessary ambiguity. If I have two repos

(1) Foo      #private repo where I do my daily work
(2) Foo.git #exported public repo

the current behavior makes git messages confuse the repos.

--Leo--

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-21 10:23     ` Leo Razoumov
@ 2008-10-21 16:56       ` Junio C Hamano
  2008-10-21 22:06         ` Alex Riesen
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2008-10-21 16:56 UTC (permalink / raw)
  To: SLONIK.AZ; +Cc: Junio C Hamano, Andreas Ericsson, git

"Leo Razoumov" <slonik.az@gmail.com> writes:

> Even though the old behavior is "long established", it introduces
> unnecessary ambiguity. If I have two repos
> ...

Of course.  Now you know why people don't name such a pair of repositories
like that ;-).

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-21 16:56       ` Junio C Hamano
@ 2008-10-21 22:06         ` Alex Riesen
  2008-10-21 22:36           ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Alex Riesen @ 2008-10-21 22:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: SLONIK.AZ, Andreas Ericsson, git

2008/10/21 Junio C Hamano <gitster@pobox.com>:
> "Leo Razoumov" <slonik.az@gmail.com> writes:
>
>> Even though the old behavior is "long established", it introduces
>> unnecessary ambiguity. If I have two repos
>> ...
>
> Of course.  Now you know why people don't name such a pair of repositories
> like that ;-).

FWIW, I support Leo on that. The "established" behavior is stupid.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-21 22:06         ` Alex Riesen
@ 2008-10-21 22:36           ` Junio C Hamano
  2008-10-21 22:43             ` Alex Riesen
                               ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Junio C Hamano @ 2008-10-21 22:36 UTC (permalink / raw)
  To: Alex Riesen; +Cc: SLONIK.AZ, Andreas Ericsson, git

"Alex Riesen" <raa.lkml@gmail.com> writes:

> 2008/10/21 Junio C Hamano <gitster@pobox.com>:
>> "Leo Razoumov" <slonik.az@gmail.com> writes:
>>
>>> Even though the old behavior is "long established", it introduces
>>> unnecessary ambiguity. If I have two repos
>>> ...
>>
>> Of course.  Now you know why people don't name such a pair of repositories
>> like that ;-).
>
> FWIW, I support Leo on that. The "established" behavior is stupid.

I am not inclined to respond to such an emotional argument.  On the other
hand, it is fair to say that the existing behaviour is established,
because it is backed by a long history, which you can objectively verify.

If you think about it deeper, you will realize that it is not even clear
if it is "stupid".

More importantly, the behaviour is consistent with the way how "git fetch"
and "git clone" DWIMs the repository name by suffixing .git when the input
lacks it.  And this DWIMmery comes from the expectations that:

 (1) people name their repository project.git; and

 (2) people like using and seeing short names (iow, "clone
     git://$somewhere/project" is preferred over "clone
     git://$somewhere/project.git");

If a repository whose real location is git://$somewhere/project.git is
cloned/fetched as git://$somewhere/project by people, recording the merge
source using the shorter name used by people to fetch from it is more
consistent.  The patch breaks this consistency [*1*].

What is clear is that you would confuse yourself if you have two
repositories A and A.git next to each other, and that is primarily because
it breaks the above expectation.

git core-level rarely imposes such policies, but what Porcelains do is a
different matter.

Hence the suggestion: don't do it.

[Footnote]

*1* It would be a different matter if the patch at the same time removed
the fetch/clone DWIMmery.  At least such a patch would be internally self
consistent.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-21 22:36           ` Junio C Hamano
@ 2008-10-21 22:43             ` Alex Riesen
  2008-10-22  7:55               ` Andreas Ericsson
  2008-10-21 23:35             ` Junio C Hamano
                               ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Alex Riesen @ 2008-10-21 22:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: SLONIK.AZ, Andreas Ericsson, git

2008/10/22 Junio C Hamano <gitster@pobox.com>:
> "Alex Riesen" <raa.lkml@gmail.com> writes:
>>
>> FWIW, I support Leo on that. The "established" behavior is stupid.
>
> I am not inclined to respond to such an emotional argument.  On the other
> hand, it is fair to say that the existing behaviour is established,
> because it is backed by a long history, which you can objectively verify.

I found it illogical (well, stupid) and inconvinient

> *1* It would be a different matter if the patch at the same time removed
> the fetch/clone DWIMmery.  At least such a patch would be internally self
> consistent.

Good idea.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-21 22:36           ` Junio C Hamano
  2008-10-21 22:43             ` Alex Riesen
@ 2008-10-21 23:35             ` Junio C Hamano
  2008-10-22 11:35             ` Leo Razoumov
  2008-10-22 11:50             ` Leo Razoumov
  3 siblings, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2008-10-21 23:35 UTC (permalink / raw)
  To: Alex Riesen; +Cc: SLONIK.AZ, Andreas Ericsson, git

Junio C Hamano <gitster@pobox.com> writes:

> More importantly, the behaviour is consistent with the way how "git fetch"
> and "git clone" DWIMs the repository name by suffixing .git when the input
> lacks it.  And this DWIMmery comes from the expectations that:
>
>  (1) people name their repository project.git; and
>
>  (2) people like using and seeing short names (iow, "clone
>      git://$somewhere/project" is preferred over "clone
>      git://$somewhere/project.git");
>
> If a repository whose real location is git://$somewhere/project.git is
> cloned/fetched as git://$somewhere/project by people, recording the merge
> source using the shorter name used by people to fetch from it is more
> consistent.  The patch breaks this consistency [*1*].
> ...
> [Footnote]
>
> *1* It would be a different matter if the patch at the same time removed
> the fetch/clone DWIMmery.  At least such a patch would be internally self
> consistent.

Actually, after looking at what the involved codepaths do, I am inclined
to change my mind.  Somehow I thought the transport.c infrastructure DWIMs
and uses the result of DWIMmery throughout the program (iow, at the point
in the codepath the patch touches, we cannot tell what the user originally
asked for), which is not the case at all.  That changes everything.

The current behaviour is Ok if you match your behaviour to the original
expectations, but:

 * if you clone from "git://$somewhere/project" originally, your
   remote.origin.url will not end with ".git";

 * or equivalently, if your remote.origin.url does not end with ".git".

and when you fetch in such a repository with or without the patch, the
results are the same.  URL without trailing ".git".

So the change in the behaviour is only when you originally explicitly
asked to clone "git://$somewhere/project.git".  With the change, that wish
is preserved.  Without the change, ".git" is unconditionally dropped.

The situation is the same if you explicitly ask to fetch from a URL that
ends with ".git" (or "/.git").  With the change, the explicit ".git" is
preserved; without it, it is dropped.

So I now think the patch (if it were massaged into an applicable shape
with proper log message and sign-off) is an improvement.

Alex, thanks for sanity checking ;-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-21 22:43             ` Alex Riesen
@ 2008-10-22  7:55               ` Andreas Ericsson
  0 siblings, 0 replies; 13+ messages in thread
From: Andreas Ericsson @ 2008-10-22  7:55 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Junio C Hamano, SLONIK.AZ, git

Alex Riesen wrote:
> 2008/10/22 Junio C Hamano <gitster@pobox.com>:
>> "Alex Riesen" <raa.lkml@gmail.com> writes:
>>> FWIW, I support Leo on that. The "established" behavior is stupid.
>> I am not inclined to respond to such an emotional argument.  On the other
>> hand, it is fair to say that the existing behaviour is established,
>> because it is backed by a long history, which you can objectively verify.
> 
> I found it illogical (well, stupid) and inconvinient
> 
>> *1* It would be a different matter if the patch at the same time removed
>> the fetch/clone DWIMmery.  At least such a patch would be internally self
>> consistent.
> 
> Good idea.

No. Bad idea. That would not only break people's fetch configurations if
they've done clone on repos without passing .git, but also mean users
would have to remember if a particular server names their bare repos
"project.git".

If you remove *all* DWIMmery from fetch/clone, you'd also break people's
expectations when they're fetching from each other, as they'd have to pass
"git://devpeer/project/.git" instead of just "git://devpeer/project", which
is what *looks* sane.

A good idea would be to always report the name the user used. 'git clone'
already does that, recording the non-DWIMmed URL in the remotes config.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-21 22:36           ` Junio C Hamano
  2008-10-21 22:43             ` Alex Riesen
  2008-10-21 23:35             ` Junio C Hamano
@ 2008-10-22 11:35             ` Leo Razoumov
  2008-10-22 11:50             ` Leo Razoumov
  3 siblings, 0 replies; 13+ messages in thread
From: Leo Razoumov @ 2008-10-22 11:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Alex Riesen, Andreas Ericsson, git

On 10/21/08, Junio C Hamano <gitster@pobox.com> wrote:
> "Alex Riesen" <raa.lkml@gmail.com> writes:
>
>  > 2008/10/21 Junio C Hamano <gitster@pobox.com>:
>  >> "Leo Razoumov" <slonik.az@gmail.com> writes:
>  >>
>  >>> Even though the old behavior is "long established", it introduces
>  >>> unnecessary ambiguity. If I have two repos
>  >>> ...
>  >>
>  >> Of course.  Now you know why people don't name such a pair of repositories
>  >> like that ;-).
>  >
>  > FWIW, I support Leo on that. The "established" behavior is stupid.
>
>
> I am not inclined to respond to such an emotional argument.  On the other
>  hand, it is fair to say that the existing behaviour is established,
>  because it is backed by a long history, which you can objectively verify.
>
>  If you think about it deeper, you will realize that it is not even clear
>  if it is "stupid".
>
>  More importantly, the behaviour is consistent with the way how "git fetch"
>  and "git clone" DWIMs the repository name by suffixing .git when the input
>  lacks it.  And this DWIMmery comes from the expectations that:
>
>   (1) people name their repository project.git; and
>
>   (2) people like using and seeing short names (iow, "clone
>      git://$somewhere/project" is preferred over "clone
>      git://$somewhere/project.git");
>
>  If a repository whose real location is git://$somewhere/project.git is
>  cloned/fetched as git://$somewhere/project by people, recording the merge
>  source using the shorter name used by people to fetch from it is more
>  consistent.  The patch breaks this consistency [*1*].
>
>  What is clear is that you would confuse yourself if you have two
>  repositories A and A.git next to each other, and that is primarily because
>  it breaks the above expectation.
>
>  git core-level rarely imposes such policies, but what Porcelains do is a
>  different matter.
>
>  Hence the suggestion: don't do it.
>
>  [Footnote]
>
>  *1* It would be a different matter if the patch at the same time removed
>  the fetch/clone DWIMmery.  At least such a patch would be internally self
>  consistent.
>

I think this discussion went in the direction of "correct" versus
"convent". I, personally, will choose correct over convenient any
time. Different people use git for different projects and their
expectations differ in this regard. In my case
after I do "git clone Foo.git" I get "Foo" repo side-by-side with
"Foo.git" and the ambiguity becomes apparent.

Regarding your footnote *1*. I agree with your suggestions and I can
improve the patch in the following way:

(1) Fetch/clone messages/comments will refer to the source/destination
repos by their complete names without stripping off any parts
(2) Searching for a source repo, clone/fetch will first try an exact
match and if it fails it will remove/add ".git" suffix and

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] git-fetch should not strip off ".git" extension
  2008-10-21 22:36           ` Junio C Hamano
                               ` (2 preceding siblings ...)
  2008-10-22 11:35             ` Leo Razoumov
@ 2008-10-22 11:50             ` Leo Razoumov
  3 siblings, 0 replies; 13+ messages in thread
From: Leo Razoumov @ 2008-10-22 11:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Alex Riesen, Andreas Ericsson, git

My apologies!! I hit send button by mistake before message was
complete. Please, see below a completed version.
--Leo--

On 10/21/08, Junio C Hamano <gitster@pobox.com> wrote:
> "Alex Riesen" <raa.lkml@gmail.com> writes:
>
>  > 2008/10/21 Junio C Hamano <gitster@pobox.com>:
>  >> "Leo Razoumov" <slonik.az@gmail.com> writes:
>  >>
>  >>> Even though the old behavior is "long established", it introduces
>  >>> unnecessary ambiguity. If I have two repos
>  >>> ...
>  >>
>  >> Of course.  Now you know why people don't name such a pair of repositories
>  >> like that ;-).
>  >
>  > FWIW, I support Leo on that. The "established" behavior is stupid.
>
>
> I am not inclined to respond to such an emotional argument.  On the other
>  hand, it is fair to say that the existing behaviour is established,
>  because it is backed by a long history, which you can objectively verify.
>
>  If you think about it deeper, you will realize that it is not even clear
>  if it is "stupid".
>
>  More importantly, the behaviour is consistent with the way how "git fetch"
>  and "git clone" DWIMs the repository name by suffixing .git when the input
>  lacks it.  And this DWIMmery comes from the expectations that:
>
>   (1) people name their repository project.git; and
>
>   (2) people like using and seeing short names (iow, "clone
>      git://$somewhere/project" is preferred over "clone
>      git://$somewhere/project.git");
>
>  If a repository whose real location is git://$somewhere/project.git is
>  cloned/fetched as git://$somewhere/project by people, recording the merge
>  source using the shorter name used by people to fetch from it is more
>  consistent.  The patch breaks this consistency [*1*].
>
>  What is clear is that you would confuse yourself if you have two
>  repositories A and A.git next to each other, and that is primarily because
>  it breaks the above expectation.
>
>  git core-level rarely imposes such policies, but what Porcelains do is a
>  different matter.
>
>  Hence the suggestion: don't do it.
>
>  [Footnote]
>
>  *1* It would be a different matter if the patch at the same time removed
>  the fetch/clone DWIMmery.  At least such a patch would be internally self
>  consistent.
>

I think this discussion went in the direction of "correct" versus
"convent". I, personally, will choose correct over convenient any
time. Different people use git for different projects and their
expectations differ in this regard. In my case
after I do "git clone Foo.git" I get "Foo" repo side-by-side with
"Foo.git" and the ambiguity becomes apparent.

Regarding your footnote *1*. I agree with your suggestions and I can
improve the patch in the following way:

(P1) Fetch/clone messages/records will refer to the source/destination
repos by their complete names without stripping off any parts of the name.

(P2) Searching for a source repo, clone/fetch will first try an exact
match and if it fails it will remove/add ".git" suffix as needed and retry.

Item (P2) will provide the convenience, while item (P1) still
guarantees correctness.

Please, let me know if such approach is more satisfactory.

--Leo--

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-10-22 11:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-18 11:59 [PATCH] git-fetch should not strip off ".git" extension Leo Razoumov
2008-10-20 10:36 ` Andreas Ericsson
2008-10-20 15:08   ` Leo Razoumov
2008-10-20 18:37   ` Junio C Hamano
2008-10-21 10:23     ` Leo Razoumov
2008-10-21 16:56       ` Junio C Hamano
2008-10-21 22:06         ` Alex Riesen
2008-10-21 22:36           ` Junio C Hamano
2008-10-21 22:43             ` Alex Riesen
2008-10-22  7:55               ` Andreas Ericsson
2008-10-21 23:35             ` Junio C Hamano
2008-10-22 11:35             ` Leo Razoumov
2008-10-22 11:50             ` Leo Razoumov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).