Am 27.03.2014 19:50, schrieb David A. Dalrymple (and Bhushan G. Lodha):
From: "Bhushan G. Lodha & David A. Dalrymple" <dad-...@mit.edu>

This is similar to the pickaxe grep option (-G), but applies the
provided regex only to diff hunk headers, thereby showing only those
commits which affect a "function" with a definition line matching the
pattern. These are "functions" in the same sense as with
--function-context, i.e., they may be classes, structs, etc. depending
on the programming-language-specific pattern specified by the "diff"
attribute in .gitattributes.

With that approach you depend on the hunk header and apparently need to add XDL_EMIT_MOREFUNCNAMES and XDL_EMIT_MOREHUNKHEADS to improve the results. This approach feels fragile.

Would it perhaps be more robust to not base the implementation on diff and instead to scan the raw file contents? You'd search both files for a matching function signature, then search for a non-matching one from there. The parts in between are function bodies and can be compared. If they match, you'd search for matching function starts again etc.

Or would it make sense to make use of the diff option FUNCCONTEXT (git diff -W) and look for the function signature in the diff body instead of in the hunk header? Such a diff contains whole functions, but a single hunk could contain multiple ones.

René
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to