fix -r option of 'got log'
diff --git a/got/got.c b/got/got.c
index e3fbc8b..8c16ff6 100644
--- a/got/got.c
+++ b/got/got.c
@@ -890,8 +890,10 @@ cmd_log(int argc, char *argv[])
} else
usage_log();
- repo_path = worktree ?
- strdup(got_worktree_get_repo_path(worktree)) : strdup(cwd);
+ if (repo_path == NULL) {
+ repo_path = worktree ?
+ strdup(got_worktree_get_repo_path(worktree)) : strdup(cwd);
+ }
if (repo_path == NULL) {
error = got_error_from_errno();
goto done;