# Fun puzzle: successful merge's contents depends on...commit timestamps?

1 messages from 2018-05-19 to 2018-05-19. Participants: Elijah Newren.
Thread: https://gitlist.dev/t/48521

## Elijah Newren, 2018-05-19 03:07

Subject: Fun puzzle: successful merge's contents depends on...commit timestamps?
Message-ID: <CABPp-BFc1OLYKzS5rauOehvEugPc0oGMJp-NMEAmVMW7QR=4Eg@mail.gmail.com>
URL: https://gitlist.dev/e/CABPp-BFc1OLYKzS5rauOehvEugPc0oGMJp-NMEAmVMW7QR%3D4Eg%40mail.gmail.com

```
Check this out; I merge another branch successfully:
  $ git merge -m F $othersha; echo $?
  0

This is just a simple test repo:
  $ git log --oneline
  18f5e65 (HEAD -> master) F
  7472b46 E
  ea0d801 D
  4486f96 C
  7727e3b B
  ee47c13 A

Below it is important to note that one commit was made at 1526194997,
and this value doesn't appear anywhere else in fast-export output:
  $ git fast-export --no-data master | grep 1526194997
  author Elijah Newren <newren@gmail.com> 1526194997 -0700
  committer Elijah Newren <newren@gmail.com> 1526194997 -0700

Let's create a new branch and rewrite history ONLY changing that one timestamp:
  $ git checkout -b redo
  $ git fast-export --no-data redo | \
       sed -e s/1526194997/1500000000/ | \
       git fast-import --quiet --force

At this point, the trees for 'master' and 'redo' match, as you'd expect:
  $ git diff --quiet master HEAD; echo $?
  0

Let's redo that merge, shall we?:
  $ git checkout --quiet 'redo^1'
  $ git merge -m newF 'redo^2'; echo $?
  $ 0

Did we get the same merge result?  Nope:
  $ git diff --quiet master HEAD; echo $?
  1


I believe there are about half a dozen solutions to this puzzle.  Can you find
at least one?

```
