diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2013-10-30 06:32:58 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-10-30 14:16:35 -0700 |
commit | 0281c930f17042473e973f39810c8f7c93955d7d (patch) | |
tree | 39adeeb0b048065ff28aaa73f51f12411dffdc04 /contrib/completion | |
parent | get_expanded_map(): avoid memory leak (diff) | |
download | tgif-0281c930f17042473e973f39810c8f7c93955d7d.tar.xz |
fetch: only opportunistically update references based on command line
The old code processed (tags == TAGS_SET) before adding the entries
used to opportunistically update references mentioned on the command
line. The result was that all tags were also considered candidates
for opportunistic updating.
This is harmless for two reasons: (a) because it would only add
entries if there is a configured refspec that covers tags *and* both
--tags and another refspec appear on the command-line; (b) because any
extra entries would be deleted later by the call to
ref_remove_duplicates() anyway.
But, to avoid extra work and extra memory usage, and to make the
implementation better match the intention, change the algorithm
slightly: compute the opportunistic refspecs based only on the
command-line arguments, storing the results into a separate temporary
list. Then add the tags (which have to come earlier in the list so
that they are not de-duped in favor of an opportunistic entry). Then
concatenate the temporary list onto the main list.
This change will also make later changes easier.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion')
0 files changed, 0 insertions, 0 deletions