Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass stash args through #1030

Merged
merged 1 commit into from
Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Improvements:
- Start blame of an uncommitted deleted line from HEAD so the line's origin can be traced. (#1008)
- Add line-graphics = auto. (#834)
- Allow maxwidth to be expressed in % of the view width.
- Pass stash args through. (#1022)

Bug fixes:

Expand Down
2 changes: 1 addition & 1 deletion doc/tig.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tig reflog [options] [revisions]
tig blame [options] [rev] [--] path
tig grep [options] [pattern]
tig refs [options]
tig stash
tig stash [options]
tig status
tig < [Git command output]
_______________________________________________________________________
Expand Down
8 changes: 6 additions & 2 deletions src/stash.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static enum status_code
stash_open(struct view *view, enum open_flags flags)
{
static const char *stash_argv[] = { "git", "stash", "list",
encoding_arg, "--no-color", "--pretty=raw", NULL };
encoding_arg, "--no-color", "--pretty=raw", "%(revargs)", NULL };
struct main_state *state = view->private;

state->with_graph = false;
Expand All @@ -31,8 +31,12 @@ stash_open(struct view *view, enum open_flags flags)
static void
stash_select(struct view *view, struct line *line)
{
struct main_state *state = view->private;

main_select(view, line);
string_format(view->env->stash, "stash@{%d}", line->lineno - 1);
assert(state->reflogs >= line->lineno);
string_ncopy(view->env->stash, state->reflog[line->lineno - 1] + STRING_SIZE("refs/"),
strlen(state->reflog[line->lineno - 1]) - STRING_SIZE("refs/"));
string_copy(view->ref, view->env->stash);
}

Expand Down
2 changes: 1 addition & 1 deletion src/tig.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ static const char usage_string[] =
" or: tig blame [options] [rev] [--] path\n"
" or: tig grep [options] [pattern]\n"
" or: tig refs [options]\n"
" or: tig stash\n"
" or: tig stash [options]\n"
" or: tig status\n"
" or: tig < [git command output]\n"
"\n"
Expand Down