Commit Diff


commit - 718ef3e9e896770be288214c9e03de887cb683cd
commit + a1fbf39a454ab02859425068e8840d29356ea511
blob - f6655bad906fba77894eae334a60fee416a4d689
blob + 0a56b3a8d2343c4a6c3f58cefc925e1ee167629f
--- tog/tog.c
+++ tog/tog.c
@@ -2229,8 +2229,12 @@ 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) {
+		if (worktree)
+			repo_path = strdup(got_worktree_get_repo_path(worktree));
+		else
+			repo_path = strdup(cwd);
+	}
 	if (repo_path == NULL) {
 		error = got_error_from_errno("strdup");
 		goto done;