strip trailing slashes from more paths passed by command line
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
diff --git a/got/got.c b/got/got.c
index 8c16ff6..d07adf0 100644
--- a/got/got.c
+++ b/got/got.c
@@ -389,6 +389,7 @@ cmd_checkout(int argc, char *argv[])
} else
usage_checkout();
+ got_path_strip_trailing_slashes(repo_path);
got_path_strip_trailing_slashes(worktree_path);
error = got_repo_open(&repo, repo_path);
@@ -847,6 +848,7 @@ cmd_log(int argc, char *argv[])
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
err(1, "-r option");
+ got_path_strip_trailing_slashes(repo_path);
break;
default:
usage_log();
@@ -1103,6 +1105,7 @@ cmd_diff(int argc, char *argv[])
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
err(1, "-r option");
+ got_path_strip_trailing_slashes(repo_path);
break;
default:
usage_diff();
@@ -1277,6 +1280,7 @@ cmd_blame(int argc, char *argv[])
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
err(1, "-r option");
+ got_path_strip_trailing_slashes(repo_path);
break;
default:
usage_blame();
@@ -1496,6 +1500,7 @@ cmd_tree(int argc, char *argv[])
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
err(1, "-r option");
+ got_path_strip_trailing_slashes(repo_path);
break;
case 'i':
show_ids = 1;
@@ -1783,6 +1788,7 @@ cmd_ref(int argc, char *argv[])
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
err(1, "-r option");
+ got_path_strip_trailing_slashes(repo_path);
break;
case 'l':
do_list = 1;
@@ -1904,6 +1910,7 @@ cmd_add(int argc, char *argv[])
error = got_error_from_errno();
goto done;
}
+ got_path_strip_trailing_slashes(path);
cwd = getcwd(NULL, 0);
if (cwd == NULL) {
@@ -1976,6 +1983,7 @@ cmd_rm(int argc, char *argv[])
error = got_error_from_errno();
goto done;
}
+ got_path_strip_trailing_slashes(path);
cwd = getcwd(NULL, 0);
if (cwd == NULL) {
@@ -2052,6 +2060,7 @@ cmd_revert(int argc, char *argv[])
error = got_error_from_errno();
goto done;
}
+ got_path_strip_trailing_slashes(path);
cwd = getcwd(NULL, 0);
if (cwd == NULL) {
@@ -2124,6 +2133,7 @@ cmd_commit(int argc, char *argv[])
error = got_error_from_errno();
goto done;
}
+ got_path_strip_trailing_slashes(path);
} else if (argc != 0)
usage_commit();