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

Add a view for stashes #169

Closed
RedBeard0531 opened this issue Jul 8, 2013 · 7 comments
Closed

Add a view for stashes #169

RedBeard0531 opened this issue Jul 8, 2013 · 7 comments

Comments

@RedBeard0531
Copy link

Ideally it could have a default view equivalent to "git stash list" and hitting enter would open a split that shows the equivalent of "git shash show -p --stat stash@{NUM}".

This is related to #159, but it is about creating stashes and this is about viewing them. If you think they are related enough to be a single issue, feel free to combine.

@jonas
Copy link
Owner

jonas commented Jul 16, 2013

I like this idea and this would be a good first step to start supporting git's stash features.

vivien added a commit to vivien/tig that referenced this issue Jul 26, 2013
This patch adds a new "stash" view, bound to the 'y' key.
This view displays the list of stashes. Pressing Enter on one of them
displays the corresponding change in a split view.

A new %(stash) variable is added for bindings and commands.

Running 'tig stash' opens directly the stash view.

A built-in command to pop the current stash is bound to 'P' in this
view. Other bindings may be added in the ~/.tigrc file, for instance:

    bind stash D !?git stash drop %(stash)
    bind stash A !?git stash apply %(stash)
    bind status S !?git stash save --keep-index %(prompt)

References: jonas#169, jonas#159

Signed-off-by: Vivien Didelot <[email protected]>
vivien added a commit to vivien/tig that referenced this issue Jul 29, 2013
This patch adds a new "stash" view, bound to the 'y' key.
This view displays the list of stashes. Pressing Enter on one of them
displays the corresponding change in a split view.

Running 'tig stash' opens directly the stash view.

A new %(stash) variable is added for bindings and commands.

A built-in command to pop the current stash is bound to 'P' in this
view. Other bindings may be added in the ~/.tigrc file, for instance:

    bind stash D !?git stash drop %(stash)
    bind stash A !?git stash apply %(stash)
    bind status S !?git stash save --keep-index %(prompt)

This is the v2 of PR jonas#173.
References: jonas#169, jonas#159

Signed-off-by: Vivien Didelot <[email protected]>
vivien added a commit to vivien/tig that referenced this issue Jul 29, 2013
This patch adds a new "stash" view, bound to the 'y' key.
This view displays the list of stashes. Pressing Enter on one of them
displays the corresponding change in a split view.

Running 'tig stash' opens directly the stash view.

A new %(stash) variable is added for bindings and commands.

A built-in command to pop the current stash is bound to 'P' in this
view. Other bindings may be added in the ~/.tigrc file, for instance:

    bind stash D !?git stash drop %(stash)
    bind stash A !?git stash apply %(stash)
    bind status S !?git stash save --keep-index %(prompt)

References: jonas#169, jonas#159

[This is the v2 of PR jonas#173.]

Signed-off-by: Vivien Didelot <[email protected]>
vivien added a commit to vivien/tig that referenced this issue Jul 29, 2013
This patch adds a new "stash" view, bound to the 'y' key.
This view displays the list of stashes. Pressing Enter on one of them
displays the corresponding change in a split view.

Running 'tig stash' opens directly the stash view.

A new %(stash) variable is added for bindings and commands.

A built-in command to pop the current stash is bound to 'P' in this
view. Other bindings may be added in the ~/.tigrc file, for instance:

    bind stash D !?git stash drop %(stash)
    bind stash A !?git stash apply %(stash)
    bind status S !?git stash save --keep-index %(prompt)

References: jonas#169, jonas#159

[This is the v2 of PR jonas#173.]

Signed-off-by: Vivien Didelot <[email protected]>
@jonas jonas closed this as completed in e2a0134 Aug 1, 2013
@jonas
Copy link
Owner

jonas commented Aug 1, 2013

Thanks @vivien :)

jonas added a commit that referenced this issue Aug 3, 2013
Change the output to use "--pretty=raw", which is compatible with the
main view. This simplifies the parsing of the 'stash{X}' ID by using the
emitted 'Reflog' line and displays the stash date for free.

The reference to the stash is stored as the commit->id for easy access
when updating the status line (view->ref).
@jonas
Copy link
Owner

jonas commented Aug 3, 2013

What do you think about this little improvement?

Use main view as the basis for viewing the list of stashed changed

@vivien
Copy link
Contributor

vivien commented Aug 5, 2013

What do you think about this little improvement?

Looks great and clearer!
I tried it and have two points though:

  • The id-width should be forced to another value than the default 7, otherwise pressing X will crop the stash name and display "stash@{" instead.
  • I think because there is no --- line after the stash message, the jump-to-diff feature is missing. It would be great to have it work in the stash (in fact "diff" here) view as well.

Thanks that's a cool improvement to this stash view!

@RedBeard0531
Copy link
Author

Thanks, this is just what I wanted!

One minor nit: the diffstat section doesn't seem to be highlighted and doesn't support "enter to hop to file" as in a normal commit.

Also might be nice to add a key drop the current stash, but since both delete and D are taken may not be worth it.

@vivien
Copy link
Contributor

vivien commented Aug 5, 2013

Hi @RedBeard0531,

One minor nit: the diffstat section doesn't seem to be highlighted and doesn't support "enter to hop to file" as in a normal commit.

Yes, that's what I meant by the missing "jump-to-diff feature" in my previous comment.

Also might be nice to add a key drop the current stash, but since both delete and D are taken may not be worth it.

As described in the commit message, there's currently just one built-in 'P' binding for pop, but others can easily be added. I also completed the wiki with those examples. See the 3 stash bindings in the wiki.

jonas added a commit that referenced this issue Aug 6, 2013
Change the output to use "--pretty=raw", which is compatible with the
main view. This simplifies the parsing of the 'stash{X}' ID by using the
emitted 'Reflog' line and displays the stash date for free.

The reference to the stash is stored as the commit->id for easy access
when updating the status line (view->ref).

Fixes #169
jonas added a commit that referenced this issue Aug 6, 2013
jonas added a commit that referenced this issue Aug 6, 2013
@jonas
Copy link
Owner

jonas commented Aug 6, 2013

The two small improvements mentioned should be fixed. For combined diffs, jump-to-diff does not always work as expected, since a diffstat entry does not necessarily map to a 'diff --cc' entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants