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

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).