| 133 | } |
| 134 | |
| 135 | func getTreeFromHash(directory string, hash plumbing.Hash) (*object.Tree, error) { |
| 136 | if hash.IsZero() { |
| 137 | return &object.Tree{}, nil |
| 138 | } |
| 139 | |
| 140 | repo, err := git.PlainOpen(directory) |
| 141 | if err != nil { |
| 142 | return nil, utils.WrapErr(err, "Error opening repository: %s", directory) |
| 143 | } |
| 144 | |
| 145 | commit, err := repo.CommitObject(hash) |
| 146 | if err != nil { |
| 147 | return nil, utils.WrapErr(err, "Error getting commit at hash %s from repo %s", hash, directory) |
| 148 | } |
| 149 | |
| 150 | tree, err := commit.Tree() |
| 151 | if err != nil { |
| 152 | return nil, utils.WrapErr(err, "Error getting tree from commit at hash %s from repo %s", hash, directory) |
| 153 | } |
| 154 | |
| 155 | return tree, nil |
| 156 | } |
| 157 | |
| 158 | func getFilteredChangeMap( |
| 159 | directory string, |