eddad00420e26bcb976f2f8fd5cacd91bcbdff6c
[git-annex.git] /
1 [[!comment format=mdwn
2  username="joey"
3  subject="""comment 1"""
4  date="2020-03-26T18:15:57Z"
5  content="""
6 Little bit of a scary change, because calls to adjustTree could be not
7 handling the case of a submodule correctly in their adjusttreeitem
8 function.
9
10 So I checked them all..
11
12 Command.Export uses adjustTree with an adjusttreeitem
13 function that runs catKey on the sha from the TreeItem.
14 I think that would be ok, because catKey will see it's not 
15 a key, and in that case it passes back the TreeItem unchanged.
16
17 Each different adjusted branch has its
18 own function. Most of those check if the TreeItem
19 is a symlink, with a submodule is not, and they'll return
20 it unchanged.
21
22 The PresenceAdjustment instead
23 uses catKey, and again looks ok, because it falls back to returning the
24 TreeItem unchanged.
25
26 The LockAdjustment, when the TreeItem is not a symlink, also uses catKey,
27 which will see it's not a key, and also falls back to returning the
28 TreeItem unchanged.
29
30
31 Think that's everything, so this seems a safe change to make.
32
33 ----
34
35 But.. I don't actually understand how your change fixes the problem!
36
37 (Of course, I tried your patch, and it does work...)
38
39 I've been staring at it for 30 minutes and it seems to me that
40 the TreeItem you have it construct gets passed to adjusttreeitem,
41 which always returns it unchanged (per analysis above). Then you
42 deconstruct the TreeItem, extracting the file mode and sha, and
43 construct a TreeCommit from those. As far as I can see, that TreeCommit
44 must be identical to the one it constructed before this patch.
45
46 Hmm, so I added a debug print and it's not the same, the sha
47 is different.
48
49 What am I missing?
50 """]]