skip out-of-dateness check during rebase for faster commits
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
diff --git a/lib/worktree.c b/lib/worktree.c
index 9ac24a5..a62e681 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -3260,13 +3260,6 @@ commit_worktree(struct got_object_id **new_commit_id,
if (err)
goto done;
- TAILQ_FOREACH(pe, commitable_paths, entry) {
- struct got_commitable *ct = pe->data;
- err = check_ct_out_of_date(ct, repo, head_commit_id);
- if (err)
- goto done;
- }
-
err = got_object_open_as_tree(&head_tree, repo, head_commit->tree_id);
if (err)
goto done;
@@ -3424,6 +3417,13 @@ got_worktree_commit(struct got_object_id **new_commit_id,
goto done;
}
+ TAILQ_FOREACH(pe, &commitable_paths, entry) {
+ struct got_commitable *ct = pe->data;
+ err = check_ct_out_of_date(ct, repo, head_commit_id);
+ if (err)
+ goto done;
+ }
+
err = commit_worktree(new_commit_id, &commitable_paths,
head_commit_id, worktree, ondisk_path, author, committer,
commit_msg_cb, commit_arg, status_cb, status_arg, repo);
@@ -3787,7 +3787,6 @@ got_worktree_rebase_commit(struct got_object_id **new_commit_id,
const struct got_error *err, *sync_err;
struct got_pathlist_head commitable_paths;
struct collect_commitables_arg cc_arg;
- struct bump_base_commit_id_arg bbc_arg;
struct got_fileindex *fileindex = NULL;
char *fileindex_path = NULL, *commit_ref_name = NULL;
struct got_reference *head_ref = NULL;
@@ -3860,21 +3859,9 @@ got_worktree_rebase_commit(struct got_object_id **new_commit_id,
err = update_fileindex_after_commit(&commitable_paths, *new_commit_id,
fileindex);
- if (err == NULL) {
- /* Prevent out-of-date error when rebasing more commits. */
- bbc_arg.base_commit_id = *new_commit_id;
- bbc_arg.entry_name = NULL;
- bbc_arg.path = "";
- bbc_arg.path_len = 0;
- bbc_arg.progress_cb = NULL;
- bbc_arg.progress_arg = NULL;
- err = got_fileindex_for_each_entry_safe(fileindex,
- bump_base_commit_id, &bbc_arg);
- }
sync_err = sync_fileindex(fileindex, fileindex_path);
if (sync_err && err == NULL)
err = sync_err;
-
done:
if (fileindex)
got_fileindex_free(fileindex);