Merge branch 'tb/unexpected'
authorJunio C Hamano <gitster@pobox.com>
Wed, 8 May 2019 15:37:25 +0000 (00:37 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 May 2019 15:37:25 +0000 (00:37 +0900)
Code tightening against a "wrong" object appearing where an object
of a different type is expected, instead of blindly assuming that
the connection between objects are correctly made.

* tb/unexpected:
rev-list: detect broken root trees
rev-list: let traversal die when --missing is not in use
get_commit_tree(): return NULL for broken tree
list-objects.c: handle unexpected non-tree entries
list-objects.c: handle unexpected non-blob entries
t: introduce tests for unexpected object types
t: move 'hex2oct' into test-lib-functions.sh

1  2 
builtin/rev-list.c
commit.c
t/t1450-fsck.sh
t/t5601-clone.sh
t/test-lib-functions.sh
Simple merge
diff --cc commit.c
index a9e74647dc822606d06f79bcf94030b32998bd69,e2cde566a97e0d5fce7eec0873f3a7364ec70110..8fa1883c61c580578a755cdf2da009203d8d386e
+++ b/commit.c
@@@ -351,10 -345,10 +351,10 @@@ struct tree *repo_get_commit_tree(struc
        if (commit->maybe_tree || !commit->object.parsed)
                return commit->maybe_tree;
  
-       if (commit->graph_pos == COMMIT_NOT_FROM_GRAPH)
-               BUG("commit has NULL tree, but was not loaded from commit-graph");
+       if (commit->graph_pos != COMMIT_NOT_FROM_GRAPH)
 -              return get_commit_tree_in_graph(the_repository, commit);
++              return get_commit_tree_in_graph(r, commit);
  
-       return get_commit_tree_in_graph(r, commit);
+       return NULL;
  }
  
  struct object_id *get_commit_tree_oid(const struct commit *commit)
diff --cc t/t1450-fsck.sh
Simple merge
Simple merge
Simple merge