Commit Diff


commit - 819f385b2053664dbfd5c1d0201fb84bc7e3c5a6
commit + 7200e87cc1be1df51cd915a8c1ad693bb5246f52
blob - d29a9bd8996f361ceba6c402b9cc22d20f7c0938
blob + e0ae4e614170aadd908c79212ebf1066b3d140dc
--- lib/worktree.c
+++ lib/worktree.c
@@ -2841,10 +2841,15 @@ got_worktree_commit(struct got_object_id **new_commit_
 		err = got_object_id_by_path(&id_in_head, repo,
 		    head_commit_id, ct->in_repo_path);
 		if (err) {
-			if (err->code == GOT_ERR_NO_TREE_ENTRY &&
-			    ct->status == GOT_STATUS_ADD) {
-				err = NULL;
-				id_in_head = NULL;
+			if (err->code == GOT_ERR_NO_TREE_ENTRY) {
+				if (ct->status == GOT_STATUS_ADD) {
+					err = NULL;
+					id_in_head = NULL;
+				} else {
+					err = got_error(
+					    GOT_ERR_COMMIT_OUT_OF_DATE);
+					goto done;
+				}
 			} else
 				goto done;
 		}