git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: A new way to get a sha1?

From
Thomas Badie <thomas.badie@gmail.com>
Date
Jul 30, 2012, 17:17 UTC
Message-ID
<CAFjFENq7jXA70KJSk0U7LpAupJv3tkRAfgyMKA1RewW=ttsUdQ@mail.gmail.com>
In-Reply-To
<87k3xli6mn.fsf@thomas.inf.ethz.ch>
2012/7/30 Thomas Rast <trast@student.ethz.ch>:
Show 13 quoted lines
> Thomas Badie <thomas.badie@gmail.com> writes:
>
>> The idea is to have a perl module which run through
>> the log history and print 10 shortlog associated with a number
>> from 0 to 9, and a message below "Select commit [| 0, 9 |] or
>> next row ?" or this kind of message with several options.
>>
>> So I ask to the community if this module is interesting for git.
>> It can be integrated everywhere a sha1 is requested (git rebase,
>> git reset, ...). IMHO, it can be an enhancement.
>
> I think this is too specific.  If you want full interactivity, use a
> real interactive tool like tig.
Second suggestion for tig. I must definitely try it.
Show 17 quoted lines
> However, your post and some quick searching gave me another idea.  Bash
> actually has features to let you edit the current command line from
> within key bindings.  So if only we had some clever utility, let's call
> it lineselect for lack of a better name, that let us do
>
>   git log --oneline <args> | lineselect
>
> then we could paste the selected SHA1 into the command line.  That would
> be really neat, wouldn't it?
>
> I haven't found such a utility, so below is my first shot at making
> something useful.  It has:
>
> * a few keybinds that should make most people happy
> * color rendering (yay), but because of issues with the default
>   rendering, it sets white-on-black by default
> * an optional regex arg to select only parts of the lines

Very interesting. I tried it and it is nice. I fix a little bug ("Use of uninitialized...") on my fork. I will take a look on the things that don't work yet ;) I'm pretty sure that there is a lot of possible usage of this script.

Show 12 quoted lines
> Things that notably _don't_ work yet:
>
> * cursor keys (I have no idea why it doesn't match KEY_UP etc.)
> * ANSI attributes (colors work, of sorts)
> * Searching the next occurrence of a search string
>
> But you can probably guess that those aren't a huge problem for me.
>
> I made a little repo too, for all your forking needs:
>
>   https://github.com/trast/lineselect.git
>   git://github.com/trast/lineselect.git
Thanks for sharing it!
> Thanks for the idea :-)
You're very welcome!
-- 
Thomas "Enki" Badie
Previous: Thomas Rast
Message 16 of 16 in “A new way to get a sha1?”
  1. Thomas BadieJul 30, 2012
  2. Jan EngelhardtJul 30, 2012
  3. Junio C HamanoJul 30, 2012
  4. Thomas BadieJul 30, 2012
  5. Martin LanghoffJul 30, 2012
  6. Junio C HamanoJul 30, 2012
  7. Martin LanghoffJul 30, 2012
  8. Andreas SchwabJul 30, 2012
  9. Thomas BadieJul 30, 2012
  10. Jeff KingJul 30, 2012
  11. Thomas BadieJul 30, 2012
  12. Andreas SchwabJul 30, 2012
  13. Sitaram ChamartyJul 30, 2012
  14. Thomas BadieJul 30, 2012
  15. Thomas RastJul 30, 2012
  16. Thomas BadieJul 30, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.