From: Jonas Fonseca Date: Sat, 9 Apr 2011 18:13:58 +0000 (-0400) Subject: io_run: make it possible to open file X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c77942d3d053415bcf1a09f79e8b05a7b76f6de2;p=tig.git io_run: make it possible to open file --- diff --git a/io.c b/io.c index fabde00..901a381 100644 --- a/io.c +++ b/io.c @@ -183,6 +183,9 @@ io_run(struct io *io, enum io_type type, const char *dir, const char *argv[], .. io_init(io); + if (dir && !strcmp(dir, argv[0])) + return io_open(io, "%s%s", dir, argv[1]); + if ((type == IO_RD || type == IO_WR) && pipe(pipefds) < 0) { io->error = errno; return FALSE; diff --git a/tig.c b/tig.c index 7ad7fe7..3ae55f2 100644 --- a/tig.c +++ b/tig.c @@ -2542,9 +2542,6 @@ begin_update(struct view *view, const char *dir, const char **argv, enum open_fl if (view->argv && view->argv[0] && !io_run(&view->io, IO_RD, view->dir, view->argv)) return FALSE; - else if (view->argv && !strcmp(view->argv[0], opt_cdup) && - !io_open(&view->io, "%s%s", opt_cdup, view->argv[1])) - return FALSE; setup_update(view, view->id); @@ -2795,6 +2792,7 @@ open_file(struct view *prev, struct view *view, const char *file, enum open_flag if (view->pipe) end_update(view, TRUE); + view->dir = opt_cdup; if (!argv_copy(&view->argv, file_argv)) { report("Failed to load %s: out of memory", file); } else {