Commit 5486daa23d45c65288ff2db5e09ec14956d2922a

Stefan Sperling 2019-05-11T10:29:23

fix -r option of 'got log'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;