git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Brandon Casey <casey@nrlssc.navy.mil>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Brandon Casey <drafnel@gmail.com>
Subject: [PATCH 1/2] builtin/fetch.c: comment that branch->remote_name is usable when has_merge
Date: Thu,  9 Sep 2010 13:56:36 -0500	[thread overview]
Message-ID: <NYNWO-6R8khWRYvZHfeUgclo0qTrx32yM6iROg9eTvmBQn8zP_PDNNLiYY_Cx1TwXuGliHPxYzQ@cipher.nrlssc.navy.mil> (raw)
In-Reply-To: <7vtymipddv.fsf@alter.siamese.dyndns.org>

From: Brandon Casey <drafnel@gmail.com>

Save future readers the trouble of tracing code to determine that the two
uses of branch->remote_name are safe when has_merge is set, by adding a
comment explaining that it is so.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
 builtin/fetch.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index fccc9cb..6fc5047 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -148,6 +148,7 @@ static struct ref *get_ref_map(struct transport *transport,
 		int has_merge = branch_has_merge_config(branch);
 		if (remote &&
 		    (remote->fetch_refspec_nr ||
+		     /* Note: has_merge implies non-NULL branch->remote_name */
 		     (has_merge && !strcmp(branch->remote_name, remote->name)))) {
 			for (i = 0; i < remote->fetch_refspec_nr; i++) {
 				get_fetch_map(remote_refs, &remote->fetch[i], &tail, 0);
@@ -162,6 +163,8 @@ static struct ref *get_ref_map(struct transport *transport,
 			 * if the remote we're fetching from is the same
 			 * as given in branch.<name>.remote, we add the
 			 * ref given in branch.<name>.merge, too.
+			 *
+			 * Note: has_merge implies non-NULL branch->remote_name
 			 */
 			if (has_merge &&
 			    !strcmp(branch->remote_name, remote->name))
-- 
1.7.2.1

  reply	other threads:[~2010-09-09 19:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-24  6:59 reducing object store size with remote alternates or shallow clone? Kumar Gala
2010-08-24 16:45 ` Junio C Hamano
2010-08-24 18:15   ` Brandon Casey
2010-08-24 18:59     ` Junio C Hamano
2010-08-24 23:29       ` Brandon Casey
2010-08-25 17:52         ` [PATCH 1/2] t/t5510: demonstrate failure to fetch when current branch has merge ref Brandon Casey
2010-08-25 21:28           ` Junio C Hamano
2010-08-25 17:52         ` [PATCH 2/2] builtin/fetch.c: ignore merge config when not fetching from branch's remote Brandon Casey
2010-08-25 21:16           ` Jonathan Nieder
2010-08-25 21:41             ` Brandon Casey
2010-08-25 21:54           ` Junio C Hamano
2010-09-09 18:56             ` Brandon Casey [this message]
2010-09-09 18:56             ` [PATCH 2/2] t/t5510-fetch.sh: improve testing with explicit URL and merge spec Brandon Casey

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=NYNWO-6R8khWRYvZHfeUgclo0qTrx32yM6iROg9eTvmBQn8zP_PDNNLiYY_Cx1TwXuGliHPxYzQ@cipher.nrlssc.navy.mil \
    --to=casey@nrlssc.navy.mil \
    --cc=drafnel@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).