Commit Diff


commit - ac62b7128d19ff467525fe11e07efdbc47c53bb5
commit + 1a1242a9a15f34878343aebfb28a71e0c5d9b904
blob - 5d1639cc92038e9f33eb3ea515cd83b8469b4fb0
blob + 192b847bcb16c4c5fe215175d5a8109d0712f76b
--- got/got.c
+++ got/got.c
@@ -4381,19 +4381,11 @@ cmd_diff(int argc, char *argv[])
 			error = got_worktree_open(&worktree, cwd);
 			if (error && error->code != GOT_ERR_NOT_WORKTREE)
 				goto done;
-			if (worktree) {
-				repo_path = strdup(
-				    got_worktree_get_repo_path(worktree));
-				if (repo_path == NULL) {
-					error = got_error_from_errno("strdup");
-					goto done;
-				}
-			} else {
-				repo_path = strdup(cwd);
-				if (repo_path == NULL) {
-					error = got_error_from_errno("strdup");
-					goto done;
-				}
+			repo_path = strdup(worktree ?
+			    got_worktree_get_repo_path(worktree) : cwd);
+			if (repo_path == NULL) {
+				error = got_error_from_errno("strdup");
+				goto done;
 			}
 		}
 	} else