commit - ef3dc9f3261779b82d9d9ea020ba2a5563d54dfa
commit + 7483826edb3332b2f49e9dfa9515a2a097f61d60
blob - 45cbc985724f5499495edf465cbddf52611fbae8
blob + 25ca0cca73b31182890d474c3baa4f54dce0e53e
--- tog/tog.c
+++ tog/tog.c
goto done;
}
- /*
- * XXX Perhaps we should define "xterm" as the terminal
- * type for standardised testing instead of using $TERM?
- */
+ /* use local TERM so we test in different environments */
if (newterm(NULL, tog_io.cout, tog_io.cin) == NULL)
err = got_error_msg(GOT_ERR_IO,
"newterm: failed to initialise curses");
static const struct got_error *
cmd_log(int argc, char *argv[])
{
- const struct got_error *io_err, *error;
+ const struct got_error *error;
struct got_repository *repo = NULL;
struct got_worktree *worktree = NULL;
struct got_object_id *start_id = NULL;
if (error == NULL)
error = pack_err;
}
- if (using_mock_io) {
- io_err = tog_io_close();
- if (error == NULL)
- error = io_err;
- }
tog_free_refs();
return error;
}
static const struct got_error *
cmd_diff(int argc, char *argv[])
{
- const struct got_error *io_err, *error;
+ const struct got_error *error;
struct got_repository *repo = NULL;
struct got_worktree *worktree = NULL;
struct got_object_id *id1 = NULL, *id2 = NULL;
if (error == NULL)
error = pack_err;
}
- if (using_mock_io) {
- io_err = tog_io_close();
- if (error == NULL)
- error = io_err;
- }
tog_free_refs();
return error;
}
static const struct got_error *
cmd_blame(int argc, char *argv[])
{
- const struct got_error *io_err, *error;
+ const struct got_error *error;
struct got_repository *repo = NULL;
struct got_worktree *worktree = NULL;
char *cwd = NULL, *repo_path = NULL, *in_repo_path = NULL;
if (error == NULL)
error = pack_err;
}
- if (using_mock_io) {
- io_err = tog_io_close();
- if (error == NULL)
- error = io_err;
- }
tog_free_refs();
return error;
}
static const struct got_error *
cmd_tree(int argc, char *argv[])
{
- const struct got_error *io_err, *error;
+ const struct got_error *error;
struct got_repository *repo = NULL;
struct got_worktree *worktree = NULL;
char *cwd = NULL, *repo_path = NULL, *in_repo_path = NULL;
if (error == NULL)
error = pack_err;
}
- if (using_mock_io) {
- io_err = tog_io_close();
- if (error == NULL)
- error = io_err;
- }
tog_free_refs();
return error;
}
static const struct got_error *
cmd_ref(int argc, char *argv[])
{
- const struct got_error *io_err, *error;
+ const struct got_error *error;
struct got_repository *repo = NULL;
struct got_worktree *worktree = NULL;
char *cwd = NULL, *repo_path = NULL;
if (error == NULL)
error = pack_err;
}
- if (using_mock_io) {
- io_err = tog_io_close();
- if (error == NULL)
- error = io_err;
- }
tog_free_refs();
return error;
}
int
main(int argc, char *argv[])
{
- const struct got_error *error = NULL;
+ const struct got_error *io_err, *error = NULL;
const struct tog_cmd *cmd = NULL;
int ch, hflag = 0, Vflag = 0;
char **cmd_argv = NULL;
error = cmd->cmd_main(argc, cmd_argv ? cmd_argv : argv);
}
+ if (using_mock_io) {
+ io_err = tog_io_close();
+ if (error == NULL)
+ error = io_err;
+ }
endwin();
if (cmd_argv) {
int i;