Skip to content

Commit dff9d65

Browse files
flyingflogitster
authored andcommitted
Add explanatory comment for transport-helpers refs mapping.
The patch below adds a comment to fetch_with_import() explaining the loop that saves the fetched commit names after 'git fast-import' has done its work. It avoids some confusion about which refs the fast-import stream is supposed to use to write its result. Signed-off-by: Florian Achleitner <[email protected]> Helped-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 425b8a2 commit dff9d65

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

transport-helper.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,21 @@ static int fetch_with_import(struct transport *transport,
444444
free(fastimport.argv);
445445
fastimport.argv = NULL;
446446

447+
/*
448+
* The fast-import stream of a remote helper that advertises
449+
* the "refspec" capability writes to the refs named after the
450+
* right hand side of the first refspec matching each ref we
451+
* were fetching.
452+
*
453+
* (If no "refspec" capability was specified, for historical
454+
* reasons we default to *:*.)
455+
*
456+
* Store the result in to_fetch[i].old_sha1. Callers such
457+
* as "git fetch" can use the value to write feedback to the
458+
* terminal, populate FETCH_HEAD, and determine what new value
459+
* should be written to peer_ref if the update is a
460+
* fast-forward or this is a forced update.
461+
*/
447462
for (i = 0; i < nr_heads; i++) {
448463
char *private;
449464
posn = to_fetch[i];

0 commit comments

Comments
 (0)