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

'git --grep' doesn't grep notes?

From
TJTodd A. Jacobs <nospam+listmail@codegnome.org>
Date
Aug 27, 2012, 18:18 UTC
Message-ID
<CAPRhCbvnRqUpKcw_E383ekG_M0O2a+cTTixUQtU-0mtj3V=7uw@mail.gmail.com>

I have a note attached to a commit, but the text of the note isn't treated as part of the commit for the purposes of grep. For example:

    mkdir /tmp/foo
    cd /tmp/foo
    git init
    git commit --allow-empty -m 'Blank commit.'
    git notes add -m 'Find me!'
    git log --show-notes --regexp-ignore-case --grep=find

This doesn't match anything. Expected behavior is that this will match the commit that contains "Find me!" in the notes.

As an example use case, consider ticket integration, where you may want to add a ticket ID to a commit long after it's been pushed. You don't want to rewind the branch, or push a rebase, so a note seems like a sensible place to store a ticket ID. However, if the notes aren't part of the commit, this will break integration with tools like Pivotal Tracker that search the commits, and it will also require you to use an external grep and some custom parsing to find related commit IDs.

I'm sure there are other use cases. This just happens to be mine right now.

What is the right way to include notes in log searches, especially if the end goal is to find the related commit ID?

Next: Andreas Schwab
Message 1 of 2 in “'git --grep' doesn't grep notes?”
  1. Todd A. JacobsAug 27, 2012
  2. Andreas SchwabAug 27, 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.