commit - ffa5bcf7b7aede7ffd71ddaea07ad9eae5b3c13d
commit + 1d98034bec23a98dae48660d895840b6f6403d93
blob - ca273f088abf440f2971a8633e52b3f2fe3bb8c9
blob + d3eaae2c29a0159a5edc80578ff93091d1b60976
--- 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;