Commit Diff


commit - af61c51081a680a79548682ea8ace02b70008932
commit + b4b3a7ddd799cc2acf25bf4a7b107f04b87d81cd
blob - c1247433b1ac2c401f58f4bcac68507d1d5c02f8
blob + 0b15a8b66eb8e36a0e299cf9ac8fc7359dc5d61a
--- got/got.c
+++ got/got.c
@@ -856,8 +856,16 @@ cmd_checkout(int argc, char *argv[])
 		}
 		worktree_path = realpath(argv[1], NULL);
 		if (worktree_path == NULL) {
-			error = got_error_from_errno2("realpath", argv[1]);
-			goto done;
+			if (errno != ENOENT) {
+				error = got_error_from_errno2("realpath",
+				    argv[1]);
+				goto done;
+			}
+			worktree_path = strdup(argv[1]);
+			if (worktree_path == NULL) {
+				error = got_error_from_errno("strdup");
+				goto done;
+			}
 		}
 	} else
 		usage_checkout();