| 158 | } |
| 159 | |
| 160 | static int commit_tree_with_edited_message(struct repository *repo, |
| 161 | const char *action, |
| 162 | struct commit *original, |
| 163 | struct commit **out) |
| 164 | { |
| 165 | struct object_id parent_tree_oid; |
| 166 | const struct object_id *tree_oid; |
| 167 | struct commit *parent; |
| 168 | |
| 169 | tree_oid = &repo_get_commit_tree(repo, original)->object.oid; |
| 170 | |
| 171 | parent = original->parents ? original->parents->item : NULL; |
| 172 | if (parent) { |
| 173 | if (repo_parse_commit(repo, parent)) { |
| 174 | return error(_("unable to parse parent commit %s"), |
| 175 | oid_to_hex(&parent->object.oid)); |
| 176 | } |
| 177 | |
| 178 | parent_tree_oid = repo_get_commit_tree(repo, parent)->object.oid; |
| 179 | } else { |
| 180 | oidcpy(&parent_tree_oid, repo->hash_algo->empty_tree); |
| 181 | } |
| 182 | |
| 183 | return commit_tree_ext(repo, action, original, original->parents, |
| 184 | &parent_tree_oid, tree_oid, out, COMMIT_TREE_EDIT_MESSAGE); |
| 185 | } |
| 186 | |
| 187 | enum ref_action { |
| 188 | REF_ACTION_DEFAULT, |
no test coverage detected