unify formatting of common code in tog log, blame, and tree
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
diff --git a/tog/tog.c b/tog/tog.c
index 71e5672..9e80090 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -2592,18 +2592,17 @@ cmd_log(int argc, char *argv[])
usage_log();
cwd = getcwd(NULL, 0);
- if (cwd == NULL) {
- error = got_error_from_errno("getcwd");
- goto done;
- }
+ if (cwd == NULL)
+ return got_error_from_errno("getcwd");
+
error = got_worktree_open(&worktree, cwd);
if (error && error->code != GOT_ERR_NOT_WORKTREE)
goto done;
if (repo_path == NULL) {
if (worktree)
- repo_path = strdup(
- got_worktree_get_repo_path(worktree));
+ repo_path =
+ strdup(got_worktree_get_repo_path(worktree));
else
repo_path = strdup(cwd);
}
@@ -4398,10 +4397,9 @@ cmd_blame(int argc, char *argv[])
usage_blame();
cwd = getcwd(NULL, 0);
- if (cwd == NULL) {
- error = got_error_from_errno("getcwd");
- goto done;
- }
+ if (cwd == NULL)
+ return got_error_from_errno("getcwd");
+
error = got_worktree_open(&worktree, cwd);
if (error && error->code != GOT_ERR_NOT_WORKTREE)
goto done;