Skip to content

Commit f31dbdc

Browse files
drafnelgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a1d558d commit f31dbdc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

builtin/fetch.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ static struct ref *get_ref_map(struct transport *transport,
148148
int has_merge = branch_has_merge_config(branch);
149149
if (remote &&
150150
(remote->fetch_refspec_nr ||
151+
/* Note: has_merge implies non-NULL branch->remote_name */
151152
(has_merge && !strcmp(branch->remote_name, remote->name)))) {
152153
for (i = 0; i < remote->fetch_refspec_nr; i++) {
153154
get_fetch_map(remote_refs, &remote->fetch[i], &tail, 0);
@@ -162,6 +163,8 @@ static struct ref *get_ref_map(struct transport *transport,
162163
* if the remote we're fetching from is the same
163164
* as given in branch.<name>.remote, we add the
164165
* ref given in branch.<name>.merge, too.
166+
*
167+
* Note: has_merge implies non-NULL branch->remote_name
165168
*/
166169
if (has_merge &&
167170
!strcmp(branch->remote_name, remote->name))

0 commit comments

Comments
 (0)