commit 47c7ee21b5f269eed3127db9d3ac7c490d1ecf0a from: Mark Jamsek via: Thomas Adam date: Mon Feb 20 16:18:17 2023 UTC use newly publicised diff_chunk_type() diff API To skip chunks without newly added lines. ok stsp@ commit - ae012d47ffe30ad1e3d00cbca2485f2c10a0f558 commit + 47c7ee21b5f269eed3127db9d3ac7c490d1ecf0a blob - c9f89f2a3d0213ed6de0e7ee94c89727f29a8b91 blob + 8438fa2bd487df57620eb38e696505af64782a4d --- lib/worktree.c +++ lib/worktree.c @@ -1559,17 +1559,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 */ }