* Fun puzzle: successful merge's contents depends on...commit timestamps?
@ 2018-05-19 3:07 Elijah Newren
0 siblings, 0 replies; only message in thread
From: Elijah Newren @ 2018-05-19 3:07 UTC (permalink / raw)
To: Git Mailing List
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?
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-05-19 3:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-19 3:07 Fun puzzle: successful merge's contents depends on...commit timestamps? Elijah Newren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).