Re: [PATCH 06/10] log: --function-name pickaxe
I plan to work on this in few weeks. If anybody has more suggestion or want to discuss the implementation let me know On Fri, Apr 4, 2014 at 2:46 PM, Junio C Hamano gits...@pobox.com wrote: Jakub Narębski jna...@gmail.com writes: W dniu 2014-04-03 23:44, Junio C Hamano pisze: René Scharfe l@web.de writes: 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? That is an interesting idea. Perhaps this can be implemented as a new stage in the transformation pipeline, I wonder? There is currently no transformation that modifies the blob contents being compared, but I do not think there is anything fundamental that prevents one from being written. The new limit to this function body transformation would perhaps sit before the diffcore-rename and would transform all the blobs to empty, except for the part that is the body of the function the user is interested in. Well, there is 'texconv', e.g. .gitattributes *.jpg diff=jpg .git/config [diff jpg] textconv = exif ;-) So you could define this textconv sed -n -e '/^int main(/,/^}/p' to limit the output only to the definition of the function main(). Doesn't it fit in said place in the transformation pipeline? Not at all, unfortunately. The textconv conversion happens in the final output stage and comes way too late to influence the earlier stages like renames and pickaxe, which will still see the whole contents outside the definition of the function main(). -- 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
Re: [PATCH 06/10] log: --function-name pickaxe
W dniu 2014-04-03 23:44, Junio C Hamano pisze: René Scharfe l@web.de writes: 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? That is an interesting idea. Perhaps this can be implemented as a new stage in the transformation pipeline, I wonder? There is currently no transformation that modifies the blob contents being compared, but I do not think there is anything fundamental that prevents one from being written. The new limit to this function body transformation would perhaps sit before the diffcore-rename and would transform all the blobs to empty, except for the part that is the body of the function the user is interested in. Well, there is 'texconv', e.g. .gitattributes *.jpg diff=jpg .git/config [diff jpg] textconv = exif Doesn't it fit in said place in the transformation pipeline? -- Jakub Narębski -- 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
Re: [PATCH 06/10] log: --function-name pickaxe
Jakub Narębski jna...@gmail.com writes: W dniu 2014-04-03 23:44, Junio C Hamano pisze: René Scharfe l@web.de writes: 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? That is an interesting idea. Perhaps this can be implemented as a new stage in the transformation pipeline, I wonder? There is currently no transformation that modifies the blob contents being compared, but I do not think there is anything fundamental that prevents one from being written. The new limit to this function body transformation would perhaps sit before the diffcore-rename and would transform all the blobs to empty, except for the part that is the body of the function the user is interested in. Well, there is 'texconv', e.g. .gitattributes *.jpg diff=jpg .git/config [diff jpg] textconv = exif ;-) So you could define this textconv sed -n -e '/^int main(/,/^}/p' to limit the output only to the definition of the function main(). Doesn't it fit in said place in the transformation pipeline? Not at all, unfortunately. The textconv conversion happens in the final output stage and comes way too late to influence the earlier stages like renames and pickaxe, which will still see the whole contents outside the definition of the function main(). -- 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
Re: [PATCH 06/10] log: --function-name pickaxe
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
Re: [PATCH 06/10] log: --function-name pickaxe
René Scharfe l@web.de writes: 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? That is an interesting idea. Perhaps this can be implemented as a new stage in the transformation pipeline, I wonder? There is currently no transformation that modifies the blob contents being compared, but I do not think there is anything fundamental that prevents one from being written. The new limit to this function body transformation would perhaps sit before the diffcore-rename and would transform all the blobs to empty, except for the part that is the body of the function the user is interested in. -- 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