Merge branch 'dk/blame-keep-origin-blob'
authorJunio C Hamano <gitster@pobox.com>
Thu, 25 Apr 2019 07:41:17 +0000 (16:41 +0900)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Apr 2019 07:41:17 +0000 (16:41 +0900)
Performance fix around "git blame", especially in a linear history
(which is the norm we should optimize for).

* dk/blame-keep-origin-blob:
blame.c: don't drop origin blobs as eagerly

1  2 
blame.c
diff --combined blame.c
index 5c07dec1903545738642c17e94cc1fa060ba15d3,4e9ccd09221e66ca2f5c02a563c18294b1cc3942..c11c516921e990e1b0fa752e77a1438e92697d5e
+++ b/blame.c
@@@ -204,8 -204,7 +204,8 @@@ static struct commit *fake_working_tree
  
        origin = make_origin(commit, path);
  
 -      ident = fmt_ident("Not Committed Yet", "not.committed.yet", NULL, 0);
 +      ident = fmt_ident("Not Committed Yet", "not.committed.yet",
 +                      WANT_BLANK_IDENT, NULL, 0);
        strbuf_addstr(&msg, "tree 0000000000000000000000000000000000000000\n");
        for (parent = commit->parents; parent; parent = parent->next)
                strbuf_addf(&msg, "parent %s\n",
@@@ -1562,7 -1561,8 +1562,8 @@@ finish
        }
        for (i = 0; i < num_sg; i++) {
                if (sg_origin[i]) {
-                       drop_origin_blob(sg_origin[i]);
+                       if (!sg_origin[i]->suspects)
+                               drop_origin_blob(sg_origin[i]);
                        blame_origin_decref(sg_origin[i]);
                }
        }