Merge branch 'br/blame-ignore'
authorJunio C Hamano <gitster@pobox.com>
Fri, 19 Jul 2019 18:30:20 +0000 (11:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Jul 2019 18:30:20 +0000 (11:30 -0700)
"git blame" learned to "ignore" commits in the history, whose
effects (as well as their presence) get ignored.

* br/blame-ignore:
t8014: remove unnecessary braces
blame: drop some unused function parameters
blame: add a test to cover blame_coalesce()
blame: use the fingerprint heuristic to match ignored lines
blame: add a fingerprint heuristic to match ignored lines
blame: optionally track line fingerprints during fill_blame_origin()
blame: add config options for the output of ignored or unblamable lines
blame: add the ability to ignore commits and their changes
blame: use a helper function in blame_chunk()
Move oidset_parse_file() to oidset.c
fsck: rename and touch up init_skiplist()

1  2 
blame.c
blame.h
builtin/blame.c
fsck.c
oidset.c
oidset.h
diff --cc blame.c
Simple merge
diff --cc blame.h
index d62f80fa74c44011f8cdaea7a4baec3d8cae03e6,5dd877bb78fc068510753f7e967dea4be049f66d..4a9e1270b036465c23fab5a0e536b9638ca3ce1b
+++ b/blame.h
@@@ -51,8 -51,10 +51,10 @@@ struct blame_origin 
         */
        struct blame_entry *suspects;
        mmfile_t file;
+       int num_lines;
+       void *fingerprints;
        struct object_id blob_oid;
 -      unsigned mode;
 +      unsigned short mode;
        /* guilty gets set when shipping any suspects to the final
         * blame list instead of other commits
         */
diff --cc builtin/blame.c
Simple merge
diff --cc fsck.c
Simple merge
diff --cc oidset.c
index 8bdecb13de1e0d0f24bfccb27dd46cdf64b27cff,584be63e520ae8d959aef6c6cb2bfa5f5a8995fa..f63ce818f67766378485ab16075dd11e87c00ca0
+++ b/oidset.c
@@@ -32,6 -32,41 +32,41 @@@ int oidset_remove(struct oidset *set, c
  
  void oidset_clear(struct oidset *set)
  {
 -      kh_release_oid(&set->set);
 +      kh_release_oid_set(&set->set);
        oidset_init(set, 0);
  }
+ void oidset_parse_file(struct oidset *set, const char *path)
+ {
+       FILE *fp;
+       struct strbuf sb = STRBUF_INIT;
+       struct object_id oid;
+       fp = fopen(path, "r");
+       if (!fp)
+               die("could not open object name list: %s", path);
+       while (!strbuf_getline(&sb, fp)) {
+               const char *p;
+               const char *name;
+               /*
+                * Allow trailing comments, leading whitespace
+                * (including before commits), and empty or whitespace
+                * only lines.
+                */
+               name = strchr(sb.buf, '#');
+               if (name)
+                       strbuf_setlen(&sb, name - sb.buf);
+               strbuf_trim(&sb);
+               if (!sb.len)
+                       continue;
+               if (parse_oid_hex(sb.buf, &oid, &p) || *p != '\0')
+                       die("invalid object name: %s", sb.buf);
+               oidset_insert(set, &oid);
+       }
+       if (ferror(fp))
+               die_errno("Could not read '%s'", path);
+       fclose(fp);
+       strbuf_release(&sb);
+ }
diff --cc oidset.h
index 505fad578bec1691fde9f28342d4c476c60dd50c,c4807749df8d169f03d506beaf183254fc397b48..5346563b0bccb602b8de745d1308793e8995a5e5
+++ b/oidset.h
@@@ -61,8 -73,16 +61,16 @@@ int oidset_remove(struct oidset *set, c
   */
  void oidset_clear(struct oidset *set);
  
+ /**
+  * Add the contents of the file 'path' to an initialized oidset.  Each line is
+  * an unabbreviated object name.  Comments begin with '#', and trailing comments
+  * are allowed.  Leading whitespace and empty or white-space only lines are
+  * ignored.
+  */
+ void oidset_parse_file(struct oidset *set, const char *path);
  struct oidset_iter {
 -      kh_oid_t *set;
 +      kh_oid_set_t *set;
        khiter_t iter;
  };