git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: smudge filters during checkout & crash consistency

From
Derek Moore <derek.p.moore@gmail.com>
Date
Nov 12, 2014, 19:41 UTC
Message-ID
<CAMsgyKa7zSqYFHVt9VGz2zarBwCcJRxjGtkAoaxbtrnMJCZxpg@mail.gmail.com>
In-Reply-To
<xmqqk33046ha.fsf@gitster.dls.corp.google.com>
Here's a solution that depends only/mostly on blob contents:
1) construct the ident of the blob via an `(echo -e -n "blob <size>\0"
; cat file) | sha1sum` equivalent if an $Id$ string is not found in
its contents,
2) look up the earliest commit with that blob hash at that path, and
3) use the reflog metadata from that earliest commit.

Then when switching from C-to-A or C-to-B, F will have the same contents as a noop switch when switching A-to-B from C-to-A (although, conceivably, you may get a commit that is in neither A nor B, but you will have the earliest introduction of that file at that state).

In other words, always use the earliest occurrence of a specific content at a given path, earliest commit wins irrespective of branches. Not the most elegant solution.

I may have to go back and let these people know that outside of build scripts they can't get what they think they want.

Thanks!
:D
On Wed, Nov 12, 2014 at 12:30 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> Derek Moore <derek.p.moore@gmail.com> writes:
>
>> I have a case where I would like to smudge files according to the
>> reflog information of the switching-to branch.
>
> Don't do that.
>
> When you have branches A, B and C, and a path F is the same between
> branches A and B but different in branch C, if you start from branch
> C and switch to branch A, F will be updated and obtain your smudge
> tailored for "branch A's instance of F".
>
> But if you then switch to B from that state, F will not even be
> modified (i.e. it will keep the contents you prepared for "branch
> A's instance of F").
>
> In short, do not make clean/smudge depend on anything but blob
> contents.
Previous: Junio C HamanoNext: Derek Moore
Message 3 of 5 in “smudge filters during checkout & crash consistency”
  1. Derek MooreNov 12, 2014
  2. Junio C HamanoNov 12, 2014
  3. Derek MooreNov 12, 2014
  4. Derek MooreNov 12, 2014
  5. Junio C HamanoNov 12, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.