Commit Diff


commit - 18779d584bc200d66f35a96ea49cf38cce6678f5
commit + 13bfb272d51b1b7cf8f81e858928fb9af4698883
blob - c82e0bfd137ee751f13b1a609bfe0391b7593e5f
blob + d699079b48ca83e9cf1d07754bd3915623367023
--- got/got.c
+++ got/got.c
@@ -314,7 +314,7 @@ cmd_checkout(int argc, char *argv[])
 	char *worktree_path = NULL;
 	const char *path_prefix = "";
 	char *commit_id_str = NULL;
-	int ch, same_path_prefix;
+	int ch, same_path_prefix, x;
 
 	while ((ch = getopt(argc, argv, "c:p:")) != -1) {
 		switch (ch) {
@@ -381,6 +381,9 @@ cmd_checkout(int argc, char *argv[])
 	} else
 		usage_checkout();
 
+	if (worktree_path[x = strlen(worktree_path) - 1] == '/')
+		worktree_path[x] = '\0';
+
 	error = got_repo_open(&repo, repo_path);
 	if (error != NULL)
 		goto done;