RE: [Question] Signature calculation ignoring parts of binary files
- Date: Thu, 13 Sep 2018 11:38:21 -0400
- From: "Randall S. Becker" <rsbecker@xxxxxxxxxxxxx>
- Subject: RE: [Question] Signature calculation ignoring parts of binary files
On September 13, 2018 11:03 AM, Junio C Hamano wrote:
> "Randall S. Becker" <rsbecker@xxxxxxxxxxxxx> writes:
> > The scenario is slightly different.
> > 1. Person A gives me a new binary file-1 with fingerprint A1. This
> > goes into git unchanged.
> > 2. Person B gives me binary file-2 with fingerprint B2. This does not
> > go into git yet.
> > 3. We attempt a git diff between the committed file-1 and uncommitted
> > file-2 using a textconv implementation that strips what we don't need to
> > 4. If file-1 and file-2 have no difference when textconv is used,
> > file-2 is not added and not committed. It is discarded with impunity,
> > never to be seen again, although we might whine a lot at the user for
> > attempting to put
> > file-2 in - but that's not git's issue.
> You are forgetting that Git is a distributed version control system,
> Person A and B can introduce their "moral equivalent but bytewise
> copies to their repository under the same object name, and you can pull
> them--what happens?
> It is fundamental that one object name given to Git identifies one
> byte sequence contained in an object uniquely. Once you broke that, you
> longer have Git.
At that point I have a morally questionable situation, agreed. However, both
are permitted to exist in the underlying tree without conflict in git -
which I do consider a legitimately possible situation that will not break
the application at all - although there is a semantic conflict in the
application (not in git) that requires human decision to resolve. The fact
that both objects can exist in git with different fingerprints is a good
thing because it provides immutable evidence and ownership of someone
bypassing the intent of the application.
So, rather than using textconv, I shall implement this rule in the
application rather than trying to configure git to do it. If two conflicting
objects enter the commit history, the application will have the
responsibility to resolve the semantic/legal conflict.