commit - 5501382f685d835dc0320cc98499fd3c01625bd3
commit + 588edf975c6b0752405764af36a02f2623986cdd
blob - 87be49d7f562408e06afc48fe61daabac15d8f3c
blob + 40618b34f311361a3fb2ed0bc862d55085c23635
--- lib/worktree.c
+++ lib/worktree.c
struct got_pathlist_entry *pe;
char *relpath = NULL;
const char *head_ref_name = NULL;
- struct got_commit_object *base_commit = NULL;
+ struct got_commit_object *head_commit = NULL;
struct got_object_id *head_commit_id = NULL;
struct got_reference *head_ref2 = NULL;
struct got_object_id *head_commit_id2 = NULL;
- struct got_tree_object *base_tree = NULL;
+ struct got_tree_object *head_tree = NULL;
struct got_object_id *new_tree_id = NULL;
struct got_object_id_queue parent_ids;
struct got_object_qid *pid = NULL;
if (err)
goto done;
+ err = got_object_open_as_commit(&head_commit, repo, head_commit_id);
+ if (err)
+ goto done;
+
/* TODO: out-of-dateness check */
+ err = got_object_open_as_tree(&head_tree, repo, head_commit->tree_id);
+ if (err)
+ goto done;
+
/* TODO: collect commit message if not specified */
/* Create blobs from added and modified files and record their IDs. */
if (err)
goto done;
}
-
- err = got_object_open_as_commit(&base_commit, repo,
- worktree->base_commit_id);
- if (err)
- goto done;
- err = got_object_open_as_tree(&base_tree, repo, base_commit->tree_id);
- if (err)
- goto done;
/* Recursively write new tree objects. */
- err = write_tree(&new_tree_id, base_tree, "/", &commitable_paths,
+ err = write_tree(&new_tree_id, head_tree, "/", &commitable_paths,
status_cb, status_arg, repo);
if (err)
goto done;
free_commitable(ct);
}
got_pathlist_free(&commitable_paths);
- if (base_tree)
- got_object_tree_close(base_tree);
- if (base_commit)
- got_object_commit_close(base_commit);
+ if (head_tree)
+ got_object_tree_close(head_tree);
+ if (head_commit)
+ got_object_commit_close(head_commit);
free(relpath);
free(head_commit_id);
free(head_commit_id2);