1 |
On 7 July 2015 at 01:48, Peter Stuge <peter@×××××.se> wrote: |
2 |
> fact that a merge commit ideally does *not* contain any |
3 |
> modifications. |
4 |
|
5 |
|
6 |
That's not /entirely/ true. The merge commit will have a new TREE |
7 |
object which is a composite TREE object of both of its PARENT TREE |
8 |
objects ( But all BLOBs in the resulting TREE will have existed on one |
9 |
of the parents as-is ) |
10 |
|
11 |
But as I mentioned in another reply, there's no way to view only the |
12 |
treewise diffs in a format suitable for diff, because diffs pertain to |
13 |
file contents, not SHA1s of BLOBs and SHA1s of TREEs. |
14 |
|
15 |
And yes, "Ideally" is where it gets messy. Non-Ideal commits have |
16 |
*new* BLOB objects that don't exist on either parent, and these can be |
17 |
hard to deal with. |
18 |
|
19 |
There's additionally lots of git tools that use the merge |
20 |
infrastructure to create non-merge commits with multiple parents. ( |
21 |
Git subtree for instance ), and some of them may inject *files* into |
22 |
the tree that don't exist in either parent, or entirely re-order the |
23 |
structure of one of the parents before applying it to master. |
24 |
|
25 |
The problem with those "merge" commits is those commits contain a |
26 |
significant amount of state in the merge itself, such that you cannot |
27 |
trivially recreate the merge commit from either of its parents alone. |
28 |
|
29 |
You can additionally turn any existing commit into one with two |
30 |
parents without changing the commits own changes, simply by abusing |
31 |
the model and git grafts and telling git "This commit now has two |
32 |
parents". Git goes "Sure, I'll put that SHA1 there and make no other |
33 |
changes". |
34 |
|
35 |
|
36 |
-- |
37 |
Kent |
38 |
|
39 |
KENTNL - https://metacpan.org/author/KENTNL |