1 |
On 1 June 2012 22:54, Rich Freeman <rich0@g.o> wrote: |
2 |
> On Fri, Jun 1, 2012 at 12:55 AM, Kent Fredric <kentfredric@×××××.com> wrote: |
3 |
>> |
4 |
>> Hmm, thats annoying. Almost makes me wish it was the trees that were |
5 |
>> signed, not the commits. |
6 |
> |
7 |
> I think it is the tree that is signed, but that changes too. |
8 |
|
9 |
Nope, at least not as far as I can tell, and I just implemented commit |
10 |
signature verification >_> |
11 |
|
12 |
> Rebasing re-applies the same diff to the new head to give you a new |
13 |
> set of commits. When you apply the same diff to a different parent |
14 |
> you end up with a different tree, so the tree signature won't be the |
15 |
> same either. |
16 |
|
17 |
Not nessecarily. Given that : |
18 |
|
19 |
a file with a given content has a fixed SHA |
20 |
A tree is just a list of these SHA's , and that in turn is referenced |
21 |
by SHA, so if 2 commits have identical file content, their 'tree' sha |
22 |
will be the same ( in theory ). |
23 |
|
24 |
So that means, if you perform a rebase, assuming the filesystem looks |
25 |
the same as it did before the rebase, it will have the same SHA1 for |
26 |
the tree, regardless of the process of how it got to be that way. |
27 |
|
28 |
The only SHA that has to change is the 'parent', |
29 |
|
30 |
( Demonstration here: https://gist.github.com/2851330 , note I have 2 |
31 |
commits with the same tree sha, and the tree sha only really refers to |
32 |
one file 3 times as all the empty files have same sha ) |
33 |
|
34 |
But unfortunately, with a rebase, even if the trees don't change, if |
35 |
the history order changes, the commits themselves have to change due |
36 |
to the "parent" sha needing to change ( yes, I know commits are |
37 |
immutable in reality, and they don't change, but are duplicated and |
38 |
the duplicate is given the new sha , but the effect is still the same |
39 |
, because those unreferenced commits will eventually get reaped ) |
40 |
|
41 |
|
42 |
-- |
43 |
Kent |
44 |
|
45 |
perl -e "print substr( \"edrgmaM SPA NOcomil.ic\\@tfrken\", \$_ * 3, |
46 |
3 ) for ( 9,8,0,7,1,6,5,4,3,2 );" |
47 |
|
48 |
http://kent-fredric.fox.geek.nz |