Stefan Hajnoczi <stefanha@xxxxxxxxxx> writes: > Perhaps it's better to leave this than to merge code that doesn't work > correctly 100% of the time. I am not sure if you are shooting for is "work correctly" to begin with, to be honest. The current code always shows the "correct" output which is "the tree-ish object name (expressed in a way easier to understand by the humans), followed by a colon, followed by the path in the tree-ish the hit lies". You are making it "incorrect but often more convenient", and sometimes that is a worth goal, but for the particular use cases you presented, i.e. $ git grep -e "$pattern" "$commit:path" a more natural way to express "I want to find this pattern in the commit under that path" exists: $ git grep -e "$pattern" "$commit" -- path and because of that, I do not think the former form of the query should happen _less_ often in the first place, which would make it "incorrect but more convenient if the user gives an unusual query". So I am not sure if the change to "grep" is worth it. Having said that, I actually think "make it more convenient" without making anything incorrect would be to teach the revision parser to understand <any-expression-to-name-a-tree-ish:<path> as an extended SHA-1 expression to name the blob or the tree at that path in the tree-ish, e.g. if we can make the revision parser to take this master:Documentation:git.txt as the name of the blob object, then the current output is both correct and more convenient. After all, this sample string starts at "master:Documentation" (which is an extended SHA-1 expression to name a tree-ish), followed by a colon, then followed by the path "git.txt" in it, and "grep -e pattern master:Documentation" would show hits in that blob prefixed with it. I.e. T=$(git rev-parse master:Documentation) git cat-file blob $T:git.txt would give you the contents of the source to the Git manual. It is not all that unreasonable to expect git cat-file blob master:Documentation:git.txt to be able to show the same thing as well. You'd need to backtrack the parsing (e.g. attempt to find "Documentation:git.txt" in "master", fail to find any, then fall back to find "git.txt" in "master:Documentation", find one, and be happy, or something like that), and define how to resolve potential ambiguity (e.g. there may indeed be "Documentation:git.txt" and "Documentation/git.txt" in the tree-ish "master"), though.