Gentoo Archives: gentoo-dev

From: Peter Stuge <peter@×××××.se>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Git workflow
Date: Sun, 05 Jul 2015 12:10:09
Message-Id: 20150705120954.21113.qmail@stuge.se
In Reply to: Re: [gentoo-dev] Git workflow by "C Bergström"
1 C Bergström wrote:
2 > >> 3) Ever tried to make a patch of the *actual* merge commit? Can one of
3 > >> the advocates of merge show me the git command to do that? (Sure you
4 > >> can diff between 2 commits, but the "merge" commit likes to avoid
5 > >> being seen)
6 > >
7 > > If there are no conflicts when merging then the merge commit does not
8 > > contain any changes, so how could there be a patch? Do you actually
9 > > know the Git data model? I wrote it down the other day.
10 > >
11 > > http://peter.stuge.se/git-data-model
12 >
13 > You deflect the question so nicely. If there is no merge conflict then
14 > a rebase would be just fine?
15 >
16 > You clearly know git very well - much better than I, why not just
17 > answer the question?
18
19 I tried to. My point was that when merge commits don't lead to
20 conflicts on file level (branches touch different files) then the
21 merge commit does not modify anything, so the "patch" is empty.
22
23 This is where knowing the data model becomes important to not get
24 angry with Git. When you know what is going on internally it's very
25 easy to deal with all the different cases. If on the other hand you
26 make assumptions about what Git does internally based on previous
27 experience or natural language then it's easy to get frustrated.
28
29
30 Now, if there are changes in a file in both branches then this needs
31 to be resolved somehow, manually or automatically. There are two or
32 more sources of changes.
33
34 A patch expresses the difference between two objects; the before and
35 the after so to say, but it can't really be used to express such a
36 merge resolution, becaue there are two before and one after. You
37 would need multiple patches to do so, one for each merged branch.
38
39 These you could create by diffing each parent with the merge commit.
40
41 But why do you need to?
42
43
44 > >> and a "git pull --rebase" before push will be clean and fast (no
45 > >> problems).
46 > >
47 > > Q: How do you deal with the two commits from other developers that
48 > > were pushed while you were rebasing?
49 > >
50 > > A: You end up having to spin on the remote repo. That's really clumsy.
51 >
52 > Pragmatically - the answer to you question is the same as it exists
53 > today. You're scared of something which gentoo devs have been dealing
54 > with and resolving for years. It's not like CVS/SVN handles this
55 > magically better.
56
57 I'm not scared of spinning, but do you agree that it's really clumsy?
58
59 A merge commit *is* a much better way to handle this. It's accurate
60 and it makes sense.
61
62
63 > > Arguing without checking makes you look bad.
64 >
65 > How? I didn't claim to know and clearly not knowing didn't seem
66 > important (to me).
67
68 Not knowing what you're arguing makes you look bad because you can
69 only contribute to the discussion if by chance you are correct, which
70 isn't so likely. It's more likely that your argument wastes time and
71 contributes nothing, if you don't know what you argue. This makes you
72 look bad.
73
74
75 > I'm just trying to passionately bring this up.
76
77 I think that's fine, and I welcome every discussion about workflow,
78 but it's only useful when everyone makes the effort to be
79 constructive and well-informed.
80
81
82 > >> I can't say I've ever cared to know the date of a commit, but I can
83 > >> say I have cared a lot about knowing which commit came 1st. Rebase,
84 > >> for better or worse, forces something to be 1st and it's clear and
85 > >> easy to see.
86 > >
87 > > A rebase, like a cherry-pick, loses the very information you claim to
88 > > care about; the original parent of the commit.
89 >
90 > To clarify - I don't (clearly) give a pooh what the original parent
91 > was. I care much more about a linear history.
92
93 The linear history doesn't say what came first however, so you're
94 going against yourself.
95
96
97 > I rarely can see any value of the at-to-time of original commit
98 > compared to the final at-push-time commit (what's rebased).
99
100 Maybe that's the problem. There is great value in this, because it
101 shows how the commit in question was intended to change the base it
102 starts out with.
103
104 Rebasing might require modifying the commit so that it applies to the
105 new base, so after a rebase it is impossible to know if a given part
106 of the commit was created before the rebase or as part of the rebase.
107
108 This has two drawbacks; it makes review more difficult and risks
109 introducing bugs because of incomplete or incorrect rebasing.
110
111 A rebase, like a cherry-pick, combines these two changes into one,
112 and shouldn't be done too lightly.
113
114
115 > The value of linear history outweighs the arbitrary point you started from.
116
117 Linear history looks neat, and as I wrote earlier I really like it
118 too, but I also think that losing the extra information within merge
119 commits is not something to be take too lightly.
120
121
122 > imho a commit and development is not done until it's ready to be pushed.
123
124 I agree with that, but I think that's separate from the merge vs.
125 rebase discussion.
126
127
128 > >> If I controlled the gentoo git server, I'd
129 > >
130 > > I think it's a good thing that you don't, since you seem to still
131 > > need to study Git in more detail.
132 >
133 > Peter - I'm ashamed of you - don't be a dick. We can keep this civil
134 > without subtle insults.
135
136 Sorry about that - I did not mean to insult - I was just being
137 honest, it did seem to me that you didn't know the data model so
138 well and I think that's important when controlling a repo.
139
140
141 > I understand you are one of the people who feels strongly about
142 > this in the opposing way.
143
144 It's not that simple I'm afraid. :) I do like a linear history and I
145 rebase a lot myself, but I am also very well aware of the loss of
146 information that comes with it, and retaining that information is a
147 quite significant benefit of using merge commits.
148
149
150 > git brings out a lot of strong religious-like views. (immutable)
151
152 What is immutable is that I see great benefits with both methods,
153 *and* drawbacks with both methods. Sorry to disappoint.
154
155
156 //Peter