Commit 267fb25597ba2b8c0e90ce0e454239657b189135

Stefan Sperling 2019-07-12T14:45:56

revert local changes before checking out files when aborting a rebase

diff --git a/lib/worktree.c b/lib/worktree.c
index 84afda6..8a0bcac 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -4021,15 +4021,6 @@ got_worktree_rebase_abort(struct got_worktree *worktree,
 	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;
-
 	crp_arg.revertible_paths = &revertible_paths;
 	crp_arg.worktree = worktree;
 	err = got_worktree_status(worktree, "", repo,
@@ -4044,6 +4035,15 @@ got_worktree_rebase_abort(struct got_worktree *worktree,
 			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);