forked from php/karma
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.POST_RECEIVE_MAIL
119 lines (75 loc) · 3.41 KB
/
README.POST_RECEIVE_MAIL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
Post receive mail script solutions.
digits - commits,
chars - branches (except N & O)
N, O - new and old revisions in push per branch.
------------
Branch mail:
This part contains info only about mail per branch. For mail per commit logic different.
New branch (0..N):
1 - 2 - A (already on server)
\
3 - B (pushed)
We get all commits reachable from new branch and not from all other NOT NEW branches:
git rev-list B --not A -> 3-B
1 - 2 - A (only local)
\
3 - B (pushed)
Because A branch not pushed on server before we need mail about all commits including 1-2. e.g. 1-B
1 - 2 - 3 - 4 - A (already on server)
\ /
5 - 6 - B (pushed)
We can't know what we need also 5 commit in B, so we mailed only about B commit for this branch.
2-6 commits was mailed in A branch.
1 - 2 - 3 - A (already on server)
\ \
5 - 6 - B (pushed)
We can't know what we need also 3 commit in B mail... any ideas?
Now we send mail with 5-B commits only.
1 - 2 - 3 - A (already on server or pushed)
\
4 - 5 - B (pushed)
\
6 - C (pushed)
If we use git rev-list B --not A C we skip 4-5 revisions in B.
So we use git rev-list B --not A. See first situation in "New branch" section.
Deleted branch (O..0):
We don't care about revisions in deleted branch. (or care?)
Update branch (O..N):
1 - 2 - O - 3 - 4 - N
Maill full log between O and N. (e.g. 3-N) git rev-list O..N
1 - 2 - N 1 - 2 - 3 - 4 - N
\\ or \\
3 - 4 - O 5 - 6 - O
It's mean user used --force option for pull and remove previosly revisions.
(rewind N revision in first case and replace 5-O revisions by 4-N)
We can check it by command: git rev-list N..O.
If result of this command not empty - we have such cases, and this
result is list of discarded revisions.
------------
Tag mail:
Add, delete and update tag:
If new(updated) tag is annotated - we write full info about it and target.
If it not annotated - only about commit.
For old(removed) tag - we write only sha of old commit/tag.
------------
Commit mail:
(Realization of this part in progress)
1 - 2 - 3 - A (pushed, but not new branch)
5 - 2 - 6 - B (pushed, but not new branch)
3 - 5 - 7 - C (already on server)
We must check was every commit on repository before or not.
git rev-list --max-count=1 REV --not ALL BRANCHES EXCEPT PUSHED BRANCHES WITH THIS COMMIT
If result empty - this commit already was pushed in one of others repository.
Examples:
for 2 rev : we send mail
for 3 rev : we not send mail, because it already in C branch
1 - 2 - 3 - A (pushed)
\
4 - 5 - B (pushed, new)
6 - 7 - 8 - C (already on server)
We must mark 1 commit as commit in branches A and B.
If we didn't it and run "git rev-list --max-count=1 sha_for_1_commit --not B C" we get wrong result,
because commit 1 also in B branch.
For this we get "old" revision of every updated branch and check if it placed in every new branches.
If it is we mark all revisions between "old" of updated branch and "new" of new branch as revision also from new branch.
So we get this command "git rev-list --max-count=1 sha_for_1_commit --not C"