On 02/21/2014 07:34 AM, Laszlo Ersek wrote: > On 02/21/14 12:43, Laszlo Ersek wrote: >> This is a small hint for people who want to see the changes in .uni >> files (== UCS-2 encoded strings for HII forms) while using git. I've >> distilled it from <http://git-scm.com/docs/gitattributes> and I'm >> posting it to save others time. >> >> (1) Add the following lines to your .git/info/attributes (the .uni one >> is imporant, the others are here just for completeness): >> >> *.efi -diff >> *.EFI -diff >> *.uni diff=uni >> *.UNI diff=uni >> *.bin -diff >> *.BIN -diff >> *.raw -diff >> *.RAW -diff >> *.bmp -diff >> *.BMP -diff >> >> (2) Then edit .git/config: >> >> [diff "uni"] >> textconv = iconv -f UCS-2 -t UTF-8 >> binary = true >> >> (3) Profit! :) >> >> Note that this only helps with *viewing* changes as patches. Git still >> won't help you resolve conflicts during rebases, it won't try to merge >> changes, and importantly it won't generate textual patches in >> git-format-patch. You'll also still need a UCS-2 compatible text editor >> that preserves the BOM (like "gedit") to edit .uni files. > > Sorry for the self-followup, but I figured out how it can be made work > for merges too (cherry-pick, conflicts in rebase / merge etc.). > > So, in addition to the above: > > (4) modify .git/info/attributes like this (ie. add the "merge" attribute > for *.uni files): > > *.uni diff=uni merge=uni > *.UNI diff=uni merge=uni > > (5) append to .git/config: > > [merge "uni"] > name = merge driver for UCS-2 encoded text files > driver = uni-merge %O %A %B > > (6) Place the attached "uni-merge" script on your PATH (and make it > executable). > > (7) Profit more! :)
Thanks, great hints! BTW, if you like a graphical tool, the program "diffuse" does a pretty good job of graphically diffing and merging .uni files. Install it from http://diffuse.sourceforge.net/ (it's just a python script), set it as your difftool and/or mergetool, and you're golden. In your .git/config or ~/.gitconfig: [diff] tool = diffuse [difftool] prompt = false [merge] tool = diffuse [mergetool] prompt = false Then "git difftool <args>" or "git mergetool" will invoke it automatically. You can also use "diffuse -m" to show diffs against HEAD in your workarea (one file per tab, very handy) or "diffuse -c <commit>" to show the changes introduced by a particular commit (again, one file per tab.) Highly recommended. The program "meld" works too, and displays changes a bit more prettily. But it requires a newer version of python than I have on my old build server, so I haven't used it much. -- Brian -------------------------------------------------------------------- "Great works are performed not by power, but by perseverance." -- Samuel Johnson ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
