mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
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>
This commit is contained in:
parent
a1d558d254
commit
f31dbdc7da
1 changed files with 3 additions and 0 deletions
|
@ -148,6 +148,7 @@ static struct ref *get_ref_map(struct transport *transport,
|
||||||
int has_merge = branch_has_merge_config(branch);
|
int has_merge = branch_has_merge_config(branch);
|
||||||
if (remote &&
|
if (remote &&
|
||||||
(remote->fetch_refspec_nr ||
|
(remote->fetch_refspec_nr ||
|
||||||
|
/* Note: has_merge implies non-NULL branch->remote_name */
|
||||||
(has_merge && !strcmp(branch->remote_name, remote->name)))) {
|
(has_merge && !strcmp(branch->remote_name, remote->name)))) {
|
||||||
for (i = 0; i < remote->fetch_refspec_nr; i++) {
|
for (i = 0; i < remote->fetch_refspec_nr; i++) {
|
||||||
get_fetch_map(remote_refs, &remote->fetch[i], &tail, 0);
|
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
|
* if the remote we're fetching from is the same
|
||||||
* as given in branch.<name>.remote, we add the
|
* as given in branch.<name>.remote, we add the
|
||||||
* ref given in branch.<name>.merge, too.
|
* ref given in branch.<name>.merge, too.
|
||||||
|
*
|
||||||
|
* Note: has_merge implies non-NULL branch->remote_name
|
||||||
*/
|
*/
|
||||||
if (has_merge &&
|
if (has_merge &&
|
||||||
!strcmp(branch->remote_name, remote->name))
|
!strcmp(branch->remote_name, remote->name))
|
||||||
|
|
Loading…
Reference in a new issue