commit - 5a8b373cd01671285df647379299fbc5f49707c1
commit + c156c7a4f456c171f9e458793a2baa06389f8e1e
blob - 334d9a659f385c9de036c79d21a1a527807feeb6
blob + d3d4a63398b4c4b05caa731b093b038b0b1d9bee
--- tog/tog.c
+++ tog/tog.c
if (argc > 1)
usage_log();
-
- cwd = getcwd(NULL, 0);
- 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) {
+ cwd = getcwd(NULL, 0);
+ 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 (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;
+ if (repo_path == NULL) {
+ error = got_error_from_errno("strdup");
+ goto done;
+ }
}
error = got_repo_open(&repo, repo_path, NULL);
id_str2 = argv[1];
} else
usage_diff();
-
- cwd = getcwd(NULL, 0);
- 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) {
+ cwd = getcwd(NULL, 0);
+ 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 (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;
+ if (repo_path == NULL) {
+ error = got_error_from_errno("strdup");
+ goto done;
+ }
}
error = got_repo_open(&repo, repo_path, NULL);
if (argc != 1)
usage_blame();
-
- cwd = getcwd(NULL, 0);
- 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) {
+ cwd = getcwd(NULL, 0);
+ 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 (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;
+ if (repo_path == NULL) {
+ error = got_error_from_errno("strdup");
+ goto done;
+ }
}
error = got_repo_open(&repo, repo_path, NULL);
if (argc > 1)
usage_tree();
- cwd = getcwd(NULL, 0);
- 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) {
+ cwd = getcwd(NULL, 0);
+ 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 (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;
+ if (repo_path == NULL) {
+ error = got_error_from_errno("strdup");
+ goto done;
+ }
}
error = got_repo_open(&repo, repo_path, NULL);
if (argc > 1)
usage_ref();
- cwd = getcwd(NULL, 0);
- 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) {
+ cwd = getcwd(NULL, 0);
+ 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 (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;
+ if (repo_path == NULL) {
+ error = got_error_from_errno("strdup");
+ goto done;
+ }
}
error = got_repo_open(&repo, repo_path, NULL);