Commit Diff


commit - a3a2faf2675b16ab805c74a24d7211f59c837316
commit + 267fb25597ba2b8c0e90ce0e454239657b189135
blob - 84afda62f5a53e15c091e9bda641c9d9148cc2ab
blob + 8a0bcac6de0a418b0a7d71ed95c40e4e6c67778c
--- lib/worktree.c
+++ lib/worktree.c
@@ -4018,15 +4018,6 @@ got_worktree_rebase_abort(struct got_worktree *worktre
 		goto done;
 
 	err = got_worktree_set_base_commit_id(worktree, repo, commit_id);
-	if (err)
-		goto done;
-
-	err = got_object_id_by_path(&tree_id, repo,
-	    worktree->base_commit_id, worktree->path_prefix);
-	if (err)
-		goto done;
-	err = checkout_files(worktree, fileindex, "", tree_id, NULL,
-	    repo, progress_cb, progress_arg, NULL, NULL);
 	if (err)
 		goto done;
 
@@ -4044,6 +4035,15 @@ got_worktree_rebase_abort(struct got_worktree *worktre
 			goto done;
 	}
 
+	err = got_object_id_by_path(&tree_id, repo,
+	    worktree->base_commit_id, worktree->path_prefix);
+	if (err)
+		goto done;
+	err = checkout_files(worktree, fileindex, "", tree_id, NULL,
+	    repo, progress_cb, progress_arg, NULL, NULL);
+	if (err)
+		goto done;
+
 	err = delete_rebase_refs(worktree, repo);
 done:
 	got_ref_close(resolved);