commit 45e6b2f427b11e0fc760c10ee96eae3a6a5f06e7 from: Mark Jamsek date: Mon Feb 20 12:35:18 2023 UTC use newly publicised diff_chunk_type() diff API To skip chunks without newly added lines. ok stsp@ commit - c251eeea7a670a2a176084dd3b4ac4dde6c55c10 commit + 45e6b2f427b11e0fc760c10ee96eae3a6a5f06e7 blob - a3aff0453202ab4f6f93c80713a58d91577c7639 blob + a8f4644bca44f95a2c1bca3d548dcd292f1f855d --- lib/worktree.c +++ lib/worktree.c @@ -1561,17 +1561,14 @@ get_modified_file_content_status(unsigned char *status struct diff_chunk *c; struct diff_chunk_context cc = {}; off_t pos; - int clc, crc; /* * We can optimise a little by advancing straight * to the next chunk if this one has no added lines. */ c = diff_chunk_get(r, n); - clc = diff_chunk_get_left_count(c); - crc = diff_chunk_get_right_count(c); - if (!crc || crc == clc) { + if (diff_chunk_type(c) != CHUNK_PLUS) { nchunks_parsed = 1; continue; /* removed or unchanged lines */ }