threads / discuss / 36568

smudge/clean filters and SHA1 hashes

Subject: smudge/clean filters and SHA1 hashes

## tl;dr

3 messages between May 2, 2014 and May 2, 2014.

replies: 2people: 3as markdown or json

Leo Razoumov· May 2, 2014, 21:05 UTC · lore
Hi All,

surprisingly, searching this list and by way of Google I cannot find an answer to a simple question:

In presence of smudge/clean filters which SHA1 hash (clean content or smudged content) gets stored in the repository?

Thanks, --Leo--

P.S. Very similar question [1] was posted here in 2012 but went unanswered.
[1] http://git.661346.n2.nabble.com/workflow-clarification-sha1-merge-patch-diff-ws-smudge-clean-td7561818.html
Shawn Pearce· May 2, 2014, 21:07 UTC · re: Leo Razoumov · lore

Re: smudge/clean filters and SHA1 hashes

On Fri, May 2, 2014 at 2:05 PM, Leo Razoumov <slonik.az@gmail.com> wrote:
Show 5 quoted lines
> surprisingly, searching this list and by way of Google
> I cannot find an answer to a simple question:
>
> In presence of smudge/clean filters which SHA1 hash
> (clean content or smudged content) gets stored in the repository?
The clean version is used to obtain the SHA-1.
Junio C Hamano· May 2, 2014, 22:02 UTC · re: Leo Razoumov · lore

Re: smudge/clean filters and SHA1 hashes

Leo Razoumov <slonik.az@gmail.com> writes:
> In presence of smudge/clean filters which SHA1 hash
> (clean content or smudged content) gets stored in the repository?

You are cleaning cruft in the contents before the contents are hashed to compute the object name. The point is to keep clean objects in the object database, protected from dirty reality in the working tree (which you instanciate by applying the smudge filter to dirty the clean object in the ideal world).

The crlf conversion works exactly the same way. For portability, you keep a version terminated with LF in the object database and that is what is hashed to compute the blob object name, but we export with CRLF line endings for a working tree that wants files whose lines are terminated that way.

← back to recent threads