@matheusbsbs / matheus-bagliano / commits / f31dbdc7da
Fork 0

builtin/fetch.c: comment that branch->remote_name is usable when has_merge

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Casey committed Sep 9, 2010 at 13:56 UTC f31dbdc7dad3511e1ee73cb04a032773d11231cd
1 file changed +3
builtin/fetch.c
+3
@@ -148,6 +148,7 @@ static struct ref *get_ref_map(struct transport *transport,
148 int has_merge = branch_has_merge_config(branch);
149 if (remote &&
150 (remote->fetch_refspec_nr ||
151 + /* Note: has_merge implies non-NULL branch->remote_name */
152 (has_merge && !strcmp(branch->remote_name, remote->name)))) {
153 for (i = 0; i < remote->fetch_refspec_nr; i++) {
154 get_fetch_map(remote_refs, &remote->fetch[i], &tail, 0);
@@ -162,6 +163,8 @@ static struct ref *get_ref_map(struct transport *transport,
163 * if the remote we're fetching from is the same
164 * as given in branch.<name>.remote, we add the
165 * ref given in branch.<name>.merge, too.
166 + *
167 + * Note: has_merge implies non-NULL branch->remote_name
168 */
169 if (has_merge &&
170 !strcmp(branch->remote_name, remote->name))