<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 21, 2013 at 11:20 PM, Sean Farley <span dir="ltr"><<a href="mailto:sean.michael.farley@gmail.com" target="_blank">sean.michael.farley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">> This has a nice picture of the way clean clean and smudge filters work.<br>

><br>
> <a href="http://git-scm.com/book/ch7-2.html#Keyword-Expansion" target="_blank">http://git-scm.com/book/ch7-2.html#Keyword-Expansion</a><br>
><br>
> The idea is that you tell git to use your filter in a place that is not<br>
> checked into the repository:<br>
><br>
> echo '*.c filter=petscfmt' >> .git/info/attributes<br>
><br>
> (If you wanted it to be checked in, you'd put it in .gitattributes, but we<br>
> don't want that now.) Then set what the petscfmt filter does<br>
><br>
> git config filter.petscfmt.clean 'uncrustify read from stdin and write clean<br>
> version to stdout'<br>
> git config filter.petscfmt.smudge 'uncrustify read from stdin and write<br>
> smudged version to stdout'<br>
><br>
> The smudged version is whatever the user wants to interact with, the cleaned<br>
> version is whatever should go in the PETSc repository. (You can also just<br>
> edit these filters in .git/config.)<br>
<br>
</div>Does this just basically run or regex / uncrustify filter before a<br>
commit and after a checkout? </blockquote><div><br></div><div style>The clean filter is run when something is added to the index and the smudge filter is run when a file gets checked out (updated in the working tree). Git merge algorithms run in the index so they are not aware of the smudging or cleaning (they always work with the clean version).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Or is there something more fancy going<br>
on? What does the user see when there's a merge conflict?</blockquote></div><br>If there's a conflict, all versions are put into the working tree (smudged in the process). The user resolves the conflict and adds the result to the index (which runs the clean filter). The clean filter also gets run when you use "git add -p" or "git gui" for interactive staging (so you're viewing a diff of the cleaned representation).</div>
</div>