git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix the remote note the fetch-tool prints after storing a fetched reference
@ 2007-06-06  7:45 Alex Riesen
  2007-06-06  8:14 ` Junio C Hamano
  2007-06-06 15:52 ` Alex Riesen
  0 siblings, 2 replies; 9+ messages in thread
From: Alex Riesen @ 2007-06-06  7:45 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

Otherwise ".git" is removed from every remote name which has it:

  $ git fetch -v
    * refs/heads/origin: same as branch 'master' of /home/user/linux
      commit: 5ecd310
  $ ls /home/user/linux
  ls: /home/user/linux: No such file or directory
  $ ls /home/user/linux.git
  HEAD  objects  packed-refs  ...

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 builtin-fetch--tool.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

[-- Attachment #2: 0001-Fix-the-remote-note-the-fetch-tool-prints-after-stor.txt --]
[-- Type: text/plain, Size: 1536 bytes --]

From 100742821619fdd83e75aa8dcb88489aa4b60648 Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa@limbo.localdomain>
Date: Wed, 6 Jun 2007 00:16:14 +0200
Subject: [PATCH] Fix the remote note the fetch-tool prints after storing a fetched reference

Otherwise ".git" is removed from every remote name which has it:

  $ git fetch -v
    * refs/heads/origin: same as branch 'master' of /home/user/linux
      commit: 5ecd310
  $ ls /home/user/linux
  ls: /home/user/linux: No such file or directory
  $ ls /home/user/linux.git
  HEAD  objects  packed-refs  ...

Signed-off-by: Alex Riesen <raa@limbo.localdomain>
---
 builtin-fetch--tool.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
index ed4d5de..22ca125 100644
--- a/builtin-fetch--tool.c
+++ b/builtin-fetch--tool.c
@@ -140,7 +140,7 @@ static int append_fetch_head(FILE *fp,
 			     int verbose, int force)
 {
 	struct commit *commit;
-	int remote_len, i, note_len;
+	int remote_len, note_len;
 	unsigned char sha1[20];
 	char note[1024];
 	const char *what, *kind;
@@ -173,11 +173,11 @@ static int append_fetch_head(FILE *fp,
 	}
 
 	remote_len = strlen(remote);
-	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;
+	if (remote_len > 5) {
+		char *p = strrchr(remote, '/');
+		if (p && !strcmp(p, "/.git"))
+		    remote_len -= 4;
+	}
 
 	note_len = 0;
 	if (*what) {
-- 
1.5.2.1.134.g352b


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

end of thread, other threads:[~2007-06-06 22:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-06  7:45 [PATCH] Fix the remote note the fetch-tool prints after storing a fetched reference Alex Riesen
2007-06-06  8:14 ` Junio C Hamano
2007-06-06  8:42   ` Alex Riesen
2007-06-06  8:50     ` J Junio C Hamano
2007-06-06 11:27       ` Alex Riesen
2007-06-06 19:28         ` Junio C Hamano
2007-06-06 15:52 ` Alex Riesen
2007-06-06 20:07   ` Junio C Hamano
2007-06-06 22:48     ` Alex Riesen

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