Partly restore old refresh behavior
[tig.git] / src / stash.c
blobeb469292a887f512d5177569ecc743d4f7a10a70
1 /* Copyright (c) 2006-2014 Jonas Fonseca <jonas.fonseca@gmail.com>
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #include "tig/draw.h"
15 #include "tig/main.h"
17 static bool
18 stash_open(struct view *view, enum open_flags flags)
20 static const char *stash_argv[] = { "git", "stash", "list",
21 encoding_arg, "--no-color", "--pretty=raw", NULL };
22 struct main_state *state = view->private;
24 state->with_graph = FALSE;
25 watch_register(&view->watch, WATCH_STASH);
26 return begin_update(view, NULL, stash_argv, flags | OPEN_RELOAD);
29 static void
30 stash_select(struct view *view, struct line *line)
32 main_select(view, line);
33 string_format(view->env->stash, "stash@{%d}", line->lineno - 1);
34 string_copy(view->ref, view->env->stash);
37 static struct view_ops stash_ops = {
38 "stash",
39 argv_env.stash,
40 VIEW_SEND_CHILD_ENTER | VIEW_REFRESH,
41 sizeof(struct main_state),
42 stash_open,
43 main_read,
44 view_column_draw,
45 main_request,
46 view_column_grep,
47 stash_select,
48 main_done,
49 view_column_bit(AUTHOR) | view_column_bit(COMMIT_TITLE) |
50 view_column_bit(DATE) | view_column_bit(ID) |
51 view_column_bit(LINE_NUMBER),
52 main_get_column_data,
55 DEFINE_VIEW(stash);
57 /* vim: set ts=8 sw=8 noexpandtab: */