summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fc7fd6f)
raw | patch | inline | side by side (parent: fc7fd6f)
author | Jonas Fonseca <fonseca@diku.dk> | |
Fri, 11 Mar 2011 03:44:54 +0000 (22:44 -0500) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 17 Mar 2011 01:18:55 +0000 (21:18 -0400) |
io.c | patch | blob | history | |
tig.c | patch | blob | history |
index edd6e85cfe110a45b1ee76a05ca476ccc8ef755b..fabde00747eb5130e4b33c0dbe744ed05bc64977 100644 (file)
--- a/io.c
+++ b/io.c
{
int argc;
+ argv_free(*dst);
for (argc = 0; src[argc]; argc++)
if (!argv_append(dst, src[argc]))
return FALSE;
index 1d3122db059320cb194783ea24b0e0607808dd7a..8b46fa7f79629ed6bde86251f838530c05dcc071 100644 (file)
--- a/tig.c
+++ b/tig.c
static bool
prepare_update_file(struct view *view, const char *name)
{
+ const char *file_argv[] = { opt_cdup, name , NULL };
+
if (view->pipe)
end_update(view, TRUE);
- argv_free(view->argv);
- return io_open(&view->io, "%s/%s", opt_cdup[0] ? opt_cdup : ".", name);
+ return argv_copy(&view->argv, file_argv);
}
static bool
@@ -2556,6 +2557,9 @@ 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);
return REQ_VIEW_CLOSE;
}
- if (stage_line_type == LINE_STAT_UNTRACKED) {
- if (!suffixcmp(stage_status.new.name, -1, "/")) {
- report("Cannot display a directory");
- return REQ_NONE;
- }
-
- if (!prepare_update_file(view, stage_status.new.name)) {
- report("Failed to open file: %s", strerror(errno));
- return REQ_NONE;
- }
- }
open_view(view, REQ_VIEW_STAGE, OPEN_REFRESH);
return REQ_NONE;