diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-11-10 09:10:51 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-11-10 09:10:51 -0800 |
commit | c444c16589f95ac22d8e3ffe603cd7f0613512ce (patch) | |
tree | 31d2e0c2a77344201af6f3ee5427f47218dec9bb /diffcore-delta.c | |
parent | 77f143bf3e218857ec8e5244d7e862e8e0c1a041 (diff) | |
parent | 81b50f3ce40bfdd66e5d967bf82be001039a9a98 (diff) | |
download | git-ly/mktree-using-strbuf.tar.gz |
Merge "Move 'builtin-*' into a 'builtin/' subdirectory"ly/mktree-using-strbuf
Diffstat (limited to 'diffcore-delta.c')
-rw-r--r-- | diffcore-delta.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/diffcore-delta.c b/diffcore-delta.c index e670f85125..7cf431d261 100644 --- a/diffcore-delta.c +++ b/diffcore-delta.c @@ -201,10 +201,15 @@ int diffcore_count_changes(struct diff_filespec *src, while (d->cnt) { if (d->hashval >= s->hashval) break; + la += d->cnt; d++; } src_cnt = s->cnt; - dst_cnt = d->hashval == s->hashval ? d->cnt : 0; + dst_cnt = 0; + if (d->cnt && d->hashval == s->hashval) { + dst_cnt = d->cnt; + d++; + } if (src_cnt < dst_cnt) { la += dst_cnt - src_cnt; sc += src_cnt; @@ -213,6 +218,10 @@ int diffcore_count_changes(struct diff_filespec *src, sc += dst_cnt; s++; } + while (d->cnt) { + la += d->cnt; + d++; + } if (!src_count_p) free(src_count); |