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

git-grep misses an instance of a string (after conflict)

From
Johannes Sixt <johannes.sixt@telecom.at>
Date
Nov 26, 2006, 14:53 UTC
Message-ID
<ekc9q7$36e$1@sea.gmane.org>

I've roughly had the following sequence of operations on a particular file in my project:

1. git-cherry-pick a commit, which resulted in a conflict in in that file
2. edit the file to insert a particular string (which wasn't there before)
3. then:
$ git-grep getSibling -- kdbg/exprwnd.h    # this file had a conflict
$ grep getSibling -- kdbg/exprwnd.h       
    { return static_cast<VarTree*>(getSibling()); }
$ git-update-index kdbg/exprwnd.h
$ git-grep getSibling -- kdbg/exprwnd.h       
kdbg/exprwnd.h:    { return static_cast<VarTree*>(getSibling()); }

As you can see, the first git-grep doesn't find the string, but after the update-index, it does find it.

This is unexpected behavior, in particular since the manual page talks about git-grep to search the working tree. I understand that the conflict may have influenced the behavior, but the manual page is not in line with the behavior. Am I missing something?

-- Hannes
Next: Junio C Hamano
Message 1 of 3 in “git-grep misses an instance of a string (after conflict)”
  1. Johannes SixtNov 26, 2006
  2. grep: do not skip unmerged entries when grepping in the working tree.Junio C Hamano, Nov 26, 2006
  3. Johannes SixtNov 26, 2006

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.