All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruen@suse.de>
To: git@vger.kernel.org
Subject: [PATCH 1/3] receive-pack: Two small code cleanups
Date: Wed, 24 Feb 2010 16:33:33 +0100	[thread overview]
Message-ID: <f409d0cde7939a833708ed92f86605dbbdd64a49.1267029680.git.agruen@suse.de> (raw)
In-Reply-To: <cover.1267029680.git.agruen@suse.de>

Rename show_ref()'s path parameter to refname.

In read_head_info(), lines may have trailing capability strings.  Throw
away such strings after evaluation; they are not needed in the command
structs.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
---
 builtin-receive-pack.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/builtin-receive-pack.c b/builtin-receive-pack.c
index 0559fcc..77cbc2a 100644
--- a/builtin-receive-pack.c
+++ b/builtin-receive-pack.c
@@ -105,13 +105,13 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
 	return git_default_config(var, value, cb);
 }
 
-static int show_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
+static int show_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
 {
 	if (sent_capabilities)
-		packet_write(1, "%s %s\n", sha1_to_hex(sha1), path);
+		packet_write(1, "%s %s\n", sha1_to_hex(sha1), refname);
 	else
 		packet_write(1, "%s %s%c%s%s\n",
-			     sha1_to_hex(sha1), path, 0,
+			     sha1_to_hex(sha1), refname, 0,
 			     " report-status delete-refs side-band-64k",
 			     prefer_ofs_delta ? " ofs-delta" : "");
 	sent_capabilities = 1;
@@ -524,7 +524,7 @@ static void read_head_info(void)
 		static char line[1000];
 		unsigned char old_sha1[20], new_sha1[20];
 		struct command *cmd;
-		char *refname;
+		const char *refname;
 		int len, reflen;
 
 		len = packet_read_line(0, line, sizeof(line));
@@ -548,10 +548,10 @@ static void read_head_info(void)
 			if (strstr(refname + reflen + 1, "side-band-64k"))
 				use_sideband = LARGE_PACKET_MAX;
 		}
-		cmd = xmalloc(sizeof(struct command) + len - 80);
+		cmd = xmalloc(sizeof(struct command) + reflen + 1);
 		hashcpy(cmd->old_sha1, old_sha1);
 		hashcpy(cmd->new_sha1, new_sha1);
-		memcpy(cmd->ref_name, line + 82, len - 81);
+		memcpy(cmd->ref_name, refname, reflen + 1);
 		cmd->error_string = NULL;
 		cmd->next = NULL;
 		*p = cmd;
-- 
1.6.6.243.gff6d2

  reply	other threads:[~2010-02-24 17:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-24 16:41 [RFC][PATCH 0/3] Different views on a repository Andreas Gruenbacher
2010-02-24 15:33 ` Andreas Gruenbacher [this message]
2010-02-24 15:57   ` [PATCH 2/3] " Andreas Gruenbacher
2010-02-24 16:14     ` [PATCH 3/3] Different views on a repository: HEAD mapping Andreas Gruenbacher
2010-02-24 17:42     ` [PATCH 2/3] Different views on a repository Shawn O. Pearce
2010-02-25  9:01     ` Michael J Gruber
2010-02-25  9:25       ` Andreas Gruenbacher
2010-02-25 12:30         ` Michael J Gruber
2010-02-25 14:35           ` Andreas Gruenbacher
2010-02-25 17:28             ` Junio C Hamano
2010-02-26  0:45               ` Andreas Gruenbacher
2010-02-26 21:35                 ` Andreas Gruenbacher
2010-02-24 17:29   ` [PATCH 1/3] receive-pack: Two small code cleanups Shawn O. Pearce
2010-02-25 20:13 ` [RFC][PATCH 0/3] Different views on a repository James Pickens
2010-02-26  4:30 ` Adam Brewster
     [not found] ` <c376da901002252012s507a6921q922e606bdce4b4fa@mail.gmail.com>
2010-02-26 12:01   ` Andreas Gruenbacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f409d0cde7939a833708ed92f86605dbbdd64a49.1267029680.git.agruen@suse.de \
    --to=agruen@suse.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.