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

support git stash with a counsel-git-grep-stash #374

Closed
drorbemet opened this issue Jan 31, 2016 · 1 comment
Closed

support git stash with a counsel-git-grep-stash #374

drorbemet opened this issue Jan 31, 2016 · 1 comment

Comments

@drorbemet
Copy link

I didn't find support for git grep stash in magit.
At the moment I feel like that a counsel-git-grep-stash would help to quickly look up stashed notes and temp files. But I havn't decided about a sensible default action yet.
Maybe I should learn how to write a provider for ivy counsel myself.
Does a general recipe for that exist already? What do I have to consider if I just copy and adapt counsel-git-grep for that?

#!/bin/bash
IFS=$'\n'
for i in `git stash list --format="%gd"`; do
    git stash show -p $i | grep -H --label="$i" "$1"
done
``
@abo-abo abo-abo closed this as completed in 142306e Feb 1, 2016
@abo-abo
Copy link
Owner

abo-abo commented Feb 1, 2016

Does a general recipe for that exist already?

The recipe is to find a similar function and copy it.

What do I have to consider if I just copy and adapt counsel-git-grep for that?

counsel-git-grep is a complex async command, I'd suggest looking at counsel-locate for a simple async command. But in this case, a simple non-async command can suffice - just a combination of ivy-read and shell-command-to-string, see the commit.

But I havn't decided about a sensible default action yet

I added an action that copies a command to apply a stash to the kill ring.

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

2 participants