[Freeipa-devel] [TIP] Make patches from Git more informative

Petr Viktorin pviktori at redhat.com
Fri Apr 26 13:47:18 UTC 2013


Hello,

I'm sure you're aware of hunk header lines in patches:
     @@ -24,5 +24,5 @@ class SomeClass(object):


It's possible to configure which source line Git selects for the hunk 
header. By default it uses non-indented lines.
A "python" regexp, which selects functions, classes and methods, is 
already included in Git; you just have to enable it. I also use custom 
regexps for ldifs and API.txt:


$ cat ~/.gitattributes  # (Or .git/info/attributes for project-specific 
config)
*.py diff=python
API.txt diff=apitxt
*.ldif diff=ldif
*.update diff=ldif


$ git config -l  # set with e.g. `git config --global key="value"`
...
core.attributesfile=~/.gitattributes
diff.apitxt.xfuncname=^command: .*
diff.ldif.xfuncname=^dn:.*


Enjoy your Friday!

-- 
Petr³




More information about the Freeipa-devel mailing list