• Show log

    Commit

  • Hash : fd490d3e
    Author : Carlos Martín Nieto
    Date : 2018-10-08T13:15:31

    tree: unify the entry validity checks
    
    We have two similar functions, `git_treebuilder_insert` and `append_entry` which
    are used in different codepaths as part of creating a new tree. The former
    learnt to check for object existence under strict object creation, but the
    latter did not.
    
    This allowed the creation of a tree from an unowned index to bypass some of the
    checks and create a tree pointing to a nonexistent object.
    
    Extract a single function which performs these checks and call it from both
    codepaths. In `append_entry` we still do not validate when asked not to, as this
    is data which is already in the tree and we want to allow users to deal with
    repositories which already have some invalid data.