Commit Diff


commit - 877a927c9c9f96ec4bb7392082698c19706de865
commit + b50cabdf52fb94fec7e3d01b074c4dc3f144b372
blob - 9ac24a53d4669d51aa38c51895804cbea09c1fc1
blob + a62e681872a917276bb5a5707220c92aca2434bc
--- lib/worktree.c
+++ lib/worktree.c
@@ -3259,13 +3259,6 @@ commit_worktree(struct got_object_id **new_commit_id,
 	err = got_object_open_as_commit(&head_commit, repo, head_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)
@@ -3424,6 +3417,13 @@ got_worktree_commit(struct got_object_id **new_commit_
 		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_
 	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_
 
 	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);