mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-21 17:41:16 +02:00
Compare commits
943 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d81cf34e37 | ||
|
9902317679 | ||
|
33e164168f | ||
|
f40ba68d57 | ||
|
cb0c8b8ae4 | ||
|
eba5945d2f | ||
|
4c67925531 | ||
|
3c60121ca7 | ||
|
46bb1cf026 | ||
|
13013e90f3 | ||
|
785ba171f4 | ||
|
fb80265b52 | ||
|
6fae585d28 | ||
|
670562a9c5 | ||
|
ed07d8a308 | ||
|
74399f333f | ||
|
d1cec5ecfa | ||
|
73ad7d2ef3 | ||
|
5b36379172 | ||
|
e38e502e20 | ||
|
3cc5b11b0d | ||
|
4c9bf91a2c | ||
|
03ff7687e0 | ||
|
f646154ead | ||
|
a6d2f47a2b | ||
|
1837194882 | ||
|
9ca26432f6 | ||
|
67595c0d0b | ||
|
6d03cf831e | ||
|
e232c49b10 | ||
|
25e71ad41e | ||
|
f014e42a06 | ||
|
d14a724b53 | ||
|
91788e0200 | ||
|
fc0c6f48c7 | ||
|
002fa73460 | ||
|
2fdc649202 | ||
|
0c910afe11 | ||
|
1cbe502cc2 | ||
|
f916aa0fe3 | ||
|
04728b5b91 | ||
|
bbb0b8c17c | ||
|
0938a2dca3 | ||
|
9df0eafa25 | ||
|
e13eef8cfe | ||
|
64b7068846 | ||
|
8aadf79f80 | ||
|
fd6e91077a | ||
|
9413b48a0b | ||
|
be4f6a754c | ||
|
1a5fe4326f | ||
|
faf4b503b2 | ||
|
7455604f0c | ||
|
2c6a0fdca8 | ||
|
5c29b0a5fe | ||
|
fd8e8a421a | ||
|
951c909a67 | ||
|
53e6c947f1 | ||
|
100ec93a65 | ||
|
2c3a229a3c | ||
|
e7653a67a1 | ||
|
5707ad3bb7 | ||
|
4c13a8458b | ||
|
e08d1fcc15 | ||
|
9df090e551 | ||
|
f3486360d2 | ||
|
9e9e1e0e52 | ||
|
aec826b023 | ||
|
934dd41fa6 | ||
|
7907786040 | ||
|
951fb572a7 | ||
|
722bcefbbf | ||
|
c76ee5688b | ||
|
fc29a405e8 | ||
|
29f3a6e492 | ||
|
2282e24028 | ||
|
f960e19c59 | ||
|
921d90fd8b | ||
|
be29d5f7ad | ||
|
e90bbcaa52 | ||
|
27798c3efc | ||
|
54381f438b | ||
|
d05150a331 | ||
|
a3262636b8 | ||
|
9ff371a147 | ||
|
34df9deff1 | ||
|
fa8d40faca | ||
|
a4ca54425f | ||
|
4c54139afc | ||
|
7e0654bd9e | ||
|
f29458bd3a | ||
|
539d9f4c30 | ||
|
66e8262530 | ||
|
31411a9462 | ||
|
a804f0e052 | ||
|
1193627014 | ||
|
9a505fafda | ||
|
d74d8ecc2e | ||
|
27c2dcf60e | ||
|
49df677c47 | ||
|
a9cc538ab5 | ||
|
60d7e56c69 | ||
|
04c4028aea | ||
|
fd45a032a7 | ||
|
aff11bc65e | ||
|
a27863b6d1 | ||
|
5f37944dff | ||
|
7e12aac61c | ||
|
1d032f5220 | ||
|
41cc110e62 | ||
|
8f171210b9 | ||
|
48898e5d0b | ||
|
dde0052ca2 | ||
|
3702dac0d5 | ||
|
f33e6ae09e | ||
|
047a67a90b | ||
|
0b177574c9 | ||
|
32f289ae3b | ||
|
98c5a1e006 | ||
|
dd758ad8dc | ||
|
c4ccf16c43 | ||
|
6a3c03762a | ||
|
f011d6d4d7 | ||
|
b639fa1648 | ||
|
7d61834dc9 | ||
|
a739991b36 | ||
|
858324c21a | ||
|
2c3efd72ce | ||
|
2b05b104ef | ||
|
89845f6728 | ||
|
ceb3544697 | ||
|
93a1de4842 | ||
|
da89afda58 | ||
|
8f1d62ad3b | ||
|
c016d48735 | ||
|
5e9bcb6301 | ||
|
89cd4dd424 | ||
|
4c57db7924 | ||
|
f1adaef458 | ||
|
5651cc7413 | ||
|
e58237ee3f | ||
|
e14ea9979b | ||
|
b1d7348a20 | ||
|
30787e48f2 | ||
|
2ef33b5338 | ||
|
a52cd59727 | ||
|
2fd039864b | ||
|
310866525b | ||
|
dde9a8648e | ||
|
f189ccd2d6 | ||
|
f99489d5c5 | ||
|
fea902adc8 | ||
|
678fec3f6a | ||
|
eae9154811 | ||
|
3c0705ecf3 | ||
|
12cb6cd3c9 | ||
|
b36849dc1f | ||
|
8fd43f215c | ||
|
789188f13c | ||
|
935b40fd8e | ||
|
2b410e44b2 | ||
|
05e3726415 | ||
|
783b1967e2 | ||
|
23f0728879 | ||
|
33f3165296 | ||
|
3f9016430f | ||
|
1f4d84b7b2 | ||
|
858197b453 | ||
|
6b13dafe61 | ||
|
d389ed25a5 | ||
|
32fc44aa83 | ||
|
9d8fba62b3 | ||
|
79daf31058 | ||
|
a037cd81ff | ||
|
80707c4736 | ||
|
5db8cf3bd1 | ||
|
49d397a9ee | ||
|
441986a473 | ||
|
735676267e | ||
|
4c0e567062 | ||
|
b4e8a7c4d1 | ||
|
2559a34b97 | ||
|
f64c232953 | ||
|
3ffedeab03 | ||
|
bf187304dc | ||
|
f2afed3098 | ||
|
09cb999145 | ||
|
f6450b8f92 | ||
|
c259c436d7 | ||
|
cc6b3f60c6 | ||
|
228247511a | ||
|
75b5be236a | ||
|
32f1c41f28 | ||
|
2852cca99e | ||
|
902a749fd9 | ||
|
826c606952 | ||
|
d71fad2ab7 | ||
|
0a5dc640a1 | ||
|
6db387a21e | ||
|
63504bf132 | ||
|
754482bf5d | ||
|
75f166b6b9 | ||
|
165cf33771 | ||
|
4d2ea7dc41 | ||
|
255adc40ae | ||
|
4df1a24096 | ||
|
6e452c4da7 | ||
|
b7812be33a | ||
|
90f9bb12c6 | ||
|
6233e88f7f | ||
|
d7570895cc | ||
|
1a906f800d | ||
|
6678593b3c | ||
|
e2ec4b7c23 | ||
|
8fc64741d9 | ||
|
ce9b86082c | ||
|
a3868ef536 | ||
|
b7d597e40c | ||
|
2bcd9471c9 | ||
|
d1e4af66c1 | ||
|
01322af2e8 | ||
|
13f0e1255a | ||
|
792cde7081 | ||
|
033aaf4b38 | ||
|
2691673588 | ||
|
0d560f3441 | ||
|
8fcda0442e | ||
|
bf48c8ebdd | ||
|
31b5e9177f | ||
|
5b0cbf3788 | ||
|
57cabb3ad3 | ||
|
274149dd14 | ||
|
5e92b82ac6 | ||
|
96152c38b1 | ||
|
0168b7073d | ||
|
889409ba31 | ||
|
e8c63e21af | ||
|
b38b61bbc1 | ||
|
635273cea6 | ||
|
b5d2780b22 | ||
|
00733b4468 | ||
|
884c60480d | ||
|
ad70af1248 | ||
|
91f27bf9bd | ||
|
cc5484de10 | ||
|
9fbdd7d787 | ||
|
e0a63a20e0 | ||
|
96b4780727 | ||
|
f2fcd9dcd8 | ||
|
446a41d595 | ||
|
65b6301ea2 | ||
|
23d0735f90 | ||
|
d3efca3982 | ||
|
61716bd8f7 | ||
|
6d613fb28e | ||
|
a5444fb3db | ||
|
e9b1b908ee | ||
|
4a3f40460b | ||
|
73836ce8c4 | ||
|
b1b8c5e9f4 | ||
|
662b8bc2a2 | ||
|
afe1f1c4af | ||
|
9ddc35e343 | ||
|
ff7424179e | ||
|
65cf6cc848 | ||
|
a70073e768 | ||
|
815715e5a2 | ||
|
4bc7240eee | ||
|
971e3a35c1 | ||
|
f38842320e | ||
|
952cb8046f | ||
|
30a831698e | ||
|
d9a8eff2de | ||
|
295f560a12 | ||
|
0cf89a83c1 | ||
|
f6b58964d7 | ||
|
6ec07a6bd7 | ||
|
cbdd5f787c | ||
|
ca9169fbe9 | ||
|
ae922afa2d | ||
|
703d18e50d | ||
|
ed31dff5ab | ||
|
858126bca1 | ||
|
9f9289fc68 | ||
|
1a09afc729 | ||
|
e7ae13deef | ||
|
023cad4461 | ||
|
3e74b5cf51 | ||
|
817a405118 | ||
|
a97d6bf24b | ||
|
009a073990 | ||
|
2ec5dc1661 | ||
|
b900c04316 | ||
|
036ce3f813 | ||
|
62f600cf1c | ||
|
976c2a05fa | ||
|
4e5ee2b67a | ||
|
5ca6867aaf | ||
|
04c6c31f8e | ||
|
abb19eff39 | ||
|
31e8436a1c | ||
|
a977ab7889 | ||
|
336e311a7c | ||
|
5554165a0c | ||
|
bfb44f8854 | ||
|
0f5b399e35 | ||
|
24859fe5b6 | ||
|
642f844735 | ||
|
474d636794 | ||
|
367ff327ed | ||
|
2525195749 | ||
|
b93568cce4 | ||
|
e0c6ab2d44 | ||
|
c85ff532e9 | ||
|
e67ece26f0 | ||
|
12dbdaac76 | ||
|
bafd778c25 | ||
|
97f7f88bed | ||
|
3b51da9dae | ||
|
7e6ff69c00 | ||
|
3611a3e552 | ||
|
39348cd27e | ||
|
9c66d1d9ea | ||
|
0c332f0480 | ||
|
03912ce014 | ||
|
cb74f1b84d | ||
|
ff96bda138 | ||
|
19d889daa2 | ||
|
ff2464c87d | ||
|
98ae013e90 | ||
|
7b907ed348 | ||
|
de39d09caa | ||
|
bdc90aeaee | ||
|
cc2071c3fd | ||
|
1e40c2e579 | ||
|
b0308d86dc | ||
|
cf02cd7ba0 | ||
|
85a7396525 | ||
|
be5323a05f | ||
|
80cea8747f | ||
|
977dcf96e0 | ||
|
281a0389c1 | ||
|
6362462da8 | ||
|
25d6e2a660 | ||
|
0161e46b5a | ||
|
8906b2891b | ||
|
fd6034aaf2 | ||
|
5db5e16ab6 | ||
|
dc2b28ed76 | ||
|
c746875fcf | ||
|
8917f47347 | ||
|
407fbfa6ce | ||
|
c4b5b121a5 | ||
|
03d6bab643 | ||
|
bc299b8317 | ||
|
91417e9715 | ||
|
e214728725 | ||
|
9e627af9a4 | ||
|
5ca3046da6 | ||
|
2cf80f4b18 | ||
|
397474ecb1 | ||
|
251fb935ff | ||
|
ddb63a7897 | ||
|
524885dd65 | ||
|
fd76f090a2 | ||
|
d98a86d2a2 | ||
|
377acb9757 | ||
|
ab79069dc7 | ||
|
51d0becb42 | ||
|
a85c5ab9ff | ||
|
2bb8b3a562 | ||
|
79494047b0 | ||
|
c864ccf9b1 | ||
|
930d1759ae | ||
|
9a0b0da1fe | ||
|
2e17dda8bb | ||
|
935caa7f95 | ||
|
98460a8d9d | ||
|
36f02c0c32 | ||
|
a503947fba | ||
|
0f3923c4d7 | ||
|
b6206e4788 | ||
|
75f1afd1fd | ||
|
700b6b524b | ||
|
a5f28a4544 | ||
|
1773e88643 | ||
|
59f5bbab0d | ||
|
3edb0c5894 | ||
|
bb5f694fc5 | ||
|
0d1e001b9c | ||
|
98548c83d3 | ||
|
87efc8c6d4 | ||
|
3792867955 | ||
|
0144817971 | ||
|
3ebbdfaa75 | ||
|
950f2e2074 | ||
|
2368bbb672 | ||
|
66c803fae2 | ||
|
0308d44a16 | ||
|
00324cea10 | ||
|
9a8ca3e877 | ||
|
1562e9ab70 | ||
|
e31c02d4bf | ||
|
61b08b5c01 | ||
|
cebe3a6b2f | ||
|
91d64656a4 | ||
|
18f46fd7cf | ||
|
fca7ddc6ea | ||
|
431b26f6d7 | ||
|
6853bf323a | ||
|
e3c2963222 | ||
|
e4a0a04829 | ||
|
8371f94d06 | ||
|
b7da5a6cb7 | ||
|
c58708d3ee | ||
|
3012971e92 | ||
|
eb1075dd4c | ||
|
fcc7cdab11 | ||
|
5b8fe1e181 | ||
|
4bea219128 | ||
|
52627032bc | ||
|
f0db3da713 | ||
|
42072783c9 | ||
|
bb14c97d40 | ||
|
fa2a513c62 | ||
|
a2d365c81f | ||
|
f995bcc87a | ||
|
2eeae84cbd | ||
|
f42ec6120e | ||
|
941281ae12 | ||
|
c764a542c0 | ||
|
cf91cfb993 | ||
|
237270ef50 | ||
|
d409d3ab57 | ||
|
21290d4e80 | ||
|
22295944df | ||
|
be6edaddcb | ||
|
54f0293f0a | ||
|
edbb9eefd6 | ||
|
5c0bee9b20 | ||
|
d9db188274 | ||
|
e0df611cbc | ||
|
5acfc7c4bc | ||
|
cf6699fb4f | ||
|
cbeeaa1b11 | ||
|
410af6971b | ||
|
a78a0266c4 | ||
|
d800305b34 | ||
|
0cee52e0d3 | ||
|
e7493e953f | ||
|
2d1efcc270 | ||
|
b746757209 | ||
|
93c25c9a35 | ||
|
5d6b71fdbb | ||
|
21fd3da6f5 | ||
|
37a34c1a28 | ||
|
f6e5ce65b2 | ||
|
e5c56fe30d | ||
|
88112a5324 | ||
|
095e1f5155 | ||
|
6a39250579 | ||
|
fac7a6fecf | ||
|
e6781d5488 | ||
|
a90ffffb1a | ||
|
18952c40f8 | ||
|
4b284f814c | ||
|
4fa691c4dd | ||
|
912b340d0d | ||
|
caed86fc6e | ||
|
e4a33ed4d0 | ||
|
cb362513f0 | ||
|
aa6e949b3d | ||
|
b674460748 | ||
|
a0d0de7233 | ||
|
129b0d6a4b | ||
|
08f7fded3c | ||
|
d0298ea2fb | ||
|
6a451a2b59 | ||
|
ae9b02b079 | ||
|
fe94032f74 | ||
|
d330a23ce1 | ||
|
d349f059af | ||
|
bbbd08edc1 | ||
|
1b1b85439e | ||
|
14fe9010ae | ||
|
9224405155 | ||
|
c05bd1789c | ||
|
16732fbfde | ||
|
9a9f8fa25b | ||
|
f73e734411 | ||
|
888dee3b5f | ||
|
bd8fe49076 | ||
|
dbabc35e71 | ||
|
15f5d8e794 | ||
|
5586445207 | ||
|
9182a35f18 | ||
|
e1586898b2 | ||
|
97ee88975a | ||
|
f00a4c8078 | ||
|
a9de85d31d | ||
|
608cd54a68 | ||
|
430cc4f42a | ||
|
8bcb643a03 | ||
|
2aad4a5f97 | ||
|
b57b0c6e40 | ||
|
1c3bd436cc | ||
|
5ecb369dac | ||
|
71d16f69ff | ||
|
0693fbfc00 | ||
|
7a81cd16c5 | ||
|
ebbcf6fe12 | ||
|
3cf0e513e6 | ||
|
925b252927 | ||
|
1476bf909e | ||
|
f1d2f16b54 | ||
|
447c9b428f | ||
|
ca1c3f1926 | ||
|
43c5469f81 | ||
|
efbb895ebe | ||
|
03d79983ee | ||
|
17f403fbcd | ||
|
780cb692d6 | ||
|
42032fdecf | ||
|
a06c3ad2c0 | ||
|
09fe4a2ae9 | ||
|
021904e4e6 | ||
|
ec0ae5d50c | ||
|
7d8f9d1c46 | ||
|
8746fb3385 | ||
|
79ec33fd60 | ||
|
1ccdf19fae | ||
|
be5738243c | ||
|
08aae4952b | ||
|
f0efb615c5 | ||
|
608bbedee1 | ||
|
0475e7351f | ||
|
bdcc1a23e0 | ||
|
8a98a25d8e | ||
|
c99e7e1a62 | ||
|
3803f257fb | ||
|
1e3548b7e7 | ||
|
64214a9426 | ||
|
e2b2fd6e78 | ||
|
ccc15b9e1a | ||
|
74cde12677 | ||
|
f5476bdbb1 | ||
|
656efdc1c7 | ||
|
dbcd452758 | ||
|
05f0c4bbf5 | ||
|
5463640fe6 | ||
|
4e716fb0fa | ||
|
d87596aec4 | ||
|
1d65291342 | ||
|
d4fcba6796 | ||
|
374f1ba41f | ||
|
60db7ed5ac | ||
|
c1c4609e4e | ||
|
626bcf0547 | ||
|
aaf9adfbe8 | ||
|
b40496533b | ||
|
d2b2881306 | ||
|
5d40db629c | ||
|
af9998b8a7 | ||
|
7ed00b6e8d | ||
|
288226e13c | ||
|
fa41ddd3eb | ||
|
848293671b | ||
|
2215840363 | ||
|
0376029241 | ||
|
7b64b2ddab | ||
|
d76d67de23 | ||
|
0afab87631 | ||
|
c1d5983d3e | ||
|
d2165a5890 | ||
|
28a5bc313a | ||
|
6bdfadf4a9 | ||
|
ef13bbaf7d | ||
|
341b3a0349 | ||
|
2f7dc28b22 | ||
|
f3bf409082 | ||
|
0380ce269f | ||
|
cfdc62e7fa | ||
|
9cb08a3cf5 | ||
|
19bc2b10ae | ||
|
db6777d369 | ||
|
d21d5fd736 | ||
|
22f7aa6e9c | ||
|
e83c8afc56 | ||
|
c2eef171ff | ||
|
4b286f282a | ||
|
cf80e19157 | ||
|
a201977590 | ||
|
8947b711aa | ||
|
c0f99e8229 | ||
|
9084bdd863 | ||
|
136e6beb0f | ||
|
50918084bb | ||
|
e4134debd1 | ||
|
32faec00e6 | ||
|
d4e38cf129 | ||
|
522f194983 | ||
|
a5ac4c64fc | ||
|
ab462fb95f | ||
|
a30797425f | ||
|
5bd22a2f4a | ||
|
35548a9d4e | ||
|
95574a3640 | ||
|
831ff41754 | ||
|
bf24099114 | ||
|
80f900ebae | ||
|
19b3c45ca7 | ||
|
cd1821a7e2 | ||
|
e8e56da9ac | ||
|
ddb0287bf6 | ||
|
c4a3d5148d | ||
|
fc4f7e82f9 | ||
|
8894f856de | ||
|
f552b0a207 | ||
|
d7af8f96d7 | ||
|
946f3078d3 | ||
|
d4a7040c7f | ||
|
9ad3a07989 | ||
|
44827698e2 | ||
|
f1412142e0 | ||
|
c0ea3963be | ||
|
0602a44b27 | ||
|
817710dd47 | ||
|
12e71e5706 | ||
|
76057105ca | ||
|
f1ab906c51 | ||
|
8de8e11487 | ||
|
832477b1bc | ||
|
490d3771f7 | ||
|
d077fd084a | ||
|
0e6b9ea786 | ||
|
4f3880ff15 | ||
|
d181113b82 | ||
|
ec3a696e2d | ||
|
1f7837d6d6 | ||
|
29c6f32a3b | ||
|
83b6d03231 | ||
|
d6748284bd | ||
|
01d957677f | ||
|
fd941db246 | ||
|
fe5ff8e4b2 | ||
|
70ae6d197b | ||
|
ffde33bdfa | ||
|
5f234ce2a5 | ||
|
c5f8b96dda | ||
|
04fdeb9d8d | ||
|
d4b752def9 | ||
|
c2c27891c9 | ||
|
b8f70a27a5 | ||
|
6076c95dd1 | ||
|
dbe6d2ff8e | ||
|
252adc912d | ||
|
be48b32e63 | ||
|
847527fd6d | ||
|
669dad71f8 | ||
|
140967f002 | ||
|
4c12e2a4b9 | ||
|
7fd14bf7bd | ||
|
46320f9630 | ||
|
0642cb330c | ||
|
134f3e6e09 | ||
|
43c94d0a6c | ||
|
a31f64d639 | ||
|
9d2b830275 | ||
|
837d346090 | ||
|
be55460b63 | ||
|
9c645b54dc | ||
|
cf47532ebc | ||
|
4cfde304df | ||
|
7a9a5c8a69 | ||
|
3a91ac51a9 | ||
|
d67b278a0d | ||
|
23aba523b5 | ||
|
7eb8daffa3 | ||
|
55ae78208e | ||
|
1ec6b1a258 | ||
|
dc8248f8a4 | ||
|
5cc275b1de | ||
|
091f063706 | ||
|
05157808de | ||
|
9b4f6c1c32 | ||
|
076f940f1f | ||
|
d76f34ef51 | ||
|
3f67676059 | ||
|
8a0be5e9f0 | ||
|
442145dbd3 | ||
|
a36a8f4d72 | ||
|
42835c7f82 | ||
|
cf0f451c37 | ||
|
3576e1ee73 | ||
|
55f2059f71 | ||
|
284c0160c3 | ||
|
2f13d31ff0 | ||
|
b6dd6210ea | ||
|
40f4377717 | ||
|
a6751cec04 | ||
|
1da7dd3da9 | ||
|
13973348df | ||
|
e6b4448ba3 | ||
|
e4031b822a | ||
|
c5887b0f28 | ||
|
a195c3fabe | ||
|
181c8d9c99 | ||
|
d2329e1c26 | ||
|
23a7527e04 | ||
|
45a324b437 | ||
|
02a881aa32 | ||
|
ed096186a7 | ||
|
5fbab97373 | ||
|
78544f827b | ||
|
b13232f524 | ||
|
ceae143e78 | ||
|
94130da63a | ||
|
71d35dae8c | ||
|
76969a5671 | ||
|
7ab4ddad1c | ||
|
438e1a7d46 | ||
|
e388db311b | ||
|
f35b20b042 | ||
|
027591a3a5 | ||
|
e86d935175 | ||
|
bf647ce143 | ||
|
17c5e12e6e | ||
|
c73b7a65f5 | ||
|
e921dcf503 | ||
|
7c3dc51655 | ||
|
5fd19a45b7 | ||
|
f82ea42679 | ||
|
5972aa9af3 | ||
|
8a421b1fd7 | ||
|
49fa03bf42 | ||
|
d0960b8035 | ||
|
d4035d1cb1 | ||
|
a90a215662 | ||
|
de81f68d4d | ||
|
b6da658553 | ||
|
3898625ff1 | ||
|
3e0525b47d | ||
|
68bdaf0a6b | ||
|
400b6fd61c | ||
|
e2de16065a | ||
|
bf6f61cc69 | ||
|
73d05a51e3 | ||
|
d7d094bd8a | ||
|
2db0ffe69e | ||
|
ea8c8cdaf3 | ||
|
79ab69fe30 | ||
|
081485ecfd | ||
|
10644d6dd7 | ||
|
0a02fb3c4f | ||
|
2eb15f4a61 | ||
|
77ab60df83 | ||
|
f94869d2d1 | ||
|
d078aa30d6 | ||
|
7765593018 | ||
|
78535fb08e | ||
|
cc31a21192 | ||
|
aa591317e7 | ||
|
5348e8b71a | ||
|
27d30f1a61 | ||
|
31c717f579 | ||
|
abf3fbf0b1 | ||
|
bb76285762 | ||
|
a2412492da | ||
|
bb5a6b7a07 | ||
|
25663b5816 | ||
|
4faf097fb9 | ||
|
e08421017c | ||
|
d1b5498cc0 | ||
|
067ae5d96e | ||
|
abdc47e482 | ||
|
e7c3be5f2f | ||
|
da1b6164fe | ||
|
691fbdf1d3 | ||
|
2831267db1 | ||
|
0934d1b1ea | ||
|
a6832c234d | ||
|
8c2381103a | ||
|
2a80e5a81e | ||
|
634ac9c5af | ||
|
8555e888d8 | ||
|
8093b3372e | ||
|
75f0b0c51c | ||
|
833f8b94c2 | ||
|
8bc431952f | ||
|
521d429b58 | ||
|
3461003a0f | ||
|
2009f4cbda | ||
|
bcee9b76dd | ||
|
fda4476061 | ||
|
44d4863ecf | ||
|
af63684862 | ||
|
8b87be63c5 | ||
|
907b6f943c | ||
|
a8048c19f3 | ||
|
74ed6dc3ad | ||
|
991a4d64f3 | ||
|
1257d43e14 | ||
|
f9a3aa8737 | ||
|
f8c2903484 | ||
|
369972b116 | ||
|
7e401b9e39 | ||
|
1610b9f547 | ||
|
74bbec3bf9 | ||
|
fcf02e4961 | ||
|
3c4d5e1ed5 | ||
|
d2bb8ef503 | ||
|
d0ad7921f8 | ||
|
8c2c7b802f | ||
|
d1006150fb | ||
|
6dd096b7f0 | ||
|
64375d875b | ||
|
dce03c19cb | ||
|
302fa42980 | ||
|
88f45ce38c | ||
|
769f77900a | ||
|
240d0e84f0 | ||
|
a6f5efa0bb | ||
|
4a1f36c3cc | ||
|
27fcf8d30a | ||
|
87ad4961f6 | ||
|
64b167138f | ||
|
69b86378ce | ||
|
e698654902 | ||
|
b7eae783b5 | ||
|
327b1b7985 | ||
|
769e0a3ea6 | ||
|
cbf2a967c5 | ||
|
0af9a24087 | ||
|
63f0bb1761 | ||
|
e5620f07a4 | ||
|
742f2c0301 | ||
|
ecfa284662 | ||
|
7209917fd7 | ||
|
b316b2e740 | ||
|
f91b8c5f53 | ||
|
97170916a3 | ||
|
9f575986d8 | ||
|
19570f2d43 | ||
|
973282dae2 | ||
|
862948ab88 | ||
|
4b23e6a694 | ||
|
f4feeecc3a | ||
|
8fa88e584a | ||
|
56614b2cbe | ||
|
51d578ff33 | ||
|
6072b03291 | ||
|
8422ab542c | ||
|
03b45284e1 | ||
|
f2931468ec | ||
|
84b7d29d34 | ||
|
72bfabfada | ||
|
1a7fc53c98 | ||
|
61306fa737 | ||
|
79d527195d | ||
|
9d1bc9aac8 | ||
|
2d17d6bc16 | ||
|
6efa80a471 | ||
|
eb9ce39bb7 | ||
|
a5e07da8be | ||
|
c5f0d4b1a0 | ||
|
bdad3b259a | ||
|
1207bda94b | ||
|
dc3ff9f2ab | ||
|
467202d0a6 | ||
|
b354cf362e | ||
|
09dabe2ff2 | ||
|
980dd0bf51 | ||
|
70900bd167 | ||
|
51021585a7 | ||
|
4b0974ec10 | ||
|
7be02d9020 | ||
|
3c7116382f | ||
|
545ba2e2e6 | ||
|
f59672a18d | ||
|
341a3b571b | ||
|
727675dd46 | ||
|
05837a8d0f | ||
|
0c301f7b5c | ||
|
b7e1bccc50 | ||
|
aea1b2b02e | ||
|
787fda53ef | ||
|
a09a3dcabb | ||
|
dc50c78f48 | ||
|
1f07792881 | ||
|
96c201273e | ||
|
9ccc3698d5 | ||
|
6e5fffbd3f | ||
|
de8b73dd92 | ||
|
bf85c82087 | ||
|
c0904f1942 | ||
|
b75450ad36 | ||
|
527c2dd665 | ||
|
fa60cf0ea4 | ||
|
cb18941e63 | ||
|
6510e57758 | ||
|
6069abe5fd | ||
|
d0490c187c | ||
|
aae960b31f | ||
|
42904cb98a | ||
|
37eec6c9b7 | ||
|
937b4b5aa1 | ||
|
b992858883 | ||
|
2d1a1fce93 | ||
|
6f4ba6884c | ||
|
ac51caa517 | ||
|
799d0c2030 | ||
|
22e1bd31c6 | ||
|
35d9378e4e | ||
|
c22f9114c7 | ||
|
331316894e | ||
|
f686a32eac | ||
|
c463b1b8cb | ||
|
9fae9f0dc2 | ||
|
8f1c311b90 | ||
|
edfa76d3f5 | ||
|
a0f5471e21 | ||
|
ba85f68ea8 | ||
|
7802699f52 | ||
|
ba134bd27a | ||
|
59f736d54c | ||
|
98b0688921 | ||
|
6388761129 | ||
|
71dee6b7c0 | ||
|
71634452e1 | ||
|
2342df183b | ||
|
2e7ccecfe6 | ||
|
4b7594d9fa | ||
|
d4924d45d6 | ||
|
8de8ec027d | ||
|
9847b38518 | ||
|
fa3abc22c0 | ||
|
c1e92eeb72 | ||
|
a345a03d99 | ||
|
f27d87d93b | ||
|
d0932ef147 | ||
|
8a4161c723 | ||
|
25b5ffb6af | ||
|
f2ff0ee846 |
111
.drone.yml
111
.drone.yml
@@ -2,78 +2,100 @@ workspace:
|
||||
base: /srv/app
|
||||
path: src/code.gitea.io/gitea
|
||||
|
||||
clone:
|
||||
git:
|
||||
image: plugins/git:1
|
||||
depth: 50
|
||||
tags: true
|
||||
|
||||
pipeline:
|
||||
test:
|
||||
build:
|
||||
image: webhippie/golang:edge
|
||||
pull: true
|
||||
environment:
|
||||
CGO_ENABLED: 1
|
||||
TAGS: sqlite bindata
|
||||
TAGS: bindata sqlite
|
||||
GOPATH: /srv/app
|
||||
commands:
|
||||
- apk -U add openssh-client
|
||||
- make clean
|
||||
- make generate
|
||||
- make vet
|
||||
- make lint
|
||||
- make test
|
||||
- make stylesheets-check
|
||||
- make misspell-check
|
||||
- make test-vendor
|
||||
- make build
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
test:
|
||||
image: webhippie/golang:edge
|
||||
pull: true
|
||||
environment:
|
||||
TAGS: bindata sqlite
|
||||
GOPATH: /srv/app
|
||||
commands:
|
||||
- make test
|
||||
when:
|
||||
event: [ tag, pull_request ]
|
||||
|
||||
# Commented until db locking have been resolved!
|
||||
# test-sqlite:
|
||||
# image: webhippie/golang:edge
|
||||
# pull: true
|
||||
# environment:
|
||||
# TAGS: bindata
|
||||
# GOPATH: /srv/app
|
||||
# commands:
|
||||
# - make test-sqlite
|
||||
# when:
|
||||
# event: [ push, tag, pull_request ]
|
||||
|
||||
test-mysql:
|
||||
image: webhippie/golang:edge
|
||||
pull: true
|
||||
environment:
|
||||
CGO_ENABLED: 1
|
||||
TAGS: sqlite bindata
|
||||
TAGS: bindata
|
||||
GOPATH: /srv/app
|
||||
commands:
|
||||
- make test-mysql
|
||||
when:
|
||||
event: [ push ]
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
test-pgsql:
|
||||
image: webhippie/golang:edge
|
||||
pull: true
|
||||
environment:
|
||||
CGO_ENABLED: 1
|
||||
TAGS: sqlite bindata
|
||||
TAGS: bindata
|
||||
GOPATH: /srv/app
|
||||
commands:
|
||||
- make test-pgsql
|
||||
when:
|
||||
event: [ push ]
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
updater:
|
||||
static:
|
||||
image: karalabe/xgo-latest:latest
|
||||
pull: true
|
||||
environment:
|
||||
CGO_ENABLED: 1
|
||||
TAGS: sqlite bindata
|
||||
TAGS: bindata sqlite
|
||||
GOPATH: /srv/app
|
||||
commands:
|
||||
- make release
|
||||
when:
|
||||
event: [ push, tag ]
|
||||
branch: [ master, release/*, refs/tags/* ]
|
||||
|
||||
coverage:
|
||||
image: plugins/coverage
|
||||
server: https://coverage.gitea.io
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
docker:
|
||||
image: plugins/docker
|
||||
image: plugins/docker:17.05
|
||||
pull: true
|
||||
secrets: [ docker_username, docker_password ]
|
||||
repo: gitea/gitea
|
||||
tags: [ '${DRONE_TAG##v}' ]
|
||||
when:
|
||||
event: [ tag ]
|
||||
branch: [ refs/tags/* ]
|
||||
|
||||
docker:
|
||||
image: plugins/docker
|
||||
image: plugins/docker:17.05
|
||||
pull: true
|
||||
secrets: [ docker_username, docker_password ]
|
||||
repo: gitea/gitea
|
||||
tags: [ '${DRONE_BRANCH##release/v}' ]
|
||||
when:
|
||||
@@ -81,7 +103,9 @@ pipeline:
|
||||
branch: [ release/* ]
|
||||
|
||||
docker:
|
||||
image: plugins/docker
|
||||
image: plugins/docker:17.05
|
||||
pull: true
|
||||
secrets: [ docker_username, docker_password ]
|
||||
repo: gitea/gitea
|
||||
tags: [ 'latest' ]
|
||||
when:
|
||||
@@ -89,17 +113,24 @@ pipeline:
|
||||
branch: [ master ]
|
||||
|
||||
release:
|
||||
image: plugins/s3
|
||||
image: plugins/s3:1
|
||||
pull: true
|
||||
secrets: [ aws_access_key_id, aws_secret_access_key ]
|
||||
bucket: releases
|
||||
endpoint: https://storage.gitea.io
|
||||
path_style: true
|
||||
strip_prefix: dist/release/
|
||||
source: dist/release/*
|
||||
target: /gitea/${DRONE_TAG##v}
|
||||
when:
|
||||
event: [ tag ]
|
||||
branch: [ refs/tags/* ]
|
||||
|
||||
release:
|
||||
image: plugins/s3
|
||||
image: plugins/s3:1
|
||||
pull: true
|
||||
secrets: [ aws_access_key_id, aws_secret_access_key ]
|
||||
bucket: releases
|
||||
endpoint: https://storage.gitea.io
|
||||
path_style: true
|
||||
strip_prefix: dist/release/
|
||||
source: dist/release/*
|
||||
@@ -109,7 +140,11 @@ pipeline:
|
||||
branch: [ release/* ]
|
||||
|
||||
release:
|
||||
image: plugins/s3
|
||||
image: plugins/s3:1
|
||||
pull: true
|
||||
secrets: [ aws_access_key_id, aws_secret_access_key ]
|
||||
bucket: releases
|
||||
endpoint: https://storage.gitea.io
|
||||
path_style: true
|
||||
strip_prefix: dist/release/
|
||||
source: dist/release/*
|
||||
@@ -119,15 +154,21 @@ pipeline:
|
||||
branch: [ master ]
|
||||
|
||||
github:
|
||||
image: plugins/github-release
|
||||
image: plugins/github-release:1
|
||||
pull: true
|
||||
secrets: [ github_token ]
|
||||
files:
|
||||
- dist/release/*
|
||||
when:
|
||||
event: [ tag ]
|
||||
branch: [ refs/tags/* ]
|
||||
|
||||
gitter:
|
||||
image: plugins/gitter
|
||||
discord:
|
||||
image: appleboy/drone-discord:1.0.0
|
||||
pull: true
|
||||
secrets: [ discord_webhook_id, discord_webhook_token ]
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
status: [ changed, failure ]
|
||||
|
||||
services:
|
||||
mysql:
|
||||
@@ -136,11 +177,11 @@ services:
|
||||
- MYSQL_DATABASE=test
|
||||
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
||||
when:
|
||||
event: [ push ]
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
pgsql:
|
||||
image: postgres:9.5
|
||||
environment:
|
||||
- POSTGRES_DB=test
|
||||
when:
|
||||
event: [ push ]
|
||||
event: [ push, tag, pull_request ]
|
||||
|
@@ -1 +0,0 @@
|
||||
eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIGJhc2U6IC9zcnYvYXBwCiAgcGF0aDogc3JjL2NvZGUuZ2l0ZWEuaW8vZ2l0ZWEKCnBpcGVsaW5lOgogIHRlc3Q6CiAgICBpbWFnZTogd2ViaGlwcGllL2dvbGFuZzplZGdlCiAgICBwdWxsOiB0cnVlCiAgICBlbnZpcm9ubWVudDoKICAgICAgQ0dPX0VOQUJMRUQ6IDEKICAgICAgVEFHUzogc3FsaXRlIGJpbmRhdGEKICAgICAgR09QQVRIOiAvc3J2L2FwcAogICAgY29tbWFuZHM6CiAgICAgIC0gYXBrIC1VIGFkZCBvcGVuc3NoLWNsaWVudAogICAgICAtIG1ha2UgY2xlYW4KICAgICAgLSBtYWtlIGdlbmVyYXRlCiAgICAgIC0gbWFrZSB2ZXQKICAgICAgLSBtYWtlIGxpbnQKICAgICAgLSBtYWtlIHRlc3QKICAgICAgLSBtYWtlIGJ1aWxkCiAgICB3aGVuOgogICAgICBldmVudDogWyBwdXNoLCB0YWcsIHB1bGxfcmVxdWVzdCBdCgogIHRlc3QtbXlzcWw6CiAgICBpbWFnZTogd2ViaGlwcGllL2dvbGFuZzplZGdlCiAgICBwdWxsOiB0cnVlCiAgICBlbnZpcm9ubWVudDoKICAgICAgQ0dPX0VOQUJMRUQ6IDEKICAgICAgVEFHUzogc3FsaXRlIGJpbmRhdGEKICAgICAgR09QQVRIOiAvc3J2L2FwcAogICAgY29tbWFuZHM6CiAgICAgIC0gbWFrZSB0ZXN0LW15c3FsCiAgICB3aGVuOgogICAgICBldmVudDogWyBwdXNoIF0KCiAgdGVzdC1wZ3NxbDoKICAgIGltYWdlOiB3ZWJoaXBwaWUvZ29sYW5nOmVkZ2UKICAgIHB1bGw6IHRydWUKICAgIGVudmlyb25tZW50OgogICAgICBDR09fRU5BQkxFRDogMQogICAgICBUQUdTOiBzcWxpdGUgYmluZGF0YQogICAgICBHT1BBVEg6IC9zcnYvYXBwCiAgICBjb21tYW5kczoKICAgICAgLSBtYWtlIHRlc3QtcGdzcWwKICAgIHdoZW46CiAgICAgIGV2ZW50OiBbIHB1c2ggXQoKICB1cGRhdGVyOgogICAgaW1hZ2U6IGthcmFsYWJlL3hnby1sYXRlc3Q6bGF0ZXN0CiAgICBwdWxsOiB0cnVlCiAgICBlbnZpcm9ubWVudDoKICAgICAgQ0dPX0VOQUJMRUQ6IDEKICAgICAgVEFHUzogc3FsaXRlIGJpbmRhdGEKICAgICAgR09QQVRIOiAvc3J2L2FwcAogICAgY29tbWFuZHM6CiAgICAgIC0gbWFrZSByZWxlYXNlCiAgICB3aGVuOgogICAgICBldmVudDogWyBwdXNoLCB0YWcgXQogICAgICBicmFuY2g6IFsgbWFzdGVyLCByZWxlYXNlLyosIHJlZnMvdGFncy8qIF0KCiAgY292ZXJhZ2U6CiAgICBpbWFnZTogcGx1Z2lucy9jb3ZlcmFnZQogICAgc2VydmVyOiBodHRwczovL2NvdmVyYWdlLmdpdGVhLmlvCiAgICB3aGVuOgogICAgICBldmVudDogWyBwdXNoLCB0YWcsIHB1bGxfcmVxdWVzdCBdCgogIGRvY2tlcjoKICAgIGltYWdlOiBwbHVnaW5zL2RvY2tlcgogICAgcmVwbzogZ2l0ZWEvZ2l0ZWEKICAgIHRhZ3M6IFsgJyR7RFJPTkVfVEFHIyN2fScgXQogICAgd2hlbjoKICAgICAgZXZlbnQ6IFsgdGFnIF0KICAgICAgYnJhbmNoOiBbIHJlZnMvdGFncy8qIF0KCiAgZG9ja2VyOgogICAgaW1hZ2U6IHBsdWdpbnMvZG9ja2VyCiAgICByZXBvOiBnaXRlYS9naXRlYQogICAgdGFnczogWyAnJHtEUk9ORV9CUkFOQ0gjI3JlbGVhc2Uvdn0nIF0KICAgIHdoZW46CiAgICAgIGV2ZW50OiBbIHB1c2ggXQogICAgICBicmFuY2g6IFsgcmVsZWFzZS8qIF0KCiAgZG9ja2VyOgogICAgaW1hZ2U6IHBsdWdpbnMvZG9ja2VyCiAgICByZXBvOiBnaXRlYS9naXRlYQogICAgdGFnczogWyAnbGF0ZXN0JyBdCiAgICB3aGVuOgogICAgICBldmVudDogWyBwdXNoIF0KICAgICAgYnJhbmNoOiBbIG1hc3RlciBdCgogIHJlbGVhc2U6CiAgICBpbWFnZTogcGx1Z2lucy9zMwogICAgcGF0aF9zdHlsZTogdHJ1ZQogICAgc3RyaXBfcHJlZml4OiBkaXN0L3JlbGVhc2UvCiAgICBzb3VyY2U6IGRpc3QvcmVsZWFzZS8qCiAgICB0YXJnZXQ6IC9naXRlYS8ke0RST05FX1RBRyMjdn0KICAgIHdoZW46CiAgICAgIGV2ZW50OiBbIHRhZyBdCiAgICAgIGJyYW5jaDogWyByZWZzL3RhZ3MvKiBdCgogIHJlbGVhc2U6CiAgICBpbWFnZTogcGx1Z2lucy9zMwogICAgcGF0aF9zdHlsZTogdHJ1ZQogICAgc3RyaXBfcHJlZml4OiBkaXN0L3JlbGVhc2UvCiAgICBzb3VyY2U6IGRpc3QvcmVsZWFzZS8qCiAgICB0YXJnZXQ6IC9naXRlYS8ke0RST05FX0JSQU5DSCMjcmVsZWFzZS92fQogICAgd2hlbjoKICAgICAgZXZlbnQ6IFsgcHVzaCBdCiAgICAgIGJyYW5jaDogWyByZWxlYXNlLyogXQoKICByZWxlYXNlOgogICAgaW1hZ2U6IHBsdWdpbnMvczMKICAgIHBhdGhfc3R5bGU6IHRydWUKICAgIHN0cmlwX3ByZWZpeDogZGlzdC9yZWxlYXNlLwogICAgc291cmNlOiBkaXN0L3JlbGVhc2UvKgogICAgdGFyZ2V0OiAvZ2l0ZWEvbWFzdGVyCiAgICB3aGVuOgogICAgICBldmVudDogWyBwdXNoIF0KICAgICAgYnJhbmNoOiBbIG1hc3RlciBdCgogIGdpdGh1YjoKICAgIGltYWdlOiBwbHVnaW5zL2dpdGh1Yi1yZWxlYXNlCiAgICBmaWxlczoKICAgICAgLSBkaXN0L3JlbGVhc2UvKgogICAgd2hlbjoKICAgICAgZXZlbnQ6IFsgdGFnIF0KICAgICAgYnJhbmNoOiBbIHJlZnMvdGFncy8qIF0KCiAgZ2l0dGVyOgogICAgaW1hZ2U6IHBsdWdpbnMvZ2l0dGVyCgpzZXJ2aWNlczoKICBteXNxbDoKICAgIGltYWdlOiBteXNxbDo1LjcKICAgIGVudmlyb25tZW50OgogICAgICAtIE1ZU1FMX0RBVEFCQVNFPXRlc3QKICAgICAgLSBNWVNRTF9BTExPV19FTVBUWV9QQVNTV09SRD15ZXMKICAgIHdoZW46CiAgICAgIGV2ZW50OiBbIHB1c2ggXQoKICBwZ3NxbDoKICAgIGltYWdlOiBwb3N0Z3Jlczo5LjUKICAgIGVudmlyb25tZW50OgogICAgICAtIFBPU1RHUkVTX0RCPXRlc3QKICAgIHdoZW46CiAgICAgIGV2ZW50OiBbIHB1c2ggXQo._4feZQfrP_lA1JxSLtj7CDpAN-uB4n4nJKR1R2UcxHg
|
@@ -15,10 +15,14 @@ indent_size = 8
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.{less,yml}]
|
||||
[*.{less}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.js]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
6
.gitattributes
vendored
Normal file
6
.gitattributes
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
conf/* linguist-vendored
|
||||
docker/* linguist-vendored
|
||||
options/* linguist-vendored
|
||||
public/* linguist-vendored
|
||||
scripts/* linguist-vendored
|
||||
templates/* linguist-vendored
|
20
.github/issue_template.md
vendored
20
.github/issue_template.md
vendored
@@ -1,9 +1,11 @@
|
||||
1. Please speak English, this is the language everybody of us can speak and write.
|
||||
2. Please ask questions or config/deploy problems on our Gitter channel: https://gitter.im/go-gitea/gitea
|
||||
3. Please take a moment to search that an issue doesn't already exist.
|
||||
4. Please give all relevant information below for bug reports, incomplete details will be handled as an invalid report.
|
||||
|
||||
**You MUST delete the content above including this line before posting, otherwise your pull request will be invalid.**
|
||||
<!--
|
||||
1. Please speak English, this is the language all of us can speak and write.
|
||||
2. Please ask questions or configuration/deploy problems on our Discord
|
||||
server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io).
|
||||
3. Please take a moment to check that your issue doesn't already exist.
|
||||
4. Please give all relevant information below for bug reports, because
|
||||
incomplete details will be handled as an invalid report.
|
||||
-->
|
||||
|
||||
- Gitea version (or commit ref):
|
||||
- Git version:
|
||||
@@ -11,6 +13,7 @@
|
||||
- Database (use `[x]`):
|
||||
- [ ] PostgreSQL
|
||||
- [ ] MySQL
|
||||
- [ ] MSSQL
|
||||
- [ ] SQLite
|
||||
- Can you reproduce the bug at https://try.gitea.io:
|
||||
- [ ] Yes (provide example URL)
|
||||
@@ -21,3 +24,8 @@
|
||||
## Description
|
||||
|
||||
...
|
||||
|
||||
|
||||
## Screenshots
|
||||
|
||||
<!-- **If this issue involves the Web Interface, please include a screenshot** -->
|
||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -26,7 +26,7 @@ _testmain.go
|
||||
*.test
|
||||
*.prof
|
||||
|
||||
coverage.out
|
||||
*coverage.out
|
||||
|
||||
/modules/options/bindata.go
|
||||
/modules/public/bindata.go
|
||||
@@ -36,10 +36,13 @@ coverage.out
|
||||
*.log
|
||||
|
||||
/gitea
|
||||
/integrations.test
|
||||
|
||||
/bin
|
||||
/dist
|
||||
/custom
|
||||
/data
|
||||
/indexers
|
||||
/log
|
||||
/public/img/avatar
|
||||
/integrations/gitea-integration
|
||||
|
643
CHANGELOG.md
643
CHANGELOG.md
@@ -1,4 +1,647 @@
|
||||
# Changelog
|
||||
## [1.2.2](https://github.com/go-gitea/gitea/releases/tag/v1.2.2) - 2017-10-26
|
||||
* BUGFIXES
|
||||
* Add checks for commits with missing author and time (#2771) (#2785)
|
||||
* Fix sending mail with a non-latin display name (#2559) (#2783)
|
||||
* Sync MaxGitDiffLineCharacters with conf/app.ini (#2779) (#2780)
|
||||
* Update vendor git (#2765) (#2772)
|
||||
* Fix emojify image URL (#2769) (#2773)
|
||||
|
||||
## [1.2.1](https://github.com/go-gitea/gitea/releases/tag/v1.2.1) - 2017-10-16
|
||||
* BUGFIXES
|
||||
* Fix PR, milestone and label functionality if issue unit is disabled (#2710) (#2714)
|
||||
* Fix plain readme didn't render correctly on repo home page (#2705) (#2712)
|
||||
* Fix so that user can still fork his own repository to his organizations (#2699) (#2707)
|
||||
* Fix .netrc authentication (#2700) (#2708)
|
||||
* Fix slice out of bounds error in mailer (#2479) (#2696)
|
||||
|
||||
## [1.2.0](https://github.com/go-gitea/gitea/releases/tag/v1.2.0) - 2017-10-10
|
||||
* SECURITY
|
||||
* Sanitation fix from Gogs (#1461)
|
||||
* BREAKING
|
||||
* Rename /forget_password url to /forgot_password (#1219)
|
||||
* FEATURE
|
||||
* Logo: Add task to generate images from SVG and change to new logo (#2194)
|
||||
* Status-API (#1332)
|
||||
* Show commit status icon in commits table (#1688)
|
||||
* Additional OAuth2 providers (#1010)
|
||||
* GPG commit validation (#1150)
|
||||
* Rework SSH key management UI to add GPG (#1293)
|
||||
* Implement GPG api (#710)
|
||||
* Login via OpenID-2.0 (#618)
|
||||
* Add units to team (#947)
|
||||
* Batch updates for issues (#926)
|
||||
* Add Gitea Webhook (#1755)
|
||||
* API: support '/orgs/:org/repos' (#2047)
|
||||
* Display all organization from user settings (#1739)
|
||||
* LDAP user synchronization (#1478)
|
||||
* Adding #issuecomment to the URL in E-Mail notifications (#1674)
|
||||
* Add download count field and unit testing for attachment. (#1512)
|
||||
* Add repo mirror sync API endpoint (#1508)
|
||||
* Add markup package to prepare for org markup format (#1493)
|
||||
* Support for custom html meta (#1423)
|
||||
* Per issue/PR watch/unwatch (#1410)
|
||||
* Allow ENABLE_OPENID_SIGNUP to depend on DISABLE_REGISTRATION (#1369)
|
||||
* Repo size in admin panel (#1482)
|
||||
* Show user OpenID URIs in their profile (#1314)
|
||||
* Add change-password admin command (#1304)
|
||||
* Only use issue and wiki on repo. (#1297)
|
||||
* Allow push to init a wiki repo (#1279)
|
||||
* ENHANCEMENT
|
||||
* Make time diff translatable (#2057)
|
||||
* Smaller watch, star, and fork buttons (#2052)
|
||||
* Display config file path on admin panel (#2030)
|
||||
* Only show SSH clone URL if signed in (#2169) (#2170)
|
||||
* Only show "No Description" to repo admins (#2167)
|
||||
* Always return valid go-get meta, even if unauthorized (#2010)
|
||||
* Enable assignee e-mail notification (#2003)
|
||||
* Let not-logged-in users view releases (#1999)
|
||||
* No highlighting for .txt files (#1922)
|
||||
* Make side nav on dashboard stackable (#1778)
|
||||
* Setting to disable authorized_keys backup (#1856)
|
||||
* Hide the create organization button (in dashboard/organization section) (#1705)
|
||||
* LFS: Return 404 for unimplemented endpoints (#1330)
|
||||
* Show a link to password reset from user settings requiring a password (#862)
|
||||
* Reserve the "explore" user/org name (#1222)
|
||||
* Send notifications to partecipants in issue comments (#1217)
|
||||
* Improve style of user OpenID setting page (#1324)
|
||||
* Use font-awesome OpenID icon more (#1320)
|
||||
* Use readonly input form to show the validated OpenID URI (#1308)
|
||||
* Add captcha support to OpenID based signup (#1307)
|
||||
* Minor improvements on commit graph UI (#1380)
|
||||
* Mirror sync interval specified as duration string (#1407)
|
||||
* Make issue in commit graph "clickable" (#1392)
|
||||
* Use whole button (commit graph) as link (#1390)
|
||||
* Autofocus on 2fa passcode fields (#1460)
|
||||
* Sort on repo size in admin panel (#1654)
|
||||
* Improve dashboard repo search (#1652)
|
||||
* Use a better default MAX_GIT_DIFF_LINE_CHARACTERS (#1845)
|
||||
* Adds Parent property to the repo API (#1687)
|
||||
* Add configuration option for default permission to create Organizations (#1686)
|
||||
* Remove sha1 hash display in repository table (#1678)
|
||||
* Download files to their original filename (#1676)
|
||||
* Exposes in API the Repo entity's Size and IsBare property (#1668)
|
||||
* Change two factor code entry box from text to number (#1733)
|
||||
* Directly show error if user hit repository limit (#1767)
|
||||
* Generate small and large logos at 4x resolution (#2233)
|
||||
* Tags listed in releases tab (#2389) (#2424)
|
||||
* BUGFIXES
|
||||
* Fix adding branch as protected to not allow pushing to it (#2556)
|
||||
* Orgs: fix org page title when full name is not defined (#1495)
|
||||
* Fix double borders on edit page (#1152) (#1153)
|
||||
* Search bar fixes for #1187 and #1205 (#1207)
|
||||
* Fix upgrade failed after ever rollback (#1194)
|
||||
* Fix FCGI (over TCP) support (#1368)
|
||||
* Backport of migration fixes (#2604) (#2677)
|
||||
* fix panic on gogs webhook creation (#2675) (#2676)
|
||||
* Backport: Fixes 500 error on dashboard when using MSSQL (#2504) (#2662)
|
||||
* Fix go get response if only app URL is custom in configuration (#2634) (#2640)
|
||||
* Fix deletion of unprotected branches (#2630)
|
||||
* Backport of 2611 / Fix doubled issue tab introduced in migration v16 (#2622)
|
||||
* v38 migration used an outdated version of RepoUnit model (#2602)
|
||||
* fix go get subpackage bug (#2584) (#2589)
|
||||
* Backport: Sync releases table with tags on push and for mirrors (#2459) (#2554)
|
||||
* Backport: Restricting access to fork functioanlity to users with Code access (#2542)
|
||||
* Fix migration from pre-v15 to 1.2.0 (#2460) (#2465)
|
||||
* Fix migration from pre-v15 to 1.2.0 (#2460)
|
||||
* fix duplicated feed (#2370) (#2413)
|
||||
* Fix releases to be counted from database not tags (#2389)
|
||||
* Fix missing collabrative repos (#2367) (#2382)
|
||||
* Add more test for login links and fix a bug on action retrieve (#2361)
|
||||
* Fix SQL condition bug in GetFeeds(..) (#2360)
|
||||
* fix bug on create repo link on dashboard (#2359)
|
||||
* Fix order of elements in dashboard html (#2344)
|
||||
* Fix repo-search template errors for go1.7 (#2336)
|
||||
* Add missing forks key for dashboard repository component (#2325)
|
||||
* fix template error on explore repos (#2319)
|
||||
* Trigger sync webhooks on UI commit (#2302)
|
||||
* fix 500 error when view an issue which's milestone deleted (#2297)
|
||||
* Only update needed columns when update user (#2296)
|
||||
* Fix rendering of external links (#2292)
|
||||
* Fix and improve dashboard repo UI (#2285)
|
||||
* Make short link pattern greedy (#2259)
|
||||
* Temporarily patch go-ini/ini with fork (#2255)
|
||||
* Convert xorm literal queries to method calls (#2253)
|
||||
* update code.gitea.io/git in vendor to fix delete branch fails (#2250)
|
||||
* Replace calls to xorm UseBool with Where (#2237)
|
||||
* rhel7 has a git version with four digits (1.8.3.1) (#2236)
|
||||
* Fix internal requests when gitea listens to unix socket or only external IP (#2234)
|
||||
* Check for access in /repositories/:id (#2227)
|
||||
* Fixed robots.txt 404 error (#2226)
|
||||
* Fix counts on issues dashboard (#2215)
|
||||
* Fix unclosed session bug (#2214)
|
||||
* Add collaborative repositories to the dashboard (#2205)
|
||||
* Fix issue updated_unix bug (#2204)
|
||||
* Fix Commits nil pointer dereference (#2203)
|
||||
* Fix bare-repo bugs (#2199)
|
||||
* Fix PR nil-dereference bug (#2195)
|
||||
* Allow only single fork per user/organization (#2193)
|
||||
* Fix key usage time update if the key is used in parallel for multiple operations (#2185)
|
||||
* Only allow token authentication with 2FA enabled (#2184)
|
||||
* Fix profile update for non-local users (#2178)
|
||||
* Fix compiling without sqlite and gcc (#2177)
|
||||
* Make compare button URL aware if current repo is a fork (#2162) (#2163)
|
||||
* Remove unit types commits and settings (#2161)
|
||||
* Fix OpenID registration route (#2160)
|
||||
* Fix repository settings collobration list display (#2151)
|
||||
* Ignore invalid issue numbers in commit messages. Fixes #2022 (#2150)
|
||||
* Fix SHA1 hash linking (#2143)
|
||||
* Fix repo API bug (#2133)
|
||||
* Use POSIX complaint ! operator in find (#2132)
|
||||
* Fix GET /users/:username/repos endpoint (#2125)
|
||||
* Fix username rendering bug (#2122)
|
||||
* Fix wiki preview links (#2119)
|
||||
* vendor: update sqlite to fix "database is locked" errors (#2116)
|
||||
* Fix unchecked error bug (#2110)
|
||||
* Fix missing-return bug (#2109)
|
||||
* Fix API for branches with slashes (#2096)
|
||||
* Fix git hooks update to receive required arguments (#2095)
|
||||
* upgrade git source code. (#2094)
|
||||
* Fix SQL bug in models.PullRequests (#2092)
|
||||
* Don't ignore gravatar error (#2083)
|
||||
* Fix release display and correct paging (#2080)
|
||||
* remove unnecessary blank lines and wrong error log (#2079)
|
||||
* Check for valid renamed usernames (#2077)
|
||||
* Update git module (#2074)
|
||||
* Fix org hooks UI (#2072)
|
||||
* Fix #1271: Call location.reload after XHR finishes (#2071)
|
||||
* Fix default ghost assignee bug (#2069)
|
||||
* Fix bug in issue labels API (#2048)
|
||||
* Load label ID in NewLabels (#2045)
|
||||
* Fix: `http: multiple response.WriteHeader calls` (#2038)
|
||||
* Pagination on releases page (#2035)
|
||||
* repo/editor: fix breadcrumb path cuts parent dirs (#3859) (#2032)
|
||||
* Fix displaying commits and files of PR created from now deleted fork (#2023)
|
||||
* Fix #2001 and fix issue comments hidden (#2016)
|
||||
* Update code.gitea.io/git (#2014)
|
||||
* Keep sort when switching page (#2013)
|
||||
* Important: wrong PR merge commit ID saved (#2007)
|
||||
* Don't show non-comments in comments API (#2001)
|
||||
* Fix "Dashboard shows deleted comments" (#1995)
|
||||
* Make branch deletion URL more like GitHub's, fixes #1397 (#1994)
|
||||
* Fix fast-forward PR bug (#1989)
|
||||
* Fix GPG email checking to be case insensitive (#1988)
|
||||
* fix bug for normal user visit public repo (#1984)
|
||||
* fix collborators lack of units on orgnization repositories (#1968)
|
||||
* Fix diff of renamed and modified file (#1967)
|
||||
* Fix uppercase default branch bug (#1965)
|
||||
* Fix bug in Action.loadRepo() (#1959)
|
||||
* Fix deleted milestone bug (#1942)
|
||||
* Fix engine bug in getIssueByID (#1934)
|
||||
* Switch to keybase go-crypto (for some elliptic curve key) + test (#1925)
|
||||
* Fix setting.AppPath for integration tests (#1923)
|
||||
* Fix search by issue type (#1914)
|
||||
* Fix ghost user bug (#1913)
|
||||
* Require token before checking membership/ownership (#1905)
|
||||
* Bug fixes for org member API (#1904)
|
||||
* A missing / to provide a correct endpoint (#1903)
|
||||
* Fix 500 in public activity page (#1901)
|
||||
* Center-aligned login topbar (#1880)
|
||||
* Migration to fix existing owner team units (#1873)
|
||||
* Fix paginater length (#1866)
|
||||
* Fix bug in removeOrgRepo (#1858)
|
||||
* Display draft releases (#1854)
|
||||
* Fix 404 for external tracking issues (#1852)
|
||||
* Update code.gitea.io/git (#1849)
|
||||
* Fix user profile activity feed (#1848)
|
||||
* Don't ignore error in getMergeCommit (#1843)
|
||||
* Fix locking bug in removeOrgRepo (#1842)
|
||||
* Fix status table race condition (#1835)
|
||||
* Fix PR template error (#1834)
|
||||
* Fix pull request compare link (#1832)
|
||||
* Use ghost users in issues/PRs (#1831)
|
||||
* Commitless repos should be bare (#1829)
|
||||
* Update code.gitea.io/git (#1824)
|
||||
* Fix invalid reference in feeds template (#1820)
|
||||
* fix bug to deny to add orgnization as a member of an orgnization or team (#1815)
|
||||
* xxx_active_code_live setting in printed in hours and minutes instead … (#1814)
|
||||
* Fix deadlock in updateRepository (#1813)
|
||||
* Give all units to owner team (#1812)
|
||||
* Fix 500 for GET /teams/:id endpoints (#1811)
|
||||
* fix bug not to trim space of login username (#1796)
|
||||
* Fix renaming bug (#1786)
|
||||
* Fix activity feed (#1779)
|
||||
* Make navbar scroll on overflow (#1777)
|
||||
* Delete repo redirects on repo deletion (#1776)
|
||||
* Fix unloaded owner bug (#1770)
|
||||
* Admin should always be allowed to create repositories even if hit limit (#1765)
|
||||
* Update HighlightJS and fix YAML files highlighting (#1764)
|
||||
* fix: #1757 fix set MAX_CREATION_LIMIT as zero. (#1762)
|
||||
* fix admin lost permission caused by #947 (#1753)
|
||||
* More fixes for dashboard search (#1750)
|
||||
* fixes wrong after field in webhook payload (#1746)
|
||||
* fix avatar update bug (#1729)
|
||||
* Fix FOUC on Firefox (#1728)
|
||||
* Fix changes introduce by update of go-swagger. (#1727)
|
||||
* Fix #1719 (#1722)
|
||||
* Correct flash after sending password reset email (#1718)
|
||||
* Fix and test for delete user (#1713)
|
||||
* Fix rendering of issue checkboxes (#1709)
|
||||
* Enforce netgo build tag while cross-compilation (#1690)
|
||||
* fix bug when push a branch name with / & fix an integration test bug (#1689)
|
||||
* fix potential sqlite lock (#1680)
|
||||
* Fix commit sha1 URL rendering in markdown (#1677)
|
||||
* Fix static files permission under public/ (#1675)
|
||||
* fix: tag contain character ) will http 500 on release page (#1670)
|
||||
* Fix CSS for code in wiki markdown (#1660)
|
||||
* fix multiple readme file rendering and fix #1657 (#1658)
|
||||
* Add primary key and index to external login user table (#1656)
|
||||
* fix #1643 and improve integration test (#1645)
|
||||
* Fix version in Makefile (#1636)
|
||||
* Handle display of GPG key without end date (#1628)
|
||||
* fix bug on issue view when not login (#1624)
|
||||
* bug fixed for API to get user's repos (#1622)
|
||||
* fix lost text color on button on set as primary email (#1621)
|
||||
* Add create_at and updated_at in PR json (#1616)
|
||||
* update git and fix #1133 (#1614)
|
||||
* fix bug on status API (#1533)
|
||||
* Do not show empty collaborators segment (#1531)
|
||||
* Fix markdown rendering (#1530)
|
||||
* fix go get sub package and add domain on installation to let go get work defaultly (#1518)
|
||||
* fix #1501 ssh hangs caused by #1461 (#1513)
|
||||
* Fix empty file download (#1506)
|
||||
* Fix broken v27 migration - change mirror interval from int to bigint (#1504)
|
||||
* Do not allow commiting to protected branch from online editor (#1502)
|
||||
* Add internal routes for ssh hook comands (#1471)
|
||||
* Fix races within code.gitea.io/git.(*Command).RunInDirTimeoutPipeline (#1465)
|
||||
* Simple quick fix for #1418 (#1456)
|
||||
* fix gpg API panic when no verification (#1451)
|
||||
* fix migrate failed and org dashboard failed on MSSQL database (#1448)
|
||||
* Optimize and fix autolink function (#1442) (#1444)
|
||||
* Fix and simplify repo branches (settings) UI (#1435)
|
||||
* Fix disabled fields in repo settings UI (#1431)
|
||||
* fixes pull request hanging when it contains normal and LFS files (#1425)
|
||||
* Fix races in the log module by using syncmap (#1421)
|
||||
* Add length check for the return string (#1420)
|
||||
* Fix "Error: No issue number specified" when pushing (#1393)
|
||||
* Corrected Mirror.NextUpdate not set (#1388)
|
||||
* fix: remove `str2html` from org full name (#1360)
|
||||
* Correct broken unaligned load/store in armv5 (#1355)
|
||||
* Remove href on first/last link when on first/last page (#1345)
|
||||
* Fix broken table layout (#1344)
|
||||
* LFS: Fix SSH authentication for trailing arguments (#1328)
|
||||
* Remove empty file (#1326)
|
||||
* Fix delete user failed on sqlite (#1321)
|
||||
* Fix inconsistency in layout (#1316)
|
||||
* Fix gpg wrong column types (#1303)
|
||||
* Fix wiki bugs (#1294)
|
||||
* Fix missing less sources for oauth (#1288)
|
||||
* Make sure both scripts/ can live side by side (#1264)
|
||||
* Fix nil-dereference bug (#1258)
|
||||
* rewrite pre-commit, post-commit and options hooks (fixes #1250) (#1257)
|
||||
* Commit search appearence fixes (#1254)
|
||||
* Fix forget migration for wiki hooks (#1227)
|
||||
* Fix repo settings external tracker failed and check external urls (#1215)
|
||||
* Fix 500 caused by branches settings introduced by #1198 (#1214)
|
||||
* fix #1189, commit messages containing a pipe (#1203)
|
||||
* Bug fixed for delete repo failed (#1193)
|
||||
* Fix migration failed when authorized_keys is not exist (#1180)
|
||||
* Fix ini format incomiptable with crowdin (#1177)
|
||||
* TESTING
|
||||
* Integration tests for issues API (#2059)
|
||||
* Add integration tests for signin (#2363)
|
||||
* Add INTERNAL_TOKEN to integration .ini file (#2346)
|
||||
* Add public links check (#2323)
|
||||
* Fix hooks for integration repo (#2216)
|
||||
* More integration tests for comment API (#2156)
|
||||
* Cache session cookies in tests (#2128)
|
||||
* Less verbose integration tests (#2123)
|
||||
* Fix improper setup for integration tests (#2050)
|
||||
* Improve integration test helper functions (#2049)
|
||||
* Add integration test for issue creating (#2002)
|
||||
* Use testing/benchmark interface (#1993)
|
||||
* Add integration test for repository migration (#1983)
|
||||
* Consolidate boilerplate in integration tests (#1979)
|
||||
* Set console to debug for integration tests (#1976)
|
||||
* Add pull-create integration test (#1972)
|
||||
* Coverage reports for integration tests (#1960)
|
||||
* Add integration test for pull-request merge (#1912)
|
||||
* Add integration test for file editing (#1907)
|
||||
* Add integration test for repository forking (#1896)
|
||||
* Run unused test (#1875)
|
||||
* Don't recreate database in integration tests (#1697)
|
||||
* remove sqlite tag when integration test with mysql/postgres and recreate database when init integration test (#1693)
|
||||
* MySQL, Postgres integration tests in drone (#1638)
|
||||
* improve integration test to resue models/fixtures and store git repos with tests (#1627)
|
||||
* Improve govendor testing (#1623)
|
||||
* Integration test framework (#1290)
|
||||
* Unit tests for issue_list (#1209)
|
||||
* Add integration test for signup (#1135)
|
||||
* TRANSLATION
|
||||
* update translation from crowdin (#2368) (#2380)
|
||||
* Small fixes (#2144)
|
||||
* Missing signed commit display translations (#2134)
|
||||
* Sync latest translations from crowdin (#2104)
|
||||
* Add make command update-translations for update translations from crodwin (#2097)
|
||||
* Fix some mistakes (#1833)
|
||||
* Improve clarity between is_activated and prohibit_login (#1788)
|
||||
* Improve grammar (#1775)
|
||||
* Fix bad grammar and wordiness (#1741)
|
||||
* Make strings translatable (#1188) (#1198)
|
||||
* BUILD
|
||||
* Dockerfile for aarch64 (#1128) (#1130)
|
||||
* backport from v1.2 branch: add secrets for github release (#2588) (#2598)
|
||||
* Add secrets for github release to fix drone failed (#2588)
|
||||
* Backport changes for latest drone (#2586)
|
||||
* Removing .drone.yml.sig (#2579)
|
||||
* Fix drone for tags (#2573) (#2576)
|
||||
* Backport: Remove go version check for make fmt (#2558) (#2561)
|
||||
* Backport: Fix lint, fmt and integration testing errors (#2553)
|
||||
* update latest xorm version to vendor (#2353)
|
||||
* Remove integration test executables on `make clean` (#2340)
|
||||
* refactor(Makefile): allow overriding default go program (#2310)
|
||||
* Revert to upstream ini dependency (#2304)
|
||||
* Use /dev/urandom to create random password (#2298)
|
||||
* update drone sig file. (#2262)
|
||||
* go get github.com/wadey/gocovmerge when needed (#2235)
|
||||
* fix typo (#2145)
|
||||
* Revert "Reduce number of layer" (#2086)
|
||||
* Reduce number of layer (#2078)
|
||||
* Skip sqlite integration in CI (#2058)
|
||||
* fix golint error and rename func for suggestion. (#1997)
|
||||
* fix misspell (#1996)
|
||||
* update drone sig file (#1981)
|
||||
* send notification if status changed (#1973)
|
||||
* switch gitter to discord for drone. (#1971)
|
||||
* Fix missing backslash in Dockerfile.rpi (#1952)
|
||||
* Don't run 'make release' on PRs (#1908)
|
||||
* Update code.gitea.io/git (#1892)
|
||||
* Use production version of vuejs (#1869)
|
||||
* Add a variable for docker tag (#1825)
|
||||
* resign drone and fix #1816 (#1819)
|
||||
* Separate generate swagger + fix sed os specific (#1791)
|
||||
* Only run coverage on merges/pushes to master (#1783)
|
||||
* Remove stale rule from Makefile (#1782)
|
||||
* feat: upgrade drone docker image to support multi-stage build. (#1732)
|
||||
* Realy don't cache apk index (#1694)
|
||||
* Limit clone depth when drone-building (#1644)
|
||||
* Refactor Dockerfile (#1632)
|
||||
* Check if missing/modified/unused deps in vendor and fix errors (#1468)
|
||||
* Add GOFLAGS and EXTRA_GOFLAGS (#1438)
|
||||
* Include formatting check to the `make test` (and thus also `check`) rule (#1366)
|
||||
* DOCS
|
||||
* fix wrong changelog title (#2395)
|
||||
* fix webhook link (#2289)
|
||||
* Improve swagger doc (#2274)
|
||||
* Add link to forum in issue template (#2070)
|
||||
* add missing lfs config on example file (#2039)
|
||||
* Add discourse link (#2027)
|
||||
* Fix wording (#2024)
|
||||
* Fix typo (#1974)
|
||||
* Swagger docs for list/create forks (#1941)
|
||||
* Update links to Discord server (#1940)
|
||||
* [ci skip] update discord badge. (#1930)
|
||||
* Change join chat from gitter to discord (#1929)
|
||||
* Update changelog with v1.1.1 (#1926)
|
||||
* Correct grammar in APIEmpty documentation (#1748)
|
||||
* Add swagger comment for MirrorSync (#1747)
|
||||
* Add "Table of Contents" in CONTRIBUTING.md (#1634)
|
||||
* Fix service description in Debian init file (#1538)
|
||||
* Use MAINTAINERS file in repository in CONTRIBUTING (#1489)
|
||||
* Generate swagger json (#1402)
|
||||
* Changed text when password reset disabled. (#1364)
|
||||
* Removed email copyright year (#1348)
|
||||
* Specify that time interval units are seconds (#1311)
|
||||
* Gitea OpenID-2.0 login has been tested with livejournal.com too (#1306)
|
||||
* Make wording of commit search more clear (#1291)
|
||||
* Add notice that LFS mirroring is not supported (#1251)
|
||||
* Fix typos in models/ and modules/ (#1248)
|
||||
* Refactor and fix incorrect comment (#1247)
|
||||
* Fix migration comment (#1241)
|
||||
* Update locale_en-US.ini (#1235)
|
||||
* Add LibreJS support (#1201)
|
||||
* rename OSX to macOS (#1176)
|
||||
* add mssql to app.ini db config comment (#1172)
|
||||
* Add MSSQL to issues template (#1171)
|
||||
* MISC
|
||||
* Add badge and link to the Matrix room (#2348)
|
||||
* ignore coverage steps. (#2257)
|
||||
* Use sqlite3 database as default for Docker image (#2182)
|
||||
* update drone discord plugin to 0.0.4 version (#1992)
|
||||
* fix typo (#1990)
|
||||
* Move 3rd party js/css into `public/vendor` and document sources (#2383)
|
||||
* Prevent conflicting TOTP accounts by adding AppURL to issuer parameter (#2335)
|
||||
* Fix variable name typo (#2327)
|
||||
* Make use of Vue more universal (#2318)
|
||||
* Remove (almost) server side data rendering from repo-search component (#2317)
|
||||
* Add OpenID configuration in install page (#2276)
|
||||
* More tweaks to repo top panel (#2267)
|
||||
* File path tweaks in UI (#2264)
|
||||
* Make SHOW_USER_EMAIL also apply to profiles (#2258)
|
||||
* EnableUnit() -> UnitEnabled() (#2242)
|
||||
* Prevent selection of diff line numbers (#2240)
|
||||
* Remove unused variable on makefile (#2225)
|
||||
* No error log entries for repo 404 (#2200)
|
||||
* Refactor vue delimeters to use es6 template delimeters (#2171)
|
||||
* Replace tmp with TMPDIR. (#2152)
|
||||
* Remove unused files (#2124)
|
||||
* Improve org error handling (#2117)
|
||||
* Absolute path for setting.CustomConf (#2085)
|
||||
* remove deprecated code for Gogs compitable (#2041)
|
||||
* Refactor session close as xorm already does everything needed internally (#2020)
|
||||
* SQLite has a query timeout. Hopefully fixes most 'database locked' errors (#1961)
|
||||
* Use monospace font in githook editor (#1958)
|
||||
* Fix import order (#1951)
|
||||
* Gracefully handle bare repositories on API operations. (#1932)
|
||||
* Fix errors caused by force push (#1927)
|
||||
* Display URLs in integration test logs (#1924)
|
||||
* Set TMPDIR enviroment variable for dump command (#1915)
|
||||
* Cache ctx.User in retrieveFeeds (#1902)
|
||||
* Make `LocalCopyPath` a setting instead of a hard-coded path (#1881)
|
||||
* Add check misspelling (#1877)
|
||||
* Fix misspelled variables (#1874)
|
||||
* Gofmt (#1868, #1710, #1662)
|
||||
* Rename misnamed migration (#1867)
|
||||
* Support CRLF when splitting code lines for display (#1862)
|
||||
* Add convert less css file step. (#1861)
|
||||
* Prevent accidential selection of line numbers in code view (#1860)
|
||||
* Delete Public SSH Key tmp file after calculating fingerprint (#1855)
|
||||
* Remove annoying difference in button heights. (#1853)
|
||||
* Only run test coverage on master branch. (#1838)
|
||||
* Error from mktemp command in MacOS. (#1837)
|
||||
* Use writeTmpKeyFile in calcFingerprint (#1828)
|
||||
* ROOT_URL setting use the default as shown in conf/app.ini (#1823)
|
||||
* Rename RepoCreationNum -> MaxCreationLimit (#1766)
|
||||
* Add button to admin ui (#1738)
|
||||
* Correct spelling mistakes (#1703)
|
||||
* Make openid support default false for compitable with v1.1 (#1650)
|
||||
* Send mails as HTML as default. Setting for send as plain text. (#1648)
|
||||
* fix potential lock when sqlite (#1647)
|
||||
* Optimize png images via Google zopflipng [ci skip] (#1639)
|
||||
* Upgrade alpine to v3.5 in Dockerfile (#1633)
|
||||
* remove unused vendor packages (#1620)
|
||||
* markup: microoptimise for many short filenames in directory (#1534)
|
||||
* support health check via / and fix #969 (#1520)
|
||||
* Remove env user salt since no need to use (#1515)
|
||||
* Drop db operations from hook commands (#1514)
|
||||
* Better URL validation (#1507)
|
||||
* Migrate WatchInfo struct to api (#1492)
|
||||
* refactor: show command help message. (#1486)
|
||||
* refactor update ssh key use time (#1466)
|
||||
* Set VERSION from git once, in a variable (#1447)
|
||||
* Remove unused mutex field (#1440)
|
||||
* Simplify settings pages with item list (#1389)
|
||||
* Clean-up PostgreSQL Tests (#1361)
|
||||
* refactor: remove workaround after the golang 1.7 release. (#1349)
|
||||
* Delete the useless code (#1335)
|
||||
* Run "make fmt" with go-1.6 (#1333)
|
||||
* Refactor admin/auth/new.tmpl (#1277)
|
||||
* Refactor repo/issue/view_content.tmpl (#1276)
|
||||
* Cleaner ui for admin, repo settings, and user settings page (#1269) (#1270)
|
||||
* Cleaner UI for explore page (#1253) (#1255)
|
||||
* Synced licenses with github repo (#1246)
|
||||
* Synced gitignores with github repo (#1245)
|
||||
* Simplify RepositoryList.loadAttributes() (#1211)
|
||||
* Move user_follow to separate file (#1210)
|
||||
* Reduce conditionals in signin/signup inner forms (#1138)
|
||||
|
||||
## [1.1.3](https://github.com/go-gitea/gitea/releases/tag/v1.1.3) - 2017-08-03
|
||||
|
||||
* BUGFIXES
|
||||
* Fix PR template error (#2008)
|
||||
* Fix markdown rendering (fix #1530) (#2043)
|
||||
* Fix missing less sources for oauth (backport #1288) (#2135)
|
||||
* Don't ignore gravatar error (#2138)
|
||||
* Fix diff of renamed and modified file (#2136)
|
||||
* Fix fast-forward PR bug (#2137)
|
||||
* Fix some security bugs
|
||||
|
||||
## [1.1.2](https://github.com/go-gitea/gitea/releases/tag/v1.1.2) - 2017-06-13
|
||||
|
||||
* BUGFIXES
|
||||
* Enforce netgo build tag while cross-compilation (Backport of #1690) (#1731)
|
||||
* fix update avatar
|
||||
* fix delete user failed on sqlite (#1321)
|
||||
* fix bug not to trim space of login username (#1806)
|
||||
* Backport bugfixes #1220 and #1393 to v1.1 (#1758)
|
||||
|
||||
## [1.1.1](https://github.com/go-gitea/gitea/releases/tag/v1.1.1) - 2017-05-04
|
||||
|
||||
* BUGFIXES
|
||||
* Markdown Sanitation Fix [#1646](https://github.com/go-gitea/gitea/pull/1646)
|
||||
* Fix broken hooks [#1376](https://github.com/go-gitea/gitea/pull/1376)
|
||||
* Fix migration issue [#1375](https://github.com/go-gitea/gitea/pull/1375)
|
||||
* Fix Wiki Issues [#1338](https://github.com/go-gitea/gitea/pull/1338)
|
||||
* Forgotten migration for wiki githooks [#1237](https://github.com/go-gitea/gitea/pull/1237)
|
||||
* Commit messages can contain pipes [#1218](https://github.com/go-gitea/gitea/pull/1218)
|
||||
* Verify external tracker URLs [#1236](https://github.com/go-gitea/gitea/pull/1236)
|
||||
* Allow upgrade after downgrade [#1197](https://github.com/go-gitea/gitea/pull/1197)
|
||||
* 500 on delete repo with issue [#1195](https://github.com/go-gitea/gitea/pull/1195)
|
||||
* INI compat with CrowdIn [#1192](https://github.com/go-gitea/gitea/pull/1192)
|
||||
|
||||
## [1.1.0](https://github.com/go-gitea/gitea/releases/tag/v1.1.0) - 2017-03-09
|
||||
|
||||
* BREAKING
|
||||
* The SSH keys can potentially break, make sure to regenerate the authorized keys
|
||||
* FEATURE
|
||||
* Git LFSv2 support [#122](https://github.com/go-gitea/gitea/pull/122)
|
||||
* API endpoints for repo watching [#191](https://github.com/go-gitea/gitea/pull/191)
|
||||
* Search within private repos [#222](https://github.com/go-gitea/gitea/pull/222)
|
||||
* Hide user email address on explore page [#336](https://github.com/go-gitea/gitea/pull/336)
|
||||
* Protected branch system [#339](https://github.com/go-gitea/gitea/pull/339)
|
||||
* Sendmail for mail delivery [#355](https://github.com/go-gitea/gitea/pull/355)
|
||||
* API endpoints for org webhooks [#372](https://github.com/go-gitea/gitea/pull/372)
|
||||
* Enabled MSSQL support [#383](https://github.com/go-gitea/gitea/pull/383)
|
||||
* API endpoints for org teams [#370](https://github.com/go-gitea/gitea/pull/370)
|
||||
* API endpoints for collaborators [#375](https://github.com/go-gitea/gitea/pull/375)
|
||||
* Graceful server restart [#416](https://github.com/go-gitea/gitea/pull/416)
|
||||
* Commitgraph / timeline on commits page [#428](https://github.com/go-gitea/gitea/pull/428)
|
||||
* API endpoints for repo forks [#509](https://github.com/go-gitea/gitea/pull/509)
|
||||
* API endpoints for releases [#510](https://github.com/go-gitea/gitea/pull/510)
|
||||
* Folder jumping [#511](https://github.com/go-gitea/gitea/pull/511)
|
||||
* Stars tab on profile page [#519](https://github.com/go-gitea/gitea/pull/519)
|
||||
* Notification system [#523](https://github.com/go-gitea/gitea/pull/523)
|
||||
* Push and pull through reverse proxy basic auth [#524](https://github.com/go-gitea/gitea/pull/524)
|
||||
* Search for issues and pull requests [#530](https://github.com/go-gitea/gitea/pull/530)
|
||||
* API endpoint for stargazers [#597](https://github.com/go-gitea/gitea/pull/597)
|
||||
* API endpoints for subscribers [#598](https://github.com/go-gitea/gitea/pull/598)
|
||||
* PID file support [#610](https://github.com/go-gitea/gitea/pull/610)
|
||||
* Two factor authentication (2FA) [#630](https://github.com/go-gitea/gitea/pull/630)
|
||||
* API endpoints for org users [#645](https://github.com/go-gitea/gitea/pull/645)
|
||||
* Release attachments [#673](https://github.com/go-gitea/gitea/pull/673)
|
||||
* OAuth2 consumer [#679](https://github.com/go-gitea/gitea/pull/679)
|
||||
* Add ability to fork your own repos [#761](https://github.com/go-gitea/gitea/pull/761)
|
||||
* Search repository on dashboard [#773](https://github.com/go-gitea/gitea/pull/773)
|
||||
* Search bar on user profile [#787](https://github.com/go-gitea/gitea/pull/787)
|
||||
* Track label changes on issue view [#788](https://github.com/go-gitea/gitea/pull/788)
|
||||
* Allow using custom time format [#798](https://github.com/go-gitea/gitea/pull/798)
|
||||
* Redirects for renamed repos [#807](https://github.com/go-gitea/gitea/pull/807)
|
||||
* Track assignee changes on issue view [#808](https://github.com/go-gitea/gitea/pull/808)
|
||||
* Track title changes on issue view [#841](https://github.com/go-gitea/gitea/pull/841)
|
||||
* Archive cleanup action [#885](https://github.com/go-gitea/gitea/pull/885)
|
||||
* Basic Open Graph support [#901](https://github.com/go-gitea/gitea/pull/901)
|
||||
* Take back control of Git hooks [#1006](https://github.com/go-gitea/gitea/pull/1006)
|
||||
* API endpoints for user repos [#1059](https://github.com/go-gitea/gitea/pull/1059)
|
||||
* BUGFIXES
|
||||
* Fixed counting issues for issue filters [#413](https://github.com/go-gitea/gitea/pull/413)
|
||||
* Added back default settings for SSH [#500](https://github.com/go-gitea/gitea/pull/500)
|
||||
* Fixed repo permissions [#513](https://github.com/go-gitea/gitea/pull/513)
|
||||
* Issues cannot be created with labels [#622](https://github.com/go-gitea/gitea/pull/622)
|
||||
* Add a reserved wiki paths check to the wiki [#720](https://github.com/go-gitea/gitea/pull/720)
|
||||
* Update website binding MaxSize to 255 [#722](https://github.com/go-gitea/gitea/pull/722)
|
||||
* User can see the private activity on public history [#818](https://github.com/go-gitea/gitea/pull/818)
|
||||
* Wrong pages number which includes private repositories [#844](https://github.com/go-gitea/gitea/pull/844)
|
||||
* Trim whitespaces for search keyword [#893](https://github.com/go-gitea/gitea/pull/893)
|
||||
* Don't rewrite non-gitea public keys [#906](https://github.com/go-gitea/gitea/pull/906)
|
||||
* Use fingerprint to check instead content for public key [#911](https://github.com/go-gitea/gitea/pull/911)
|
||||
* Fix random avatars [#1147](https://github.com/go-gitea/gitea/pull/1147)
|
||||
* ENHANCEMENT
|
||||
* Refactored process manager [#75](https://github.com/go-gitea/gitea/pull/75)
|
||||
* Restrict rights to create new orgs [#193](https://github.com/go-gitea/gitea/pull/193)
|
||||
* Added label and milestone sorting [#199](https://github.com/go-gitea/gitea/pull/199)
|
||||
* Make minimum password length configurable [#223](https://github.com/go-gitea/gitea/pull/223)
|
||||
* Speedup conflict checking on pull requests [#276](https://github.com/go-gitea/gitea/pull/276)
|
||||
* Added button to delete merged pull request branches [#441](https://github.com/go-gitea/gitea/pull/441)
|
||||
* Improved issue references within markdown [#471](https://github.com/go-gitea/gitea/pull/471)
|
||||
* Dutch translation for the landingpage [#487](https://github.com/go-gitea/gitea/pull/487)
|
||||
* Added Gogs migration script [#532](https://github.com/go-gitea/gitea/pull/532)
|
||||
* Support a .gitea folder for issue templates [#582](https://github.com/go-gitea/gitea/pull/582)
|
||||
* Enhanced diff-view coloring [#584](https://github.com/go-gitea/gitea/pull/584)
|
||||
* Added ETag header to avatars [#721](https://github.com/go-gitea/gitea/pull/721)
|
||||
* Added option to config to disable local path imports [#724](https://github.com/go-gitea/gitea/pull/724)
|
||||
* Allow custom public files [#782](https://github.com/go-gitea/gitea/pull/782)
|
||||
* Added pprof endpoint for debugging [#801](https://github.com/go-gitea/gitea/pull/801)
|
||||
* Added `X-GitHub-*` headers [#809](https://github.com/go-gitea/gitea/pull/809)
|
||||
* Fill SSH key title automatically [#863](https://github.com/go-gitea/gitea/pull/863)
|
||||
* Display Git version on admin panel [#921](https://github.com/go-gitea/gitea/pull/921)
|
||||
* Expose URL field on issue API [#982](https://github.com/go-gitea/gitea/pull/982)
|
||||
* Statically compile the binaries [#985](https://github.com/go-gitea/gitea/pull/985)
|
||||
* Embed build tags into version string [#1051](https://github.com/go-gitea/gitea/pull/1051)
|
||||
* Gitignore support for FSharp and Clojure [#1072](https://github.com/go-gitea/gitea/pull/1072)
|
||||
* Custom templates for static builds [#1087](https://github.com/go-gitea/gitea/pull/1087)
|
||||
* Add ProxyFromEnvironment if none set [#1096](https://github.com/go-gitea/gitea/pull/1096)
|
||||
* MISC
|
||||
* Replaced remaining Gogs references
|
||||
* Added more tests on various packages
|
||||
* Use Crowdin for translations again
|
||||
* Resolved some XSS attack vectors
|
||||
* Optimized and reduced number of database queries
|
||||
|
||||
## [1.0.2](https://github.com/go-gitea/gitea/releases/tag/v1.0.2) - 2017-02-21
|
||||
|
||||
* BUGFIXES
|
||||
* Fixed issue counter [#882](https://github.com/go-gitea/gitea/pull/882)
|
||||
* Fixed XSS vulnerability on wiki page [#955](https://github.com/go-gitea/gitea/pull/955)
|
||||
* Add data dir without session to dump [#587](https://github.com/go-gitea/gitea/pull/587)
|
||||
* Fixed wiki page renaming [#958](https://github.com/go-gitea/gitea/pull/958)
|
||||
* Drop default console logger if not required [#960](https://github.com/go-gitea/gitea/pull/960)
|
||||
* Fixed docker docs link on install page [#972](https://github.com/go-gitea/gitea/pull/972)
|
||||
* Handle SetModel errors [#957](https://github.com/go-gitea/gitea/pull/957)
|
||||
* Fixed XSS vulnerability on milestones [#977](https://github.com/go-gitea/gitea/pull/977)
|
||||
* Fixed XSS vulnerability on alerts [#981](https://github.com/go-gitea/gitea/pull/981)
|
||||
|
||||
## [1.0.1](https://github.com/go-gitea/gitea/releases/tag/v1.0.1) - 2017-01-05
|
||||
|
||||
* BUGFIXES
|
||||
* Fixed localized `MIN_PASSWORD_LENGTH` [#501](https://github.com/go-gitea/gitea/pull/501)
|
||||
* Fixed 500 error on organization delete [#507](https://github.com/go-gitea/gitea/pull/507)
|
||||
* Ignore empty wiki repo on migrate [#544](https://github.com/go-gitea/gitea/pull/544)
|
||||
* Proper check access for forking [#563](https://github.com/go-gitea/gitea/pull/563)
|
||||
* Fix SSH domain on installer [#506](https://github.com/go-gitea/gitea/pull/506)
|
||||
* Fix missing data rows on admin UI [#580](https://github.com/go-gitea/gitea/pull/580)
|
||||
* Do not delete tags with releases by default [#579](https://github.com/go-gitea/gitea/pull/579)
|
||||
* Fix missing session config data on admin UI [#578](https://github.com/go-gitea/gitea/pull/578)
|
||||
* Properly show the version within footer on the UI [#593](https://github.com/go-gitea/gitea/pull/593)
|
||||
|
||||
## [1.0.0](https://github.com/go-gitea/gitea/releases/tag/v1.0.0) - 2016-12-23
|
||||
|
||||
|
@@ -1,8 +1,25 @@
|
||||
# Contribution Guidelines
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Contribution Guidelines](#contribution-guidelines)
|
||||
- [Introduction](#introduction)
|
||||
- [Bug reports](#bug-reports)
|
||||
- [Discuss your design](#discuss-your-design)
|
||||
- [Testing redux](#testing-redux)
|
||||
- [Vendoring](#vendoring)
|
||||
- [Code review](#code-review)
|
||||
- [Styleguide](#styleguide)
|
||||
- [Sign your work](#sign-your-work)
|
||||
- [Release Cycle](#release-cycle)
|
||||
- [Maintainers](#maintainers)
|
||||
- [Owners](#owners)
|
||||
- [Versions](#versions)
|
||||
- [Copyright](#copyright)
|
||||
|
||||
## Introduction
|
||||
|
||||
This document explains how to contribute changes to the Gitea project. It assumes you have followed the [installation instructions](https://github.com/go-gitea/docs/tree/master/en-US/installation). Sensitive security-related issues should be reported to [security@gitea.io](mailto:security@gitea.io).
|
||||
This document explains how to contribute changes to the Gitea project. It assumes you have followed the [installation instructions](https://docs.gitea.io/en-us/). Sensitive security-related issues should be reported to [security@gitea.io](mailto:security@gitea.io).
|
||||
|
||||
## Bug reports
|
||||
|
||||
@@ -10,7 +27,7 @@ Please search the issues on the issue tracker with a variety of keywords to ensu
|
||||
|
||||
If unique, [open an issue](https://github.com/go-gitea/gitea/issues/new) and answer the questions so we can understand and reproduce the problematic behavior.
|
||||
|
||||
The burden is on you to convince us that it is actually a bug in Gitea. This is easiest to do when you write clear, concise instructions so we can reproduce the behavior (even if it seems obvious). The more detailed and specific you are, the faster we will be able to help you. Check out [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html).
|
||||
To show us that the issue you are having is in Gitea itself, please write clear, concise instructions so we can reproduce the behavior (even if it seems obvious). The more detailed and specific you are, the faster we can fix the issue. Check out [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html).
|
||||
|
||||
Please be kind, remember that Gitea comes at no cost to you, and you're getting free help.
|
||||
|
||||
@@ -24,17 +41,44 @@ This process gives everyone a chance to validate the design, helps prevent dupli
|
||||
|
||||
## Testing redux
|
||||
|
||||
Before sending code out for review, run all the tests for the whole tree to make sure the changes don't break other usage and keep the compatibility on upgrade. To make sure you are running the test suite exactly like we do you should install the CLI for [Drone CI](https://github.com/drone/drone), as we are using the server for continous testing, following [these instructions](http://readme.drone.io/0.5/install/cli/). After that you can simply call `drone exec` within your working directory and it will try to run the test suite locally.
|
||||
Before sending code out for review, run all the tests for the whole tree to make sure the changes don't break other usage and keep the compatibility on upgrade. To make sure you are running the test suite exactly like we do, you should install the CLI for [Drone CI](https://github.com/drone/drone), as we are using the server for continous testing, following [these instructions](http://readme.drone.io/usage/getting-started-cli). After that you can simply call `drone exec` within your working directory and it will try to run the test suite locally.
|
||||
|
||||
## Vendoring
|
||||
|
||||
We keep a cached copy of dependencies within the `vendor/` directory, managing updates via [govendor](http://github.com/kardianos/govendor).
|
||||
|
||||
Pull requests should only include `vendor/` updates if they are part of the same change, be it a bugfix or a feature addition.
|
||||
|
||||
The `vendor/` update needs to be justified as part of the PR description, and must be verified by the reviewers and/or merger to always reference an existing upstream commit.
|
||||
|
||||
## Code review
|
||||
|
||||
Changes to Gitea must be reviewed before they are accepted, no matter who makes the change even if it is an owner or a maintainer. We use GitHub's pull request workflow to do that and we also use [LGTM](http://lgtm.co) to ensure every PR is reviewed by at least 2 maintainers.
|
||||
|
||||
Please try to make your pull request easy to review for us. Please read the "[How to get faster PR reviews](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md)" guide, it has lots of useful tips for any project you may want to contribute. Some of the key points:
|
||||
Please try to make your pull request easy to review for us. Please read the "[How to get faster PR reviews](https://github.com/kubernetes/community/blob/master/contributors/devel/faster_reviews.md)" guide, it has lots of useful tips for any project you may want to contribute. Some of the key points:
|
||||
|
||||
* Make small pull requests. The smaller, the faster to review and the more likely it will be merged soon.
|
||||
* Don't make changes unrelated to your PR. Maybe there are typos on some comments, maybe refactoring would be welcome on a function... but if that is not related to your PR, please make *another* PR for that.
|
||||
* Split big pull requests in multiple small ones. An incremental change will be faster to review than a huge PR.
|
||||
* Split big pull requests into multiple small ones. An incremental change will be faster to review than a huge PR.
|
||||
|
||||
## Styleguide
|
||||
|
||||
For imports you should use the following format (_without_ the comments)
|
||||
```go
|
||||
import (
|
||||
// stdlib
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
// local packages
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/sdk/gitea"
|
||||
|
||||
// external packages
|
||||
"github.com/foo/bar"
|
||||
"gopkg.io/baz.v1"
|
||||
)
|
||||
```
|
||||
|
||||
## Sign your work
|
||||
|
||||
@@ -44,20 +88,26 @@ The sign-off is a simple line at the end of the explanation for the patch. Your
|
||||
Signed-off-by: Joe Smith <joe.smith@email.com>
|
||||
```
|
||||
|
||||
Please use your real name, we really dislike pseudonyms or anonymous contributions. We are in the opensource world without secrets. If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with `git commit -s`.
|
||||
Please use your real name, we really dislike pseudonyms or anonymous contributions. We are in the open-source world without secrets. If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with `git commit -s`.
|
||||
|
||||
## Release Cycle
|
||||
|
||||
We adopted a release schedule to streamline the process of working on, finishing, and issuing releases. The overall goal is to make a major release every two months, which breaks down into one month of general development followed by one month of testing and polishing known as the release freeze. A release is maintained by issuing minor releases to only correct critical problems such as crashes or security issues. All the feature pull requests should be merged in the first month of one release period.
|
||||
|
||||
The current release cycle is aligned to start on December 25 to February 24, next is February 25 to April 24, and etc. On this cycle, we also maybe publish the previous release minor version. For example, the current release version is v1.1, but we maybe also publish v1.0.2. When we publish v1.2, then we will stop publish v1.0.3.
|
||||
|
||||
## Maintainers
|
||||
|
||||
To make sure every PR is checked, we got team maintainers. Every PR **MUST** be reviewed by at least two maintainers (or owners) before it can get merged. A maintainer should be a contributor of Gitea (or Gogs) and contributed at least 4 accepted PRs. A contributor should apply as a maintainer in the [Gitter develop channel](https://gitter.im/go-gitea/develop). The owners or the team maintainers may invite the contributor. A maintainer should spend some time on code reviews. If a maintainer has no time to do that, they should apply to leave the maintainers team and we will give them the honor of being a member of the advisors team. Of course, if an advisor has time to code review, we will gladly welcome them back to maintainers team. If someone has no time to code review and forgets to leave the maintainers team, the owners have the power to move him from maintainers team to advisors team.
|
||||
To make sure every PR is checked, we have [team maintainers](MAINTAINERS). Every PR **MUST** be reviewed by at least two maintainers (or owners) before it can get merged. A maintainer should be a contributor of Gitea (or Gogs) and contributed at least 4 accepted PRs. A contributor should apply as a maintainer in the [Discord](https://discord.gg/NsatcWJ) #develop channel. The owners or the team maintainers may invite the contributor. A maintainer should spend some time on code reviews. If a maintainer has no time to do that, they should apply to leave the maintainers team and we will give them the honor of being a member of the [advisors team](https://github.com/orgs/go-gitea/teams/advisors). Of course, if an advisor has time to code review, we will gladly welcome them back to the maintainers team. If a maintainer is inactive for more than 3 months and forgets to leave the maintainers team, the owners may move him or her from the maintainers team to the advisors team.
|
||||
|
||||
## Owners
|
||||
|
||||
Since Gitea is a pure community organization without any company support, to keep the development healthy we will elect the owners every year. Every time we will elect three owners. All the contributors may vote up to three people, one of which is the main owner, and the others are assistant owners. When the new owners have been elected, the old owners MUST move the power to the new ones. If an owner don't obey these rules, the others are allowed to revoke his owner status.
|
||||
Since Gitea is a pure community organization without any company support, to keep the development healthy we will elect three owners every year. All contributors may vote to elect up to three candidates, one of which will be the main owner, and the other two the assistant owners. When the new owners have been elected, the old owners will give up ownership to the newly elected owners. If an owner is unable to do so, the other owners will assist in ceding ownership to the newly elected owners.
|
||||
|
||||
After the election, the new owners should say they agree with these rules on the [CONTRIBUTING](CONTRIBUTING.md) on the [Gitter main channel](https://gitter.im/go-gitea/gitea). Below are the words to speak:
|
||||
After the election, the new owners should proactively agree with our [CONTRIBUTING](CONTRIBUTING.md) requirements in the [Discord](https://discord.gg/NsatcWJ) #general channel. Below are the words to speak:
|
||||
|
||||
```
|
||||
I'm glad to be an owner of Gitea, I agree with [CONTRIBUTING](CONTRIBUTING.md). I will spend part of my time on Gitea and lead the development of Gitea.
|
||||
I'm honored to having been elected an owner of Gitea, I agree with [CONTRIBUTING](CONTRIBUTING.md). I will spend part of my time on Gitea and lead the development of Gitea.
|
||||
```
|
||||
|
||||
To honor the past owners, here's the history of the owners and the time they served:
|
||||
@@ -78,7 +128,7 @@ Since the `master` branch is a tip version, if you wish to use Gitea in producti
|
||||
Code that you contribute should use the standard copyright header:
|
||||
|
||||
```
|
||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
```
|
||||
|
13
Dockerfile
13
Dockerfile
@@ -1,10 +1,9 @@
|
||||
FROM alpine:3.4
|
||||
FROM alpine:3.5
|
||||
MAINTAINER Thomas Boerger <thomas@webhippie.de>
|
||||
|
||||
EXPOSE 22 3000
|
||||
|
||||
RUN apk update && \
|
||||
apk add \
|
||||
RUN apk --no-cache add \
|
||||
su-exec \
|
||||
ca-certificates \
|
||||
sqlite \
|
||||
@@ -14,10 +13,8 @@ RUN apk update && \
|
||||
s6 \
|
||||
curl \
|
||||
openssh \
|
||||
tzdata && \
|
||||
rm -rf \
|
||||
/var/cache/apk/* && \
|
||||
addgroup \
|
||||
tzdata
|
||||
RUN addgroup \
|
||||
-S -g 1000 \
|
||||
git && \
|
||||
adduser \
|
||||
@@ -27,7 +24,7 @@ RUN apk update && \
|
||||
-u 1000 \
|
||||
-G git \
|
||||
git && \
|
||||
echo "git:$(date +%s | sha256sum | base64 | head -c 32)" | chpasswd
|
||||
echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd
|
||||
|
||||
ENV USER git
|
||||
ENV GITEA_CUSTOM /data/gitea
|
||||
|
40
Dockerfile.aarch64
Normal file
40
Dockerfile.aarch64
Normal file
@@ -0,0 +1,40 @@
|
||||
FROM multiarch/alpine:aarch64-v3.5
|
||||
|
||||
EXPOSE 22 3000
|
||||
|
||||
RUN apk --no-cache add \
|
||||
su-exec \
|
||||
ca-certificates \
|
||||
sqlite \
|
||||
bash \
|
||||
git \
|
||||
linux-pam \
|
||||
s6 \
|
||||
curl \
|
||||
openssh \
|
||||
tzdata
|
||||
RUN addgroup \
|
||||
-S -g 1000 \
|
||||
git && \
|
||||
adduser \
|
||||
-S -H -D \
|
||||
-h /data/git \
|
||||
-s /bin/bash \
|
||||
-u 1000 \
|
||||
-G git \
|
||||
git && \
|
||||
echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd
|
||||
|
||||
ENV USER git
|
||||
ENV GITEA_CUSTOM /data/gitea
|
||||
|
||||
COPY docker /
|
||||
COPY gitea /app/gitea/gitea
|
||||
|
||||
ENV GODEBUG=netdns=go
|
||||
|
||||
VOLUME ["/data"]
|
||||
|
||||
ENTRYPOINT ["/usr/bin/entrypoint"]
|
||||
CMD ["/bin/s6-svscan", "/etc/s6"]
|
||||
|
@@ -1,10 +1,9 @@
|
||||
FROM hypriot/rpi-alpine-scratch:v3.4
|
||||
FROM multiarch/alpine:armhf-v3.5
|
||||
MAINTAINER Thomas Boerger <thomas@webhippie.de>
|
||||
|
||||
EXPOSE 22 3000
|
||||
|
||||
RUN apk update && \
|
||||
apk add \
|
||||
RUN apk --no-cache add \
|
||||
su-exec \
|
||||
ca-certificates \
|
||||
sqlite \
|
||||
@@ -14,10 +13,8 @@ RUN apk update && \
|
||||
s6 \
|
||||
curl \
|
||||
openssh \
|
||||
tzdata && \
|
||||
rm -rf \
|
||||
/var/cache/apk/* && \
|
||||
addgroup \
|
||||
tzdata
|
||||
RUN addgroup \
|
||||
-S -g 1000 \
|
||||
git && \
|
||||
adduser \
|
||||
@@ -26,7 +23,8 @@ RUN apk update && \
|
||||
-s /bin/bash \
|
||||
-u 1000 \
|
||||
-G git \
|
||||
git
|
||||
git && \
|
||||
echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd
|
||||
|
||||
ENV USER git
|
||||
ENV GITEA_CUSTOM /data/gitea
|
||||
@@ -38,7 +36,4 @@ ENTRYPOINT ["/usr/bin/entrypoint"]
|
||||
CMD ["/bin/s6-svscan", "/etc/s6"]
|
||||
|
||||
COPY docker /
|
||||
|
||||
COPY public /app/gitea/public
|
||||
COPY templates /app/gitea/templates
|
||||
COPY gitea /app/gitea/gitea
|
||||
|
@@ -1,5 +1,7 @@
|
||||
Alexey Makhov <amakhov@avito.ru> (@makhov)
|
||||
Andrey Nering <andrey.nering@gmail.com> (@andreynering)
|
||||
Bo-Yi Wu <appleboy.tw@gmail.com> (@appleboy)
|
||||
Ethan Koenig <ethantkoenig@gmail.com> (@ethantkoenig)
|
||||
Kees de Vries <bouwko@gmail.com> (@Bwko)
|
||||
Kim Carlbäcker <kim.carlbacker@gmail.com> (@bkcsoft)
|
||||
LefsFlare <nobody@nobody.tld> (@LefsFlarey)
|
||||
@@ -10,3 +12,7 @@ Rémy Boulanouar <admin@dblk.org> (@DblK)
|
||||
Sandro Santilli <strk@kbt.io> (@strk)
|
||||
Thibault Meyer <meyer.thibault@gmail.com> (@0xbaadf00d)
|
||||
Thomas Boerger <thomas@webhippie.de> (@tboerger)
|
||||
Patrick G <geek1011@outlook.com> (@geek1011)
|
||||
Antoine Girard <sapk@sapk.fr> (@sapk)
|
||||
Lauris Bukšis-Haberkorns <lauris@nix.lv> (@lafriks)
|
||||
Jonas Östanbäck <jonas.ostanback@gmail.com> (@cez81)
|
||||
|
260
Makefile
260
Makefile
@@ -1,19 +1,43 @@
|
||||
DIST := dist
|
||||
EXECUTABLE := gitea
|
||||
IMPORT := code.gitea.io/gitea
|
||||
|
||||
GO ?= go
|
||||
SED_INPLACE := sed -i
|
||||
|
||||
ifeq ($(OS), Windows_NT)
|
||||
EXECUTABLE := gitea.exe
|
||||
else
|
||||
EXECUTABLE := gitea
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
SED_INPLACE := sed -i ''
|
||||
endif
|
||||
endif
|
||||
|
||||
BINDATA := modules/{options,public,templates}/bindata.go
|
||||
STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less)
|
||||
JAVASCRIPTS :=
|
||||
DOCKER_TAG := gitea/gitea:latest
|
||||
GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go")
|
||||
GOFMT ?= gofmt -s
|
||||
|
||||
LDFLAGS += -X "main.Version=$(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')"
|
||||
GOFLAGS := -i -v
|
||||
EXTRA_GOFLAGS ?=
|
||||
|
||||
TARGETS ?= linux/*,darwin/*,windows/*
|
||||
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
|
||||
LDFLAGS := -X "main.Version=$(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')" -X "main.Tags=$(TAGS)"
|
||||
|
||||
PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list ./... | grep -v /vendor/))
|
||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||
|
||||
TAGS ?=
|
||||
|
||||
TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'gitea-temp')
|
||||
|
||||
ifeq ($(OS), Windows_NT)
|
||||
EXECUTABLE := gitea.exe
|
||||
else
|
||||
EXECUTABLE := gitea
|
||||
endif
|
||||
|
||||
ifneq ($(DRONE_TAG),)
|
||||
VERSION ?= $(subst v,,$(DRONE_TAG))
|
||||
else
|
||||
@@ -29,81 +53,195 @@ all: build
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
go clean -i ./...
|
||||
rm -rf $(EXECUTABLE) $(DIST) $(BINDATA)
|
||||
$(GO) clean -i ./...
|
||||
rm -rf $(EXECUTABLE) $(DIST) $(BINDATA) integrations*.test
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
go fmt $(PACKAGES)
|
||||
$(GOFMT) -w $(GOFILES)
|
||||
|
||||
.PHONY: vet
|
||||
vet:
|
||||
go vet $(PACKAGES)
|
||||
$(GO) vet $(PACKAGES)
|
||||
|
||||
.PHONY: generate
|
||||
generate:
|
||||
@which go-bindata > /dev/null; if [ $$? -ne 0 ]; then \
|
||||
go get -u github.com/jteeuwen/go-bindata/...; \
|
||||
@hash go-bindata > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/jteeuwen/go-bindata/...; \
|
||||
fi
|
||||
go generate $(PACKAGES)
|
||||
$(GO) generate $(PACKAGES)
|
||||
|
||||
.PHONY: generate-swagger
|
||||
generate-swagger:
|
||||
@hash swagger > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/go-swagger/go-swagger/cmd/swagger; \
|
||||
fi
|
||||
swagger generate spec -o ./public/swagger.v1.json
|
||||
$(SED_INPLACE) "s;\".ref\": \"#/definitions/GPGKey\";\"type\": \"object\";g" ./public/swagger.v1.json
|
||||
$(SED_INPLACE) "s;^ \".ref\": \"#/definitions/Repository\"; \"type\": \"object\";g" ./public/swagger.v1.json
|
||||
|
||||
.PHONY: errcheck
|
||||
errcheck:
|
||||
@which errcheck > /dev/null; if [ $$? -ne 0 ]; then \
|
||||
go get -u github.com/kisielk/errcheck; \
|
||||
@hash errcheck > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/kisielk/errcheck; \
|
||||
fi
|
||||
errcheck $(PACKAGES)
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
@which golint > /dev/null; if [ $$? -ne 0 ]; then \
|
||||
go get -u github.com/golang/lint/golint; \
|
||||
@hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/golang/lint/golint; \
|
||||
fi
|
||||
for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
|
||||
|
||||
.PHONY: misspell-check
|
||||
misspell-check:
|
||||
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/client9/misspell/cmd/misspell; \
|
||||
fi
|
||||
misspell -error -i unknwon $(GOFILES)
|
||||
|
||||
.PHONY: misspell
|
||||
misspell:
|
||||
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/client9/misspell/cmd/misspell; \
|
||||
fi
|
||||
misspell -w -i unknwon $(GOFILES)
|
||||
|
||||
.PHONY: fmt-check
|
||||
fmt-check:
|
||||
# get all go files and run go fmt on them
|
||||
@diff=$$($(GOFMT) -d $(GOFILES)); \
|
||||
if [ -n "$$diff" ]; then \
|
||||
echo "Please run 'make fmt' and commit the result:"; \
|
||||
echo "$${diff}"; \
|
||||
exit 1; \
|
||||
fi;
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
|
||||
test: fmt-check
|
||||
$(GO) test $(PACKAGES)
|
||||
|
||||
.PHONY: test-coverage
|
||||
test-coverage: unit-test-coverage integration-test-coverage
|
||||
@hash gocovmerge > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/wadey/gocovmerge; \
|
||||
fi
|
||||
for PKG in $(PACKAGES); do\
|
||||
touch $$GOPATH/src/$$PKG/coverage.out;\
|
||||
egrep "$$PKG[^/]*\.go" integration.coverage.out > int.coverage.out;\
|
||||
gocovmerge $$GOPATH/src/$$PKG/coverage.out int.coverage.out > pkg.coverage.out;\
|
||||
mv pkg.coverage.out $$GOPATH/src/$$PKG/coverage.out;\
|
||||
rm int.coverage.out;\
|
||||
done;
|
||||
|
||||
.PHONY: unit-test-coverage
|
||||
unit-test-coverage:
|
||||
for PKG in $(PACKAGES); do $(GO) test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
|
||||
|
||||
.PHONY: test-vendor
|
||||
test-vendor:
|
||||
@hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/kardianos/govendor; \
|
||||
fi
|
||||
govendor list +unused | tee "$(TMPDIR)/wc-gitea-unused"
|
||||
[ $$(cat "$(TMPDIR)/wc-gitea-unused" | wc -l) -eq 0 ] || echo "Warning: /!\\ Some vendor are not used /!\\"
|
||||
|
||||
govendor list +outside | tee "$(TMPDIR)/wc-gitea-outside"
|
||||
[ $$(cat "$(TMPDIR)/wc-gitea-outside" | wc -l) -eq 0 ] || exit 1
|
||||
|
||||
govendor status || exit 1
|
||||
|
||||
.PHONY: test-sqlite
|
||||
test-sqlite: integrations.sqlite.test
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
|
||||
|
||||
.PHONY: test-mysql
|
||||
test-mysql:
|
||||
@echo "Not integrated yet!"
|
||||
test-mysql: integrations.test
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.test
|
||||
|
||||
.PHONY: test-pgsql
|
||||
test-pgsql:
|
||||
@echo "Not integrated yet!"
|
||||
test-pgsql: integrations.test
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test
|
||||
|
||||
|
||||
.PHONY: bench-sqlite
|
||||
bench-sqlite: integrations.sqlite.test
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.bench .
|
||||
|
||||
.PHONY: bench-mysql
|
||||
bench-mysql: integrations.test
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.test -test.bench .
|
||||
|
||||
.PHONY: bench-pgsql
|
||||
bench-pgsql: integrations.test
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test -test.bench .
|
||||
|
||||
|
||||
.PHONY: integration-test-coverage
|
||||
integration-test-coverage: integrations.cover.test
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
|
||||
|
||||
integrations.test: $(SOURCES)
|
||||
$(GO) test -c code.gitea.io/gitea/integrations
|
||||
|
||||
integrations.sqlite.test: $(SOURCES)
|
||||
$(GO) test -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags 'sqlite'
|
||||
|
||||
integrations.cover.test: $(SOURCES)
|
||||
$(GO) test -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(PACKAGES) | tr ' ' ',') -o integrations.cover.test
|
||||
|
||||
.PHONY: check
|
||||
check: test
|
||||
|
||||
.PHONY: install
|
||||
install: $(wildcard *.go)
|
||||
go install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
|
||||
$(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
|
||||
|
||||
.PHONY: build
|
||||
build: $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(SOURCES)
|
||||
go build -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
|
||||
$(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
|
||||
|
||||
.PHONY: docker
|
||||
docker:
|
||||
docker run -ti --rm -v $(CURDIR):/srv/app/src/code.gitea.io/gitea -w /srv/app/src/code.gitea.io/gitea -e TAGS="$(TAGS)" webhippie/golang:edge make clean generate build
|
||||
docker build -t gitea/gitea:latest .
|
||||
docker run -ti --rm -v $(CURDIR):/srv/app/src/code.gitea.io/gitea -w /srv/app/src/code.gitea.io/gitea -e TAGS="bindata $(TAGS)" webhippie/golang:edge make clean generate build
|
||||
docker build -t $(DOCKER_TAG) .
|
||||
|
||||
.PHONY: release
|
||||
release: release-dirs release-build release-copy release-check
|
||||
release: release-dirs release-windows release-linux release-darwin release-copy release-check
|
||||
|
||||
.PHONY: release-dirs
|
||||
release-dirs:
|
||||
mkdir -p $(DIST)/binaries $(DIST)/release
|
||||
|
||||
.PHONY: release-build
|
||||
release-build:
|
||||
@which xgo > /dev/null; if [ $$? -ne 0 ]; then \
|
||||
go get -u github.com/karalabe/xgo; \
|
||||
.PHONY: release-windows
|
||||
release-windows:
|
||||
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/karalabe/xgo; \
|
||||
fi
|
||||
xgo -dest $(DIST)/binaries -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -targets '$(TARGETS)' -out $(EXECUTABLE)-$(VERSION) $(IMPORT)
|
||||
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
|
||||
ifeq ($(CI),drone)
|
||||
mv /build/* $(DIST)/binaries
|
||||
endif
|
||||
|
||||
.PHONY: release-linux
|
||||
release-linux:
|
||||
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/karalabe/xgo; \
|
||||
fi
|
||||
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/*' -out gitea-$(VERSION) .
|
||||
ifeq ($(CI),drone)
|
||||
mv /build/* $(DIST)/binaries
|
||||
endif
|
||||
|
||||
.PHONY: release-darwin
|
||||
release-darwin:
|
||||
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/karalabe/xgo; \
|
||||
fi
|
||||
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out gitea-$(VERSION) .
|
||||
ifeq ($(CI),drone)
|
||||
mv /build/* $(DIST)/binaries
|
||||
endif
|
||||
@@ -123,12 +261,64 @@ javascripts: public/js/index.js
|
||||
public/js/index.js: $(JAVASCRIPTS)
|
||||
cat $< >| $@
|
||||
|
||||
.PHONY: stylesheets-check
|
||||
stylesheets-check: stylesheets
|
||||
@diff=$$(git diff public/css/index.css); \
|
||||
if [ -n "$$diff" ]; then \
|
||||
echo "Please run 'make stylesheets' and commit the result:"; \
|
||||
echo "$${diff}"; \
|
||||
exit 1; \
|
||||
fi;
|
||||
|
||||
.PHONY: stylesheets
|
||||
stylesheets: public/css/index.css
|
||||
|
||||
.IGNORE: public/css/index.css
|
||||
public/css/index.css: $(STYLESHEETS)
|
||||
lessc $< $@
|
||||
@which lessc > /dev/null; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/kib357/less-go/lessc; \
|
||||
fi
|
||||
lessc -i $< -o $@
|
||||
|
||||
.PHONY: assets
|
||||
assets: javascripts stylesheets
|
||||
.PHONY: swagger-ui
|
||||
swagger-ui:
|
||||
rm -Rf public/vendor/assets/swagger-ui
|
||||
git clone --depth=10 -b v3.0.7 --single-branch https://github.com/swagger-api/swagger-ui.git $(TMPDIR)/swagger-ui
|
||||
mv $(TMPDIR)/swagger-ui/dist public/vendor/assets/swagger-ui
|
||||
rm -Rf $(TMPDIR)/swagger-ui
|
||||
$(SED_INPLACE) "s;http://petstore.swagger.io/v2/swagger.json;../../swagger.v1.json;g" public/assets/swagger-ui/index.html
|
||||
|
||||
.PHONY: update-translations
|
||||
update-translations:
|
||||
mkdir -p ./translations
|
||||
cd ./translations && curl -L https://crowdin.com/download/project/gitea.zip > gitea.zip && unzip gitea.zip
|
||||
rm ./translations/gitea.zip
|
||||
$(SED_INPLACE) -e 's/="/=/g' -e 's/"$$//g' ./translations/*.ini
|
||||
$(SED_INPLACE) -e 's/\\"/"/g' ./translations/*.ini
|
||||
mv ./translations/*.ini ./options/locale/
|
||||
rmdir ./translations
|
||||
|
||||
.PHONY: generate-images
|
||||
generate-images:
|
||||
mkdir -p $(TMPDIR)/images
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 880 -h 880 -e $(PWD)/public/img/gitea-lg.png
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 120 -h 120 -jC -i layer1 -e $(TMPDIR)/images/sm-1.png
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 120 -h 120 -jC -i layer2 -e $(TMPDIR)/images/sm-2.png
|
||||
composite -compose atop $(TMPDIR)/images/sm-2.png $(TMPDIR)/images/sm-1.png $(PWD)/public/img/gitea-sm.png
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 200 -h 200 -e $(PWD)/public/img/avatar_default.png
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 180 -h 180 -e $(PWD)/public/img/favicon.png
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 128 -h 128 -e $(TMPDIR)/images/128-raw.png
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 64 -h 64 -e $(TMPDIR)/images/64-raw.png
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 32 -h 32 -jC -i layer1 -e $(TMPDIR)/images/32-1.png
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 32 -h 32 -jC -i layer2 -e $(TMPDIR)/images/32-2.png
|
||||
composite -compose atop $(TMPDIR)/images/32-2.png $(TMPDIR)/images/32-1.png $(TMPDIR)/images/32-raw.png
|
||||
inkscape -f $(PWD)/assets/logo.svg -w 16 -h 16 -jC -i layer1 -e $(TMPDIR)/images/16-raw.png
|
||||
zopflipng $(TMPDIR)/images/128-raw.png $(TMPDIR)/images/128.png
|
||||
zopflipng $(TMPDIR)/images/64-raw.png $(TMPDIR)/images/64.png
|
||||
zopflipng $(TMPDIR)/images/32-raw.png $(TMPDIR)/images/32.png
|
||||
zopflipng $(TMPDIR)/images/16-raw.png $(TMPDIR)/images/16.png
|
||||
rm -f $(TMPDIR)/images/*-*.png
|
||||
convert $(TMPDIR)/images/16.png $(TMPDIR)/images/32.png \
|
||||
$(TMPDIR)/images/64.png $(TMPDIR)/images/128.png \
|
||||
$(PWD)/public/img/favicon.ico
|
||||
rm -rf $(TMPDIR)/images
|
||||
|
20
README.md
20
README.md
@@ -2,24 +2,24 @@
|
||||
|
||||
# Gitea - Git with a cup of tea
|
||||
|
||||
[](http://drone.gitea.io/go-gitea/gitea)
|
||||
[](https://gitter.im/go-gitea/gitea?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](http://microbadger.com/images/gitea/gitea "Get your own image badge on microbadger.com")
|
||||
[](https://drone.gitea.io/go-gitea/gitea)
|
||||
[](https://discord.gg/NsatcWJ)
|
||||
[](https://matrix.to/#/#gitea:matrix.org)
|
||||
[](https://microbadger.com/images/gitea/gitea "Get your own image badge on microbadger.com")
|
||||
[](https://coverage.gitea.io/go-gitea/gitea)
|
||||
[](https://goreportcard.com/report/code.gitea.io/gitea)
|
||||
[](https://godoc.org/code.gitea.io/gitea)
|
||||
[](https://github.com/go-gitea/gitea/releases/latest)
|
||||
[](https://github.com/go-gitea/gitea/releases/latest)
|
||||
|
||||
||||
|
||||
|:-------------:|:-------:|:-------:|
|
||||
| | | |
|
||||
|:---:|:---:|:---:|
|
||||
||||
|
||||
||||
|
||||
||||
|
||||
||||
|
||||
|
||||
## Purpose
|
||||
|
||||
The goal of this project is to make the easiest, fastest, and most painless way of setting up a self-hosted Git service. With Go, this can be done with an independent binary distribution across **all platforms** that Go supports, including Linux, macOS, and Windows on x86, amd64, ARM and PowerPC architectures. Want to try it before doing anything else? Do it [online](https://try.gitea.io/)!
|
||||
The goal of this project is to make the easiest, fastest, and most painless way of setting up a self-hosted Git service. Using Go, this can be done with an independent binary distribution across **all platforms** which Go supports, including Linux, macOS, and Windows on x86, amd64, ARM and PowerPC architectures. Want to try it before doing anything else? Do it [with the online demo](https://try.gitea.io/)! This project has been [forked](https://blog.gitea.io/2016/12/welcome-to-gitea/) from [Gogs](https://gogs.io).
|
||||
|
||||
## Notes
|
||||
|
||||
@@ -29,7 +29,7 @@ The goal of this project is to make the easiest, fastest, and most painless way
|
||||
|
||||
## Docs
|
||||
|
||||
For further information or instructions how to install Gitea please take a look at our [documentation](https://docs.gitea.io/en-us/), if you can not find some specific information just head over to our [Gitter](https://gitter.im/go-gitea/gitea) channel to have a chat with us.
|
||||
For more information and instructions about how to install Gitea please look at our [documentation](https://docs.gitea.io/en-us/). If you cannot find some specific information, then head over to our [Discord server](https://discord.gg/NsatcWJ) or [Matrix room](https://matrix.to/#/#gitea:matrix.org) to chat with us or use the [forum](https://discourse.gitea.io/).
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -43,4 +43,4 @@ Fork -> Patch -> Push -> Pull Request
|
||||
|
||||
## License
|
||||
|
||||
This project is under the MIT License. See the [LICENSE](https://github.com/go-gitea/gitea/blob/master/LICENSE) file for the full license text.
|
||||
This project is licensed under the MIT License. See the [LICENSE](https://github.com/go-gitea/gitea/blob/master/LICENSE) file for the full license text.
|
||||
|
15
README_ZH.md
15
README_ZH.md
@@ -2,20 +2,19 @@
|
||||
|
||||
# Gitea - Git with a cup of tea
|
||||
|
||||
[](http://drone.gitea.io/go-gitea/gitea)
|
||||
[](https://gitter.im/go-gitea/gitea?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](http://microbadger.com/images/gitea/gitea "Get your own image badge on microbadger.com")
|
||||
[](https://drone.gitea.io/go-gitea/gitea)
|
||||
[](https://discord.gg/NsatcWJ)
|
||||
[](https://microbadger.com/images/gitea/gitea "Get your own image badge on microbadger.com")
|
||||
[](https://coverage.gitea.io/go-gitea/gitea)
|
||||
[](https://goreportcard.com/report/code.gitea.io/gitea)
|
||||
[](https://godoc.org/code.gitea.io/gitea)
|
||||
[](https://github.com/go-gitea/gitea/releases/latest)
|
||||
[](https://github.com/go-gitea/gitea/releases/latest)
|
||||
|
||||
||||
|
||||
|:-------------:|:-------:|:-------:|
|
||||
| | | |
|
||||
|:---:|:---:|:---:|
|
||||
||||
|
||||
||||
|
||||
||||
|
||||
||||
|
||||
|
||||
## 目标
|
||||
|
||||
@@ -31,7 +30,7 @@ Gitea的首要目标是创建一个极易安装,运行非常快速,安装和
|
||||
|
||||
## 文档
|
||||
|
||||
关于如何安装请访问我们的 [文档站](https://docs.gitea.io/zh-cn/),如果没有找到对应的文档,你也可以通过 [Gitter - 英文](https://gitter.im/go-gitea/gitea) 和 QQ群 328432459 来和我们交流。
|
||||
关于如何安装请访问我们的 [文档站](https://docs.gitea.io/zh-cn/),如果没有找到对应的文档,你也可以通过 [Discord - 英文](https://discord.gg/NsatcWJ) 和 QQ群 328432459 来和我们交流。
|
||||
|
||||
## 贡献流程
|
||||
|
||||
|
160
assets/logo.svg
Normal file
160
assets/logo.svg
Normal file
@@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="512"
|
||||
height="512"
|
||||
viewBox="0 0 135.46667 135.46667"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
sodipodi:docname="logo.svg"
|
||||
inkscape:version="0.92.1 r15371"
|
||||
inkscape:export-filename=""
|
||||
inkscape:export-xdpi="48.000004"
|
||||
inkscape:export-ydpi="48.000004">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.70710678"
|
||||
inkscape:cx="418.13805"
|
||||
inkscape:cy="177.57445"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer2"
|
||||
showgrid="false"
|
||||
units="px"
|
||||
width="256px"
|
||||
showguides="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1137"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:pagecheckerboard="false"
|
||||
inkscape:measure-start="283.373,243.952"
|
||||
inkscape:measure-end="290.267,236.527">
|
||||
<sodipodi:guide
|
||||
position="0,0"
|
||||
orientation="0,512"
|
||||
id="guide3699"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="135.46667,0"
|
||||
orientation="-512,0"
|
||||
id="guide3701"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="135.46667,135.46667"
|
||||
orientation="0,-512"
|
||||
id="guide3703"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="0,135.46667"
|
||||
orientation="512,0"
|
||||
id="guide3705"
|
||||
inkscape:locked="false" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-161.53334)"
|
||||
style="display:inline">
|
||||
<path
|
||||
style="fill:#609926;fill-opacity:1;stroke:#428f29;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="m 27.709937,195.15095 c -9.546573,-0.0272 -22.3392732,6.79805 -21.6317552,23.90397 1.105534,26.72889 25.4565952,29.20839 35.1916502,29.42301 1.068023,5.01357 12.521798,22.30563 21.001818,23.21667 h 37.15277 c 22.27763,-1.66785 38.9607,-75.75671 26.59321,-76.03825 -46.781583,2.47691 -49.995146,2.13838 -88.599758,0 -2.495053,-0.0266 -5.972321,-0.49474 -9.707935,-0.5054 z m 2.491319,9.45886 c 1.351378,13.69267 3.555849,21.70359 8.018216,33.94345 -11.382872,-1.50473 -21.069822,-5.22443 -22.851515,-19.10984 -0.950962,-7.4112 2.390428,-15.16769 14.833299,-14.83361 z"
|
||||
id="path3722"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="sscccccsccsc" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="Layer 2"
|
||||
style="display:inline">
|
||||
<rect
|
||||
style="display:inline;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.24757317;stroke-opacity:1"
|
||||
id="rect4599"
|
||||
width="34.762054"
|
||||
height="34.762054"
|
||||
x="87.508659"
|
||||
y="18.291576"
|
||||
transform="rotate(25.914715)"
|
||||
ry="5.4825778" />
|
||||
<path
|
||||
style="display:inline;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26644793px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 79.804947,57.359056 3.241146,1.609954 V 35.255731 h -3.262698 z"
|
||||
id="path4525"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer3"
|
||||
inkscape:label="Layer 3"
|
||||
style="display:inline">
|
||||
<g
|
||||
style="display:inline"
|
||||
id="g4539">
|
||||
<circle
|
||||
transform="rotate(-19.796137)"
|
||||
r="3.4745038"
|
||||
cy="90.077766"
|
||||
cx="49.064713"
|
||||
id="path4606"
|
||||
style="fill:#609926;fill-opacity:1;stroke:none;stroke-width:0.26458332;stroke-opacity:1" />
|
||||
<circle
|
||||
transform="rotate(-19.796137)"
|
||||
r="3.4745038"
|
||||
cy="102.1049"
|
||||
cx="36.810425"
|
||||
id="path4606-3"
|
||||
style="fill:#609926;fill-opacity:1;stroke:none;stroke-width:0.26458332;stroke-opacity:1" />
|
||||
<circle
|
||||
transform="rotate(-19.796137)"
|
||||
r="3.4745038"
|
||||
cy="111.43928"
|
||||
cx="46.484283"
|
||||
id="path4606-1"
|
||||
style="fill:#609926;fill-opacity:1;stroke:none;stroke-width:0.26458332;stroke-opacity:1" />
|
||||
<rect
|
||||
transform="rotate(26.024158)"
|
||||
y="18.061695"
|
||||
x="97.333458"
|
||||
height="27.261492"
|
||||
width="2.6726954"
|
||||
id="rect4629-8"
|
||||
style="fill:#609926;fill-opacity:1;stroke:none;stroke-width:0.27444693;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4514"
|
||||
d="m 76.558096,68.116343 c 12.97589,6.395378 13.012989,4.101862 4.890858,20.907244"
|
||||
style="fill:none;stroke:#609926;stroke-width:2.68000007;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 5.6 KiB |
64
cmd/admin.go
64
cmd/admin.go
@@ -8,21 +8,22 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var (
|
||||
// CmdAdmin represents the available admin sub-command.
|
||||
CmdAdmin = cli.Command{
|
||||
Name: "admin",
|
||||
Usage: "Preform admin operations on command line",
|
||||
Usage: "Perform admin operations on command line",
|
||||
Description: `Allow using internal logic of Gitea without hacking into the source code
|
||||
to make automatic initialization process more smoothly`,
|
||||
Subcommands: []cli.Command{
|
||||
subcmdCreateUser,
|
||||
subcmdChangePassword,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -57,8 +58,59 @@ to make automatic initialization process more smoothly`,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
subcmdChangePassword = cli.Command{
|
||||
Name: "change-password",
|
||||
Usage: "Change a user's password",
|
||||
Action: runChangePassword,
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "username,u",
|
||||
Value: "",
|
||||
Usage: "The user to change password for",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "password,p",
|
||||
Value: "",
|
||||
Usage: "New password to set for user",
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func runChangePassword(c *cli.Context) error {
|
||||
if !c.IsSet("password") {
|
||||
return fmt.Errorf("Password is not specified")
|
||||
} else if !c.IsSet("username") {
|
||||
return fmt.Errorf("Username is not specified")
|
||||
}
|
||||
|
||||
setting.NewContext()
|
||||
models.LoadConfigs()
|
||||
|
||||
setting.NewXORMLogService(false)
|
||||
if err := models.SetEngine(); err != nil {
|
||||
return fmt.Errorf("models.SetEngine: %v", err)
|
||||
}
|
||||
|
||||
uname := c.String("username")
|
||||
user, err := models.GetUserByName(uname)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%v", err)
|
||||
}
|
||||
user.Passwd = c.String("password")
|
||||
if user.Salt, err = models.GetUserSalt(); err != nil {
|
||||
return fmt.Errorf("%v", err)
|
||||
}
|
||||
user.EncodePasswd()
|
||||
if err := models.UpdateUserCols(user, "passwd", "salt"); err != nil {
|
||||
return fmt.Errorf("%v", err)
|
||||
}
|
||||
|
||||
fmt.Printf("User '%s' password has been successfully updated!\n", uname)
|
||||
return nil
|
||||
}
|
||||
|
||||
func runCreateUser(c *cli.Context) error {
|
||||
if !c.IsSet("name") {
|
||||
return fmt.Errorf("Username is not specified")
|
||||
@@ -74,7 +126,11 @@ func runCreateUser(c *cli.Context) error {
|
||||
|
||||
setting.NewContext()
|
||||
models.LoadConfigs()
|
||||
models.SetEngine()
|
||||
|
||||
setting.NewXORMLogService(false)
|
||||
if err := models.SetEngine(); err != nil {
|
||||
return fmt.Errorf("models.SetEngine: %v", err)
|
||||
}
|
||||
|
||||
if err := models.CreateUser(&models.User{
|
||||
Name: c.String("name"),
|
||||
|
14
cmd/cert.go
14
cmd/cert.go
@@ -82,7 +82,7 @@ func pemBlockForKey(priv interface{}) *pem.Block {
|
||||
case *ecdsa.PrivateKey:
|
||||
b, err := x509.MarshalECPrivateKey(k)
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to marshal ECDSA private key: %v\n", err)
|
||||
log.Fatalf("Unable to marshal ECDSA private key: %v", err)
|
||||
}
|
||||
return &pem.Block{Type: "EC PRIVATE KEY", Bytes: b}
|
||||
default:
|
||||
@@ -112,7 +112,7 @@ func runCert(ctx *cli.Context) error {
|
||||
log.Fatalf("Unrecognized elliptic curve: %q", ctx.String("ecdsa-curve"))
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to generate private key: %s", err)
|
||||
log.Fatalf("Failed to generate private key: %v", err)
|
||||
}
|
||||
|
||||
var notBefore time.Time
|
||||
@@ -121,7 +121,7 @@ func runCert(ctx *cli.Context) error {
|
||||
} else {
|
||||
notBefore, err = time.Parse("Jan 2 15:04:05 2006", ctx.String("start-date"))
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to parse creation date: %s", err)
|
||||
log.Fatalf("Failed to parse creation date: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ func runCert(ctx *cli.Context) error {
|
||||
serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
|
||||
serialNumber, err := rand.Int(rand.Reader, serialNumberLimit)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to generate serial number: %s", err)
|
||||
log.Fatalf("Failed to generate serial number: %v", err)
|
||||
}
|
||||
|
||||
template := x509.Certificate{
|
||||
@@ -163,12 +163,12 @@ func runCert(ctx *cli.Context) error {
|
||||
|
||||
derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(priv), priv)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create certificate: %s", err)
|
||||
log.Fatalf("Failed to create certificate: %v", err)
|
||||
}
|
||||
|
||||
certOut, err := os.Create("cert.pem")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to open cert.pem for writing: %s", err)
|
||||
log.Fatalf("Failed to open cert.pem for writing: %v", err)
|
||||
}
|
||||
pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes})
|
||||
certOut.Close()
|
||||
@@ -176,7 +176,7 @@ func runCert(ctx *cli.Context) error {
|
||||
|
||||
keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to open key.pem for writing: %v\n", err)
|
||||
log.Fatalf("Failed to open key.pem for writing: %v", err)
|
||||
}
|
||||
pem.Encode(keyOut, pemBlockForKey(priv))
|
||||
keyOut.Close()
|
||||
|
106
cmd/dump.go
106
cmd/dump.go
@@ -11,11 +11,14 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/Unknwon/cae/zip"
|
||||
"github.com/Unknwon/com"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -41,6 +44,10 @@ It can be used for backup and capture Gitea server image to send to maintainer`,
|
||||
Value: os.TempDir(),
|
||||
Usage: "Temporary dir path",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "database, d",
|
||||
Usage: "Specify the database SQL syntax",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -49,8 +56,13 @@ func runDump(ctx *cli.Context) error {
|
||||
setting.CustomConf = ctx.String("config")
|
||||
}
|
||||
setting.NewContext()
|
||||
setting.NewServices() // cannot access session settings otherwise
|
||||
models.LoadConfigs()
|
||||
models.SetEngine()
|
||||
|
||||
err := models.SetEngine()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tmpDir := ctx.String("tempdir")
|
||||
if _, err := os.Stat(tmpDir); os.IsNotExist(err) {
|
||||
@@ -58,52 +70,79 @@ func runDump(ctx *cli.Context) error {
|
||||
}
|
||||
TmpWorkDir, err := ioutil.TempDir(tmpDir, "gitea-dump-")
|
||||
if err != nil {
|
||||
log.Fatalf("Fail to create tmp work directory: %v", err)
|
||||
log.Fatalf("Failed to create tmp work directory: %v", err)
|
||||
}
|
||||
log.Printf("Creating tmp work dir: %s", TmpWorkDir)
|
||||
|
||||
// work-around #1103
|
||||
if os.Getenv("TMPDIR") == "" {
|
||||
os.Setenv("TMPDIR", TmpWorkDir)
|
||||
}
|
||||
|
||||
reposDump := path.Join(TmpWorkDir, "gitea-repo.zip")
|
||||
dbDump := path.Join(TmpWorkDir, "gitea-db.sql")
|
||||
|
||||
log.Printf("Dumping local repositories...%s", setting.RepoRootPath)
|
||||
zip.Verbose = ctx.Bool("verbose")
|
||||
if err := zip.PackTo(setting.RepoRootPath, reposDump, true); err != nil {
|
||||
log.Fatalf("Fail to dump local repositories: %v", err)
|
||||
log.Fatalf("Failed to dump local repositories: %v", err)
|
||||
}
|
||||
|
||||
log.Printf("Dumping database...")
|
||||
if err := models.DumpDatabase(dbDump); err != nil {
|
||||
log.Fatalf("Fail to dump database: %v", err)
|
||||
targetDBType := ctx.String("database")
|
||||
if len(targetDBType) > 0 && targetDBType != models.DbCfg.Type {
|
||||
log.Printf("Dumping database %s => %s...", models.DbCfg.Type, targetDBType)
|
||||
} else {
|
||||
log.Printf("Dumping database...")
|
||||
}
|
||||
|
||||
if err := models.DumpDatabase(dbDump, targetDBType); err != nil {
|
||||
log.Fatalf("Failed to dump database: %v", err)
|
||||
}
|
||||
|
||||
fileName := fmt.Sprintf("gitea-dump-%d.zip", time.Now().Unix())
|
||||
log.Printf("Packing dump files...")
|
||||
z, err := zip.Create(fileName)
|
||||
if err != nil {
|
||||
log.Fatalf("Fail to create %s: %v", fileName, err)
|
||||
log.Fatalf("Failed to create %s: %v", fileName, err)
|
||||
}
|
||||
|
||||
if err := z.AddFile("gitea-repo.zip", reposDump); err != nil {
|
||||
log.Fatalf("Fail to include gitea-repo.zip: %v", err)
|
||||
log.Fatalf("Failed to include gitea-repo.zip: %v", err)
|
||||
}
|
||||
if err := z.AddFile("gitea-db.sql", dbDump); err != nil {
|
||||
log.Fatalf("Fail to include gitea-db.sql: %v", err)
|
||||
log.Fatalf("Failed to include gitea-db.sql: %v", err)
|
||||
}
|
||||
customDir, err := os.Stat(setting.CustomPath)
|
||||
if err == nil && customDir.IsDir() {
|
||||
if err := z.AddDir("custom", setting.CustomPath); err != nil {
|
||||
log.Fatalf("Fail to include custom: %v", err)
|
||||
log.Fatalf("Failed to include custom: %v", err)
|
||||
}
|
||||
} else {
|
||||
log.Printf("Custom dir %s doesn't exist, skipped", setting.CustomPath)
|
||||
}
|
||||
if err := z.AddDir("log", setting.LogRootPath); err != nil {
|
||||
log.Fatalf("Fail to include log: %v", err)
|
||||
|
||||
if com.IsExist(setting.AppDataPath) {
|
||||
log.Printf("Packing data directory...%s", setting.AppDataPath)
|
||||
|
||||
var sessionAbsPath string
|
||||
if setting.SessionConfig.Provider == "file" {
|
||||
if len(setting.SessionConfig.ProviderConfig) == 0 {
|
||||
setting.SessionConfig.ProviderConfig = "data/sessions"
|
||||
}
|
||||
sessionAbsPath, _ = filepath.Abs(setting.SessionConfig.ProviderConfig)
|
||||
}
|
||||
if err := zipAddDirectoryExclude(z, "data", setting.AppDataPath, sessionAbsPath); err != nil {
|
||||
log.Fatalf("Failed to include data directory: %v", err)
|
||||
}
|
||||
}
|
||||
// FIXME: SSH key file.
|
||||
|
||||
if err := z.AddDir("log", setting.LogRootPath); err != nil {
|
||||
log.Fatalf("Failed to include log: %v", err)
|
||||
}
|
||||
|
||||
if err = z.Close(); err != nil {
|
||||
_ = os.Remove(fileName)
|
||||
log.Fatalf("Fail to save %s: %v", fileName, err)
|
||||
log.Fatalf("Failed to save %s: %v", fileName, err)
|
||||
}
|
||||
|
||||
if err := os.Chmod(fileName, 0600); err != nil {
|
||||
@@ -113,9 +152,46 @@ func runDump(ctx *cli.Context) error {
|
||||
log.Printf("Removing tmp work dir: %s", TmpWorkDir)
|
||||
|
||||
if err := os.RemoveAll(TmpWorkDir); err != nil {
|
||||
log.Fatalf("Fail to remove %s: %v", TmpWorkDir, err)
|
||||
log.Fatalf("Failed to remove %s: %v", TmpWorkDir, err)
|
||||
}
|
||||
log.Printf("Finish dumping in file %s", fileName)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// zipAddDirectoryExclude zips absPath to specified zipPath inside z excluding excludeAbsPath
|
||||
func zipAddDirectoryExclude(zip *zip.ZipArchive, zipPath, absPath string, excludeAbsPath string) error {
|
||||
absPath, err := filepath.Abs(absPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dir, err := os.Open(absPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer dir.Close()
|
||||
|
||||
zip.AddEmptyDir(zipPath)
|
||||
|
||||
files, err := dir.Readdir(0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, file := range files {
|
||||
currentAbsPath := path.Join(absPath, file.Name())
|
||||
currentZipPath := path.Join(zipPath, file.Name())
|
||||
if file.IsDir() {
|
||||
if currentAbsPath != excludeAbsPath {
|
||||
if err = zipAddDirectoryExclude(zip, currentZipPath, currentAbsPath, excludeAbsPath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if err = zip.AddFile(currentZipPath, currentAbsPath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
213
cmd/hook.go
Normal file
213
cmd/hook.go
Normal file
@@ -0,0 +1,213 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/git"
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/private"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var (
|
||||
// CmdHook represents the available hooks sub-command.
|
||||
CmdHook = cli.Command{
|
||||
Name: "hook",
|
||||
Usage: "Delegate commands to corresponding Git hooks",
|
||||
Description: "This should only be called by Git",
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "config, c",
|
||||
Value: "custom/conf/app.ini",
|
||||
Usage: "Custom configuration file path",
|
||||
},
|
||||
},
|
||||
Subcommands: []cli.Command{
|
||||
subcmdHookPreReceive,
|
||||
subcmdHookUpadte,
|
||||
subcmdHookPostReceive,
|
||||
},
|
||||
}
|
||||
|
||||
subcmdHookPreReceive = cli.Command{
|
||||
Name: "pre-receive",
|
||||
Usage: "Delegate pre-receive Git hook",
|
||||
Description: "This command should only be called by Git",
|
||||
Action: runHookPreReceive,
|
||||
}
|
||||
subcmdHookUpadte = cli.Command{
|
||||
Name: "update",
|
||||
Usage: "Delegate update Git hook",
|
||||
Description: "This command should only be called by Git",
|
||||
Action: runHookUpdate,
|
||||
}
|
||||
subcmdHookPostReceive = cli.Command{
|
||||
Name: "post-receive",
|
||||
Usage: "Delegate post-receive Git hook",
|
||||
Description: "This command should only be called by Git",
|
||||
Action: runHookPostReceive,
|
||||
}
|
||||
)
|
||||
|
||||
func hookSetup(logPath string) {
|
||||
setting.NewContext()
|
||||
log.NewGitLogger(filepath.Join(setting.LogRootPath, logPath))
|
||||
models.LoadConfigs()
|
||||
}
|
||||
|
||||
func runHookPreReceive(c *cli.Context) error {
|
||||
if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if c.IsSet("config") {
|
||||
setting.CustomConf = c.String("config")
|
||||
} else if c.GlobalIsSet("config") {
|
||||
setting.CustomConf = c.GlobalString("config")
|
||||
}
|
||||
|
||||
hookSetup("hooks/pre-receive.log")
|
||||
|
||||
// the environment setted on serv command
|
||||
repoID, _ := strconv.ParseInt(os.Getenv(models.ProtectedBranchRepoID), 10, 64)
|
||||
isWiki := (os.Getenv(models.EnvRepoIsWiki) == "true")
|
||||
//username := os.Getenv(models.EnvRepoUsername)
|
||||
//reponame := os.Getenv(models.EnvRepoName)
|
||||
//repoPath := models.RepoPath(username, reponame)
|
||||
|
||||
buf := bytes.NewBuffer(nil)
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
buf.Write(scanner.Bytes())
|
||||
buf.WriteByte('\n')
|
||||
|
||||
// TODO: support news feeds for wiki
|
||||
if isWiki {
|
||||
continue
|
||||
}
|
||||
|
||||
fields := bytes.Fields(scanner.Bytes())
|
||||
if len(fields) != 3 {
|
||||
continue
|
||||
}
|
||||
|
||||
//oldCommitID := string(fields[0])
|
||||
newCommitID := string(fields[1])
|
||||
refFullName := string(fields[2])
|
||||
|
||||
// FIXME: when we add feature to protected branch to deny force push, then uncomment below
|
||||
/*var isForce bool
|
||||
// detect force push
|
||||
if git.EmptySHA != oldCommitID {
|
||||
output, err := git.NewCommand("rev-list", oldCommitID, "^"+newCommitID).RunInDir(repoPath)
|
||||
if err != nil {
|
||||
fail("Internal error", "Fail to detect force push: %v", err)
|
||||
} else if len(output) > 0 {
|
||||
isForce = true
|
||||
}
|
||||
}*/
|
||||
|
||||
branchName := strings.TrimPrefix(refFullName, git.BranchPrefix)
|
||||
protectBranch, err := private.GetProtectedBranchBy(repoID, branchName)
|
||||
if err != nil {
|
||||
log.GitLogger.Fatal(2, "retrieve protected branches information failed")
|
||||
}
|
||||
|
||||
if protectBranch != nil && protectBranch.IsProtected() {
|
||||
// check and deletion
|
||||
if newCommitID == git.EmptySHA {
|
||||
fail(fmt.Sprintf("branch %s is protected from deletion", branchName), "")
|
||||
} else if !protectBranch.CanPush {
|
||||
fail(fmt.Sprintf("protected branch %s can not be pushed to", branchName), "")
|
||||
//fail(fmt.Sprintf("branch %s is protected from force push", branchName), "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func runHookUpdate(c *cli.Context) error {
|
||||
if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if c.IsSet("config") {
|
||||
setting.CustomConf = c.String("config")
|
||||
} else if c.GlobalIsSet("config") {
|
||||
setting.CustomConf = c.GlobalString("config")
|
||||
}
|
||||
|
||||
hookSetup("hooks/update.log")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func runHookPostReceive(c *cli.Context) error {
|
||||
if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if c.IsSet("config") {
|
||||
setting.CustomConf = c.String("config")
|
||||
} else if c.GlobalIsSet("config") {
|
||||
setting.CustomConf = c.GlobalString("config")
|
||||
}
|
||||
|
||||
hookSetup("hooks/post-receive.log")
|
||||
|
||||
// the environment setted on serv command
|
||||
repoUser := os.Getenv(models.EnvRepoUsername)
|
||||
isWiki := (os.Getenv(models.EnvRepoIsWiki) == "true")
|
||||
repoName := os.Getenv(models.EnvRepoName)
|
||||
pusherID, _ := strconv.ParseInt(os.Getenv(models.EnvPusherID), 10, 64)
|
||||
pusherName := os.Getenv(models.EnvPusherName)
|
||||
|
||||
buf := bytes.NewBuffer(nil)
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
buf.Write(scanner.Bytes())
|
||||
buf.WriteByte('\n')
|
||||
|
||||
// TODO: support news feeds for wiki
|
||||
if isWiki {
|
||||
continue
|
||||
}
|
||||
|
||||
fields := bytes.Fields(scanner.Bytes())
|
||||
if len(fields) != 3 {
|
||||
continue
|
||||
}
|
||||
|
||||
oldCommitID := string(fields[0])
|
||||
newCommitID := string(fields[1])
|
||||
refFullName := string(fields[2])
|
||||
|
||||
if err := private.PushUpdate(models.PushUpdateOptions{
|
||||
RefFullName: refFullName,
|
||||
OldCommitID: oldCommitID,
|
||||
NewCommitID: newCommitID,
|
||||
PusherID: pusherID,
|
||||
PusherName: pusherName,
|
||||
RepoUserName: repoUser,
|
||||
RepoName: repoName,
|
||||
}); err != nil {
|
||||
log.GitLogger.Error(2, "Update: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
334
cmd/serv.go
Normal file
334
cmd/serv.go
Normal file
@@ -0,0 +1,334 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/private"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/Unknwon/com"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
const (
|
||||
accessDenied = "Repository does not exist or you do not have access"
|
||||
lfsAuthenticateVerb = "git-lfs-authenticate"
|
||||
)
|
||||
|
||||
// CmdServ represents the available serv sub-command.
|
||||
var CmdServ = cli.Command{
|
||||
Name: "serv",
|
||||
Usage: "This command should only be called by SSH shell",
|
||||
Description: `Serv provide access auth for repositories`,
|
||||
Action: runServ,
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "config, c",
|
||||
Value: "custom/conf/app.ini",
|
||||
Usage: "Custom configuration file path",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func setup(logPath string) error {
|
||||
setting.NewContext()
|
||||
log.NewGitLogger(filepath.Join(setting.LogRootPath, logPath))
|
||||
models.LoadConfigs()
|
||||
|
||||
if setting.UseSQLite3 || setting.UseTiDB {
|
||||
workDir, _ := setting.WorkDir()
|
||||
if err := os.Chdir(workDir); err != nil {
|
||||
log.GitLogger.Fatal(4, "Failed to change directory %s: %v", workDir, err)
|
||||
}
|
||||
}
|
||||
|
||||
setting.NewXORMLogService(true)
|
||||
return models.SetEngine()
|
||||
}
|
||||
|
||||
func parseCmd(cmd string) (string, string) {
|
||||
ss := strings.SplitN(cmd, " ", 2)
|
||||
if len(ss) != 2 {
|
||||
return "", ""
|
||||
}
|
||||
return ss[0], strings.Replace(ss[1], "'/", "'", 1)
|
||||
}
|
||||
|
||||
var (
|
||||
allowedCommands = map[string]models.AccessMode{
|
||||
"git-upload-pack": models.AccessModeRead,
|
||||
"git-upload-archive": models.AccessModeRead,
|
||||
"git-receive-pack": models.AccessModeWrite,
|
||||
lfsAuthenticateVerb: models.AccessModeNone,
|
||||
}
|
||||
)
|
||||
|
||||
func fail(userMessage, logMessage string, args ...interface{}) {
|
||||
fmt.Fprintln(os.Stderr, "Gitea:", userMessage)
|
||||
|
||||
if len(logMessage) > 0 {
|
||||
if !setting.ProdMode {
|
||||
fmt.Fprintf(os.Stderr, logMessage+"\n", args...)
|
||||
}
|
||||
log.GitLogger.Fatal(3, logMessage, args...)
|
||||
return
|
||||
}
|
||||
|
||||
log.GitLogger.Close()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func runServ(c *cli.Context) error {
|
||||
if c.IsSet("config") {
|
||||
setting.CustomConf = c.String("config")
|
||||
}
|
||||
|
||||
if err := setup("serv.log"); err != nil {
|
||||
fail("System init failed", fmt.Sprintf("setup: %v", err))
|
||||
}
|
||||
|
||||
if setting.SSH.Disabled {
|
||||
println("Gitea: SSH has been disabled")
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(c.Args()) < 1 {
|
||||
cli.ShowSubcommandHelp(c)
|
||||
return nil
|
||||
}
|
||||
|
||||
cmd := os.Getenv("SSH_ORIGINAL_COMMAND")
|
||||
if len(cmd) == 0 {
|
||||
println("Hi there, You've successfully authenticated, but Gitea does not provide shell access.")
|
||||
println("If this is unexpected, please log in with password and setup Gitea under another user.")
|
||||
return nil
|
||||
}
|
||||
|
||||
verb, args := parseCmd(cmd)
|
||||
|
||||
var lfsVerb string
|
||||
if verb == lfsAuthenticateVerb {
|
||||
if !setting.LFS.StartServer {
|
||||
fail("Unknown git command", "LFS authentication request over SSH denied, LFS support is disabled")
|
||||
}
|
||||
|
||||
argsSplit := strings.Split(args, " ")
|
||||
if len(argsSplit) >= 2 {
|
||||
args = strings.TrimSpace(argsSplit[0])
|
||||
lfsVerb = strings.TrimSpace(argsSplit[1])
|
||||
}
|
||||
}
|
||||
|
||||
repoPath := strings.ToLower(strings.Trim(args, "'"))
|
||||
rr := strings.SplitN(repoPath, "/", 2)
|
||||
if len(rr) != 2 {
|
||||
fail("Invalid repository path", "Invalid repository path: %v", args)
|
||||
}
|
||||
|
||||
username := strings.ToLower(rr[0])
|
||||
reponame := strings.ToLower(strings.TrimSuffix(rr[1], ".git"))
|
||||
|
||||
isWiki := false
|
||||
unitType := models.UnitTypeCode
|
||||
if strings.HasSuffix(reponame, ".wiki") {
|
||||
isWiki = true
|
||||
unitType = models.UnitTypeWiki
|
||||
reponame = reponame[:len(reponame)-5]
|
||||
}
|
||||
|
||||
os.Setenv(models.EnvRepoUsername, username)
|
||||
if isWiki {
|
||||
os.Setenv(models.EnvRepoIsWiki, "true")
|
||||
} else {
|
||||
os.Setenv(models.EnvRepoIsWiki, "false")
|
||||
}
|
||||
os.Setenv(models.EnvRepoName, reponame)
|
||||
|
||||
repoUser, err := models.GetUserByName(username)
|
||||
if err != nil {
|
||||
if models.IsErrUserNotExist(err) {
|
||||
fail("Repository owner does not exist", "Unregistered owner: %s", username)
|
||||
}
|
||||
fail("Internal error", "Failed to get repository owner (%s): %v", username, err)
|
||||
}
|
||||
|
||||
repo, err := models.GetRepositoryByName(repoUser.ID, reponame)
|
||||
if err != nil {
|
||||
if models.IsErrRepoNotExist(err) {
|
||||
fail(accessDenied, "Repository does not exist: %s/%s", repoUser.Name, reponame)
|
||||
}
|
||||
fail("Internal error", "Failed to get repository: %v", err)
|
||||
}
|
||||
|
||||
requestedMode, has := allowedCommands[verb]
|
||||
if !has {
|
||||
fail("Unknown git command", "Unknown git command %s", verb)
|
||||
}
|
||||
|
||||
if verb == lfsAuthenticateVerb {
|
||||
if lfsVerb == "upload" {
|
||||
requestedMode = models.AccessModeWrite
|
||||
} else if lfsVerb == "download" {
|
||||
requestedMode = models.AccessModeRead
|
||||
} else {
|
||||
fail("Unknown LFS verb", "Unknown lfs verb %s", lfsVerb)
|
||||
}
|
||||
}
|
||||
|
||||
// Prohibit push to mirror repositories.
|
||||
if requestedMode > models.AccessModeRead && repo.IsMirror {
|
||||
fail("mirror repository is read-only", "")
|
||||
}
|
||||
|
||||
// Allow anonymous clone for public repositories.
|
||||
var (
|
||||
keyID int64
|
||||
user *models.User
|
||||
)
|
||||
if requestedMode == models.AccessModeWrite || repo.IsPrivate {
|
||||
keys := strings.Split(c.Args()[0], "-")
|
||||
if len(keys) != 2 {
|
||||
fail("Key ID format error", "Invalid key argument: %s", c.Args()[0])
|
||||
}
|
||||
|
||||
key, err := models.GetPublicKeyByID(com.StrTo(keys[1]).MustInt64())
|
||||
if err != nil {
|
||||
fail("Invalid key ID", "Invalid key ID[%s]: %v", c.Args()[0], err)
|
||||
}
|
||||
keyID = key.ID
|
||||
|
||||
// Check deploy key or user key.
|
||||
if key.Type == models.KeyTypeDeploy {
|
||||
if key.Mode < requestedMode {
|
||||
fail("Key permission denied", "Cannot push with deployment key: %d", key.ID)
|
||||
}
|
||||
// Check if this deploy key belongs to current repository.
|
||||
if !models.HasDeployKey(key.ID, repo.ID) {
|
||||
fail("Key access denied", "Deploy key access denied: [key_id: %d, repo_id: %d]", key.ID, repo.ID)
|
||||
}
|
||||
|
||||
// Update deploy key activity.
|
||||
deployKey, err := models.GetDeployKeyByRepo(key.ID, repo.ID)
|
||||
if err != nil {
|
||||
fail("Internal error", "GetDeployKey: %v", err)
|
||||
}
|
||||
|
||||
deployKey.Updated = time.Now()
|
||||
if err = models.UpdateDeployKey(deployKey); err != nil {
|
||||
fail("Internal error", "UpdateDeployKey: %v", err)
|
||||
}
|
||||
} else {
|
||||
user, err = models.GetUserByKeyID(key.ID)
|
||||
if err != nil {
|
||||
fail("internal error", "Failed to get user by key ID(%d): %v", keyID, err)
|
||||
}
|
||||
|
||||
mode, err := models.AccessLevel(user.ID, repo)
|
||||
if err != nil {
|
||||
fail("Internal error", "Failed to check access: %v", err)
|
||||
} else if mode < requestedMode {
|
||||
clientMessage := accessDenied
|
||||
if mode >= models.AccessModeRead {
|
||||
clientMessage = "You do not have sufficient authorization for this action"
|
||||
}
|
||||
fail(clientMessage,
|
||||
"User %s does not have level %v access to repository %s",
|
||||
user.Name, requestedMode, repoPath)
|
||||
}
|
||||
|
||||
if !repo.CheckUnitUser(user.ID, user.IsAdmin, unitType) {
|
||||
fail("You do not have allowed for this action",
|
||||
"User %s does not have allowed access to repository %s 's code",
|
||||
user.Name, repoPath)
|
||||
}
|
||||
|
||||
os.Setenv(models.EnvPusherName, user.Name)
|
||||
os.Setenv(models.EnvPusherID, fmt.Sprintf("%d", user.ID))
|
||||
}
|
||||
}
|
||||
|
||||
//LFS token authentication
|
||||
if verb == lfsAuthenticateVerb {
|
||||
url := fmt.Sprintf("%s%s/%s.git/info/lfs", setting.AppURL, repoUser.Name, repo.Name)
|
||||
|
||||
now := time.Now()
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
|
||||
"repo": repo.ID,
|
||||
"op": lfsVerb,
|
||||
"exp": now.Add(5 * time.Minute).Unix(),
|
||||
"nbf": now.Unix(),
|
||||
})
|
||||
|
||||
// Sign and get the complete encoded token as a string using the secret
|
||||
tokenString, err := token.SignedString(setting.LFS.JWTSecretBytes)
|
||||
if err != nil {
|
||||
fail("Internal error", "Failed to sign JWT token: %v", err)
|
||||
}
|
||||
|
||||
tokenAuthentication := &models.LFSTokenResponse{
|
||||
Header: make(map[string]string),
|
||||
Href: url,
|
||||
}
|
||||
tokenAuthentication.Header["Authorization"] = fmt.Sprintf("Bearer %s", tokenString)
|
||||
|
||||
enc := json.NewEncoder(os.Stdout)
|
||||
err = enc.Encode(tokenAuthentication)
|
||||
if err != nil {
|
||||
fail("Internal error", "Failed to encode LFS json response: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Special handle for Windows.
|
||||
if setting.IsWindows {
|
||||
verb = strings.Replace(verb, "-", " ", 1)
|
||||
}
|
||||
|
||||
var gitcmd *exec.Cmd
|
||||
verbs := strings.Split(verb, " ")
|
||||
if len(verbs) == 2 {
|
||||
gitcmd = exec.Command(verbs[0], verbs[1], repoPath)
|
||||
} else {
|
||||
gitcmd = exec.Command(verb, repoPath)
|
||||
}
|
||||
|
||||
if isWiki {
|
||||
if err = repo.InitWiki(); err != nil {
|
||||
fail("Internal error", "Failed to init wiki repo: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
os.Setenv(models.ProtectedBranchRepoID, fmt.Sprintf("%d", repo.ID))
|
||||
|
||||
gitcmd.Dir = setting.RepoRootPath
|
||||
gitcmd.Stdout = os.Stdout
|
||||
gitcmd.Stdin = os.Stdin
|
||||
gitcmd.Stderr = os.Stderr
|
||||
if err = gitcmd.Run(); err != nil {
|
||||
fail("Internal error", "Failed to execute git command: %v", err)
|
||||
}
|
||||
|
||||
// Update user key activity.
|
||||
if keyID > 0 {
|
||||
if err = private.UpdatePublicKeyUpdated(keyID); err != nil {
|
||||
fail("Internal error", "UpdatePublicKey: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
307
cmd/serve.go
307
cmd/serve.go
@@ -1,307 +0,0 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/git"
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/httplib"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"github.com/Unknwon/com"
|
||||
gouuid "github.com/satori/go.uuid"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
const (
|
||||
accessDenied = "Repository does not exist or you do not have access"
|
||||
)
|
||||
|
||||
// CmdServ represents the available serv sub-command.
|
||||
var CmdServ = cli.Command{
|
||||
Name: "serv",
|
||||
Usage: "This command should only be called by SSH shell",
|
||||
Description: `Serv provide access auth for repositories`,
|
||||
Action: runServ,
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "config, c",
|
||||
Value: "custom/conf/app.ini",
|
||||
Usage: "Custom configuration file path",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func setup(logPath string) {
|
||||
setting.NewContext()
|
||||
log.NewGitLogger(filepath.Join(setting.LogRootPath, logPath))
|
||||
|
||||
models.LoadConfigs()
|
||||
|
||||
if setting.UseSQLite3 || setting.UseTiDB {
|
||||
workDir, _ := setting.WorkDir()
|
||||
if err := os.Chdir(workDir); err != nil {
|
||||
log.GitLogger.Fatal(4, "Fail to change directory %s: %v", workDir, err)
|
||||
}
|
||||
}
|
||||
|
||||
models.SetEngine()
|
||||
}
|
||||
|
||||
func parseCmd(cmd string) (string, string) {
|
||||
ss := strings.SplitN(cmd, " ", 2)
|
||||
if len(ss) != 2 {
|
||||
return "", ""
|
||||
}
|
||||
return ss[0], strings.Replace(ss[1], "'/", "'", 1)
|
||||
}
|
||||
|
||||
var (
|
||||
allowedCommands = map[string]models.AccessMode{
|
||||
"git-upload-pack": models.AccessModeRead,
|
||||
"git-upload-archive": models.AccessModeRead,
|
||||
"git-receive-pack": models.AccessModeWrite,
|
||||
}
|
||||
)
|
||||
|
||||
func fail(userMessage, logMessage string, args ...interface{}) {
|
||||
fmt.Fprintln(os.Stderr, "Gitea:", userMessage)
|
||||
|
||||
if len(logMessage) > 0 {
|
||||
if !setting.ProdMode {
|
||||
fmt.Fprintf(os.Stderr, logMessage+"\n", args...)
|
||||
}
|
||||
log.GitLogger.Fatal(3, logMessage, args...)
|
||||
return
|
||||
}
|
||||
|
||||
log.GitLogger.Close()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func handleUpdateTask(uuid string, user, repoUser *models.User, reponame string, isWiki bool) {
|
||||
task, err := models.GetUpdateTaskByUUID(uuid)
|
||||
if err != nil {
|
||||
if models.IsErrUpdateTaskNotExist(err) {
|
||||
log.GitLogger.Trace("No update task is presented: %s", uuid)
|
||||
return
|
||||
}
|
||||
log.GitLogger.Fatal(2, "GetUpdateTaskByUUID: %v", err)
|
||||
} else if err = models.DeleteUpdateTaskByUUID(uuid); err != nil {
|
||||
log.GitLogger.Fatal(2, "DeleteUpdateTaskByUUID: %v", err)
|
||||
}
|
||||
|
||||
if isWiki {
|
||||
return
|
||||
}
|
||||
|
||||
if err = models.PushUpdate(models.PushUpdateOptions{
|
||||
RefFullName: task.RefName,
|
||||
OldCommitID: task.OldCommitID,
|
||||
NewCommitID: task.NewCommitID,
|
||||
PusherID: user.ID,
|
||||
PusherName: user.Name,
|
||||
RepoUserName: repoUser.Name,
|
||||
RepoName: reponame,
|
||||
}); err != nil {
|
||||
log.GitLogger.Error(2, "Update: %v", err)
|
||||
}
|
||||
|
||||
// Ask for running deliver hook and test pull request tasks.
|
||||
reqURL := setting.LocalURL + repoUser.Name + "/" + reponame + "/tasks/trigger?branch=" +
|
||||
strings.TrimPrefix(task.RefName, git.BranchPrefix) + "&secret=" + base.EncodeMD5(repoUser.Salt) + "&pusher=" + com.ToStr(user.ID)
|
||||
log.GitLogger.Trace("Trigger task: %s", reqURL)
|
||||
|
||||
resp, err := httplib.Head(reqURL).SetTLSClientConfig(&tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
}).Response()
|
||||
if err == nil {
|
||||
resp.Body.Close()
|
||||
if resp.StatusCode/100 != 2 {
|
||||
log.GitLogger.Error(2, "Fail to trigger task: not 2xx response code")
|
||||
}
|
||||
} else {
|
||||
log.GitLogger.Error(2, "Fail to trigger task: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func runServ(c *cli.Context) error {
|
||||
if c.IsSet("config") {
|
||||
setting.CustomConf = c.String("config")
|
||||
}
|
||||
|
||||
setup("serv.log")
|
||||
|
||||
if setting.SSH.Disabled {
|
||||
println("Gitea: SSH has been disabled")
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(c.Args()) < 1 {
|
||||
fail("Not enough arguments", "Not enough arguments")
|
||||
}
|
||||
|
||||
cmd := os.Getenv("SSH_ORIGINAL_COMMAND")
|
||||
if len(cmd) == 0 {
|
||||
println("Hi there, You've successfully authenticated, but Gitea does not provide shell access.")
|
||||
println("If this is unexpected, please log in with password and setup Gitea under another user.")
|
||||
return nil
|
||||
}
|
||||
|
||||
verb, args := parseCmd(cmd)
|
||||
repoPath := strings.ToLower(strings.Trim(args, "'"))
|
||||
rr := strings.SplitN(repoPath, "/", 2)
|
||||
if len(rr) != 2 {
|
||||
fail("Invalid repository path", "Invalid repository path: %v", args)
|
||||
}
|
||||
username := strings.ToLower(rr[0])
|
||||
reponame := strings.ToLower(strings.TrimSuffix(rr[1], ".git"))
|
||||
|
||||
isWiki := false
|
||||
if strings.HasSuffix(reponame, ".wiki") {
|
||||
isWiki = true
|
||||
reponame = reponame[:len(reponame)-5]
|
||||
}
|
||||
|
||||
repoUser, err := models.GetUserByName(username)
|
||||
if err != nil {
|
||||
if models.IsErrUserNotExist(err) {
|
||||
fail("Repository owner does not exist", "Unregistered owner: %s", username)
|
||||
}
|
||||
fail("Internal error", "Failed to get repository owner (%s): %v", username, err)
|
||||
}
|
||||
|
||||
repo, err := models.GetRepositoryByName(repoUser.ID, reponame)
|
||||
if err != nil {
|
||||
if models.IsErrRepoNotExist(err) {
|
||||
fail(accessDenied, "Repository does not exist: %s/%s", repoUser.Name, reponame)
|
||||
}
|
||||
fail("Internal error", "Failed to get repository: %v", err)
|
||||
}
|
||||
|
||||
requestedMode, has := allowedCommands[verb]
|
||||
if !has {
|
||||
fail("Unknown git command", "Unknown git command %s", verb)
|
||||
}
|
||||
|
||||
// Prohibit push to mirror repositories.
|
||||
if requestedMode > models.AccessModeRead && repo.IsMirror {
|
||||
fail("mirror repository is read-only", "")
|
||||
}
|
||||
|
||||
// Allow anonymous clone for public repositories.
|
||||
var (
|
||||
keyID int64
|
||||
user *models.User
|
||||
)
|
||||
if requestedMode == models.AccessModeWrite || repo.IsPrivate {
|
||||
keys := strings.Split(c.Args()[0], "-")
|
||||
if len(keys) != 2 {
|
||||
fail("Key ID format error", "Invalid key argument: %s", c.Args()[0])
|
||||
}
|
||||
|
||||
key, err := models.GetPublicKeyByID(com.StrTo(keys[1]).MustInt64())
|
||||
if err != nil {
|
||||
fail("Invalid key ID", "Invalid key ID[%s]: %v", c.Args()[0], err)
|
||||
}
|
||||
keyID = key.ID
|
||||
|
||||
// Check deploy key or user key.
|
||||
if key.Type == models.KeyTypeDeploy {
|
||||
if key.Mode < requestedMode {
|
||||
fail("Key permission denied", "Cannot push with deployment key: %d", key.ID)
|
||||
}
|
||||
// Check if this deploy key belongs to current repository.
|
||||
if !models.HasDeployKey(key.ID, repo.ID) {
|
||||
fail("Key access denied", "Deploy key access denied: [key_id: %d, repo_id: %d]", key.ID, repo.ID)
|
||||
}
|
||||
|
||||
// Update deploy key activity.
|
||||
deployKey, err := models.GetDeployKeyByRepo(key.ID, repo.ID)
|
||||
if err != nil {
|
||||
fail("Internal error", "GetDeployKey: %v", err)
|
||||
}
|
||||
|
||||
deployKey.Updated = time.Now()
|
||||
if err = models.UpdateDeployKey(deployKey); err != nil {
|
||||
fail("Internal error", "UpdateDeployKey: %v", err)
|
||||
}
|
||||
} else {
|
||||
user, err = models.GetUserByKeyID(key.ID)
|
||||
if err != nil {
|
||||
fail("internal error", "Failed to get user by key ID(%d): %v", keyID, err)
|
||||
}
|
||||
|
||||
mode, err := models.AccessLevel(user, repo)
|
||||
if err != nil {
|
||||
fail("Internal error", "Fail to check access: %v", err)
|
||||
} else if mode < requestedMode {
|
||||
clientMessage := accessDenied
|
||||
if mode >= models.AccessModeRead {
|
||||
clientMessage = "You do not have sufficient authorization for this action"
|
||||
}
|
||||
fail(clientMessage,
|
||||
"User %s does not have level %v access to repository %s",
|
||||
user.Name, requestedMode, repoPath)
|
||||
}
|
||||
|
||||
os.Setenv("GITEA_PUSHER_NAME", user.Name)
|
||||
}
|
||||
}
|
||||
|
||||
uuid := gouuid.NewV4().String()
|
||||
os.Setenv("GITEA_UUID", uuid)
|
||||
// Keep the old env variable name for backward compability
|
||||
os.Setenv("uuid", uuid)
|
||||
|
||||
// Special handle for Windows.
|
||||
if setting.IsWindows {
|
||||
verb = strings.Replace(verb, "-", " ", 1)
|
||||
}
|
||||
|
||||
var gitcmd *exec.Cmd
|
||||
verbs := strings.Split(verb, " ")
|
||||
if len(verbs) == 2 {
|
||||
gitcmd = exec.Command(verbs[0], verbs[1], repoPath)
|
||||
} else {
|
||||
gitcmd = exec.Command(verb, repoPath)
|
||||
}
|
||||
gitcmd.Dir = setting.RepoRootPath
|
||||
gitcmd.Stdout = os.Stdout
|
||||
gitcmd.Stdin = os.Stdin
|
||||
gitcmd.Stderr = os.Stderr
|
||||
if err = gitcmd.Run(); err != nil {
|
||||
fail("Internal error", "Failed to execute git command: %v", err)
|
||||
}
|
||||
|
||||
if requestedMode == models.AccessModeWrite {
|
||||
handleUpdateTask(uuid, user, repoUser, reponame, isWiki)
|
||||
}
|
||||
|
||||
// Update user key activity.
|
||||
if keyID > 0 {
|
||||
key, err := models.GetPublicKeyByID(keyID)
|
||||
if err != nil {
|
||||
fail("Internal error", "GetPublicKeyById: %v", err)
|
||||
}
|
||||
|
||||
key.Updated = time.Now()
|
||||
if err = models.UpdatePublicKey(key); err != nil {
|
||||
fail("Internal error", "UpdatePublicKey: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@@ -1,63 +0,0 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
)
|
||||
|
||||
// CmdUpdate represents the available update sub-command.
|
||||
var CmdUpdate = cli.Command{
|
||||
Name: "update",
|
||||
Usage: "This command should only be called by Git hook",
|
||||
Description: `Update get pushed info and insert into database`,
|
||||
Action: runUpdate,
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "config, c",
|
||||
Value: "custom/conf/app.ini",
|
||||
Usage: "Custom configuration file path",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func runUpdate(c *cli.Context) error {
|
||||
if c.IsSet("config") {
|
||||
setting.CustomConf = c.String("config")
|
||||
}
|
||||
|
||||
setup("update.log")
|
||||
|
||||
if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
|
||||
log.GitLogger.Trace("SSH_ORIGINAL_COMMAND is empty")
|
||||
return nil
|
||||
}
|
||||
|
||||
args := c.Args()
|
||||
if len(args) != 3 {
|
||||
log.GitLogger.Fatal(2, "Arguments received are not equal to three")
|
||||
} else if len(args[0]) == 0 {
|
||||
log.GitLogger.Fatal(2, "First argument 'refName' is empty, shouldn't use")
|
||||
}
|
||||
|
||||
task := models.UpdateTask{
|
||||
UUID: os.Getenv("GITEA_UUID"),
|
||||
RefName: args[0],
|
||||
OldCommitID: args[1],
|
||||
NewCommitID: args[2],
|
||||
}
|
||||
|
||||
if err := models.AddUpdateTask(&task); err != nil {
|
||||
log.GitLogger.Fatal(2, "AddUpdateTask: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
581
cmd/web.go
581
cmd/web.go
@@ -5,40 +5,21 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/fcgi"
|
||||
_ "net/http/pprof" // Used for debugging if enabled and a web server is running
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/auth"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/options"
|
||||
"code.gitea.io/gitea/modules/public"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/templates"
|
||||
"code.gitea.io/gitea/routers"
|
||||
"code.gitea.io/gitea/routers/admin"
|
||||
apiv1 "code.gitea.io/gitea/routers/api/v1"
|
||||
"code.gitea.io/gitea/routers/dev"
|
||||
"code.gitea.io/gitea/routers/org"
|
||||
"code.gitea.io/gitea/routers/repo"
|
||||
"code.gitea.io/gitea/routers/user"
|
||||
"github.com/go-macaron/binding"
|
||||
"github.com/go-macaron/cache"
|
||||
"github.com/go-macaron/captcha"
|
||||
"github.com/go-macaron/csrf"
|
||||
"github.com/go-macaron/gzip"
|
||||
"github.com/go-macaron/i18n"
|
||||
"github.com/go-macaron/session"
|
||||
"github.com/go-macaron/toolbox"
|
||||
"code.gitea.io/gitea/routers/routes"
|
||||
|
||||
context2 "github.com/gorilla/context"
|
||||
"github.com/urfave/cli"
|
||||
macaron "gopkg.in/macaron.v1"
|
||||
)
|
||||
|
||||
// CmdWeb represents the available web sub-command.
|
||||
@@ -59,531 +40,27 @@ and it takes care of all the other things for you`,
|
||||
Value: "custom/conf/app.ini",
|
||||
Usage: "Custom configuration file path",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "pid, P",
|
||||
Value: "/var/run/gitea.pid",
|
||||
Usage: "Custom pid file path",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// VerChecker is a listing of required dependency versions.
|
||||
type VerChecker struct {
|
||||
ImportPath string
|
||||
Version func() string
|
||||
Expected string
|
||||
}
|
||||
|
||||
// newMacaron initializes Macaron instance.
|
||||
func newMacaron() *macaron.Macaron {
|
||||
m := macaron.New()
|
||||
if !setting.DisableRouterLog {
|
||||
m.Use(macaron.Logger())
|
||||
}
|
||||
m.Use(macaron.Recovery())
|
||||
if setting.EnableGzip {
|
||||
m.Use(gzip.Gziper())
|
||||
}
|
||||
if setting.Protocol == setting.FCGI {
|
||||
m.SetURLPrefix(setting.AppSubURL)
|
||||
}
|
||||
m.Use(public.Static(
|
||||
&public.Options{
|
||||
Directory: path.Join(setting.StaticRootPath, "public"),
|
||||
SkipLogging: setting.DisableRouterLog,
|
||||
},
|
||||
))
|
||||
m.Use(macaron.Static(
|
||||
setting.AvatarUploadPath,
|
||||
macaron.StaticOptions{
|
||||
Prefix: "avatars",
|
||||
SkipLogging: setting.DisableRouterLog,
|
||||
},
|
||||
))
|
||||
|
||||
m.Use(templates.Renderer())
|
||||
models.InitMailRender(templates.Mailer())
|
||||
|
||||
localeNames, err := options.Dir("locale")
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(4, "Fail to list locale files: %v", err)
|
||||
}
|
||||
|
||||
localFiles := make(map[string][]byte)
|
||||
|
||||
for _, name := range localeNames {
|
||||
localFiles[name], err = options.Locale(name)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(4, "Failed to load %s locale file. %v", name, err)
|
||||
}
|
||||
}
|
||||
|
||||
m.Use(i18n.I18n(i18n.Options{
|
||||
SubURL: setting.AppSubURL,
|
||||
Files: localFiles,
|
||||
Langs: setting.Langs,
|
||||
Names: setting.Names,
|
||||
DefaultLang: "en-US",
|
||||
Redirect: true,
|
||||
}))
|
||||
m.Use(cache.Cacher(cache.Options{
|
||||
Adapter: setting.CacheAdapter,
|
||||
AdapterConfig: setting.CacheConn,
|
||||
Interval: setting.CacheInterval,
|
||||
}))
|
||||
m.Use(captcha.Captchaer(captcha.Options{
|
||||
SubURL: setting.AppSubURL,
|
||||
}))
|
||||
m.Use(session.Sessioner(setting.SessionConfig))
|
||||
m.Use(csrf.Csrfer(csrf.Options{
|
||||
Secret: setting.SecretKey,
|
||||
Cookie: setting.CSRFCookieName,
|
||||
SetCookie: true,
|
||||
Header: "X-Csrf-Token",
|
||||
CookiePath: setting.AppSubURL,
|
||||
}))
|
||||
m.Use(toolbox.Toolboxer(m, toolbox.Options{
|
||||
HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{
|
||||
{
|
||||
Desc: "Database connection",
|
||||
Func: models.Ping,
|
||||
},
|
||||
},
|
||||
}))
|
||||
m.Use(context.Contexter())
|
||||
return m
|
||||
}
|
||||
|
||||
func runWeb(ctx *cli.Context) error {
|
||||
if ctx.IsSet("config") {
|
||||
setting.CustomConf = ctx.String("config")
|
||||
}
|
||||
routers.GlobalInit()
|
||||
|
||||
m := newMacaron()
|
||||
|
||||
reqSignIn := context.Toggle(&context.ToggleOptions{SignInRequired: true})
|
||||
ignSignIn := context.Toggle(&context.ToggleOptions{SignInRequired: setting.Service.RequireSignInView})
|
||||
ignSignInAndCsrf := context.Toggle(&context.ToggleOptions{DisableCSRF: true})
|
||||
reqSignOut := context.Toggle(&context.ToggleOptions{SignOutRequired: true})
|
||||
|
||||
bindIgnErr := binding.BindIgnErr
|
||||
|
||||
// FIXME: not all routes need go through same middlewares.
|
||||
// Especially some AJAX requests, we can reduce middleware number to improve performance.
|
||||
// Routers.
|
||||
m.Get("/", ignSignIn, routers.Home)
|
||||
m.Group("/explore", func() {
|
||||
m.Get("", func(ctx *context.Context) {
|
||||
ctx.Redirect(setting.AppSubURL + "/explore/repos")
|
||||
})
|
||||
m.Get("/repos", routers.ExploreRepos)
|
||||
m.Get("/users", routers.ExploreUsers)
|
||||
m.Get("/organizations", routers.ExploreOrganizations)
|
||||
}, ignSignIn)
|
||||
m.Combo("/install", routers.InstallInit).Get(routers.Install).
|
||||
Post(bindIgnErr(auth.InstallForm{}), routers.InstallPost)
|
||||
m.Get("/^:type(issues|pulls)$", reqSignIn, user.Issues)
|
||||
|
||||
// ***** START: User *****
|
||||
m.Group("/user", func() {
|
||||
m.Get("/login", user.SignIn)
|
||||
m.Post("/login", bindIgnErr(auth.SignInForm{}), user.SignInPost)
|
||||
m.Get("/sign_up", user.SignUp)
|
||||
m.Post("/sign_up", bindIgnErr(auth.RegisterForm{}), user.SignUpPost)
|
||||
m.Get("/reset_password", user.ResetPasswd)
|
||||
m.Post("/reset_password", user.ResetPasswdPost)
|
||||
}, reqSignOut)
|
||||
|
||||
m.Group("/user/settings", func() {
|
||||
m.Get("", user.Settings)
|
||||
m.Post("", bindIgnErr(auth.UpdateProfileForm{}), user.SettingsPost)
|
||||
m.Combo("/avatar").Get(user.SettingsAvatar).
|
||||
Post(binding.MultipartForm(auth.AvatarForm{}), user.SettingsAvatarPost)
|
||||
m.Post("/avatar/delete", user.SettingsDeleteAvatar)
|
||||
m.Combo("/email").Get(user.SettingsEmails).
|
||||
Post(bindIgnErr(auth.AddEmailForm{}), user.SettingsEmailPost)
|
||||
m.Post("/email/delete", user.DeleteEmail)
|
||||
m.Get("/password", user.SettingsPassword)
|
||||
m.Post("/password", bindIgnErr(auth.ChangePasswordForm{}), user.SettingsPasswordPost)
|
||||
m.Combo("/ssh").Get(user.SettingsSSHKeys).
|
||||
Post(bindIgnErr(auth.AddSSHKeyForm{}), user.SettingsSSHKeysPost)
|
||||
m.Post("/ssh/delete", user.DeleteSSHKey)
|
||||
m.Combo("/applications").Get(user.SettingsApplications).
|
||||
Post(bindIgnErr(auth.NewAccessTokenForm{}), user.SettingsApplicationsPost)
|
||||
m.Post("/applications/delete", user.SettingsDeleteApplication)
|
||||
m.Route("/delete", "GET,POST", user.SettingsDelete)
|
||||
}, reqSignIn, func(ctx *context.Context) {
|
||||
ctx.Data["PageIsUserSettings"] = true
|
||||
})
|
||||
|
||||
m.Group("/user", func() {
|
||||
// r.Get("/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds)
|
||||
m.Any("/activate", user.Activate)
|
||||
m.Any("/activate_email", user.ActivateEmail)
|
||||
m.Get("/email2user", user.Email2User)
|
||||
m.Get("/forget_password", user.ForgotPasswd)
|
||||
m.Post("/forget_password", user.ForgotPasswdPost)
|
||||
m.Get("/logout", user.SignOut)
|
||||
})
|
||||
// ***** END: User *****
|
||||
|
||||
adminReq := context.Toggle(&context.ToggleOptions{SignInRequired: true, AdminRequired: true})
|
||||
|
||||
// ***** START: Admin *****
|
||||
m.Group("/admin", func() {
|
||||
m.Get("", adminReq, admin.Dashboard)
|
||||
m.Get("/config", admin.Config)
|
||||
m.Post("/config/test_mail", admin.SendTestMail)
|
||||
m.Get("/monitor", admin.Monitor)
|
||||
|
||||
m.Group("/users", func() {
|
||||
m.Get("", admin.Users)
|
||||
m.Combo("/new").Get(admin.NewUser).Post(bindIgnErr(auth.AdminCreateUserForm{}), admin.NewUserPost)
|
||||
m.Combo("/:userid").Get(admin.EditUser).Post(bindIgnErr(auth.AdminEditUserForm{}), admin.EditUserPost)
|
||||
m.Post("/:userid/delete", admin.DeleteUser)
|
||||
})
|
||||
|
||||
m.Group("/orgs", func() {
|
||||
m.Get("", admin.Organizations)
|
||||
})
|
||||
|
||||
m.Group("/repos", func() {
|
||||
m.Get("", admin.Repos)
|
||||
m.Post("/delete", admin.DeleteRepo)
|
||||
})
|
||||
|
||||
m.Group("/auths", func() {
|
||||
m.Get("", admin.Authentications)
|
||||
m.Combo("/new").Get(admin.NewAuthSource).Post(bindIgnErr(auth.AuthenticationForm{}), admin.NewAuthSourcePost)
|
||||
m.Combo("/:authid").Get(admin.EditAuthSource).
|
||||
Post(bindIgnErr(auth.AuthenticationForm{}), admin.EditAuthSourcePost)
|
||||
m.Post("/:authid/delete", admin.DeleteAuthSource)
|
||||
})
|
||||
|
||||
m.Group("/notices", func() {
|
||||
m.Get("", admin.Notices)
|
||||
m.Post("/delete", admin.DeleteNotices)
|
||||
m.Get("/empty", admin.EmptyNotices)
|
||||
})
|
||||
}, adminReq)
|
||||
// ***** END: Admin *****
|
||||
|
||||
m.Group("", func() {
|
||||
m.Group("/:username", func() {
|
||||
m.Get("", user.Profile)
|
||||
m.Get("/followers", user.Followers)
|
||||
m.Get("/following", user.Following)
|
||||
m.Get("/stars", user.Stars)
|
||||
})
|
||||
|
||||
m.Get("/attachments/:uuid", func(ctx *context.Context) {
|
||||
attach, err := models.GetAttachmentByUUID(ctx.Params(":uuid"))
|
||||
if err != nil {
|
||||
if models.IsErrAttachmentNotExist(err) {
|
||||
ctx.Error(404)
|
||||
} else {
|
||||
ctx.Handle(500, "GetAttachmentByUUID", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fr, err := os.Open(attach.LocalPath())
|
||||
if err != nil {
|
||||
ctx.Handle(500, "Open", err)
|
||||
return
|
||||
}
|
||||
defer fr.Close()
|
||||
|
||||
if err = repo.ServeData(ctx, attach.Name, fr); err != nil {
|
||||
ctx.Handle(500, "ServeData", err)
|
||||
return
|
||||
}
|
||||
})
|
||||
m.Post("/issues/attachments", repo.UploadIssueAttachment)
|
||||
}, ignSignIn)
|
||||
|
||||
m.Group("/:username", func() {
|
||||
m.Get("/action/:action", user.Action)
|
||||
}, reqSignIn)
|
||||
|
||||
if macaron.Env == macaron.DEV {
|
||||
m.Get("/template/*", dev.TemplatePreview)
|
||||
if ctx.IsSet("pid") {
|
||||
setting.CustomPID = ctx.String("pid")
|
||||
}
|
||||
|
||||
reqRepoAdmin := context.RequireRepoAdmin()
|
||||
reqRepoWriter := context.RequireRepoWriter()
|
||||
routers.GlobalInit()
|
||||
|
||||
// ***** START: Organization *****
|
||||
m.Group("/org", func() {
|
||||
m.Get("/create", org.Create)
|
||||
m.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.CreatePost)
|
||||
|
||||
m.Group("/:org", func() {
|
||||
m.Get("/dashboard", user.Dashboard)
|
||||
m.Get("/^:type(issues|pulls)$", user.Issues)
|
||||
m.Get("/members", org.Members)
|
||||
m.Get("/members/action/:action", org.MembersAction)
|
||||
|
||||
m.Get("/teams", org.Teams)
|
||||
}, context.OrgAssignment(true))
|
||||
|
||||
m.Group("/:org", func() {
|
||||
m.Get("/teams/:team", org.TeamMembers)
|
||||
m.Get("/teams/:team/repositories", org.TeamRepositories)
|
||||
m.Route("/teams/:team/action/:action", "GET,POST", org.TeamsAction)
|
||||
m.Route("/teams/:team/action/repo/:action", "GET,POST", org.TeamsRepoAction)
|
||||
}, context.OrgAssignment(true, false, true))
|
||||
|
||||
m.Group("/:org", func() {
|
||||
m.Get("/teams/new", org.NewTeam)
|
||||
m.Post("/teams/new", bindIgnErr(auth.CreateTeamForm{}), org.NewTeamPost)
|
||||
m.Get("/teams/:team/edit", org.EditTeam)
|
||||
m.Post("/teams/:team/edit", bindIgnErr(auth.CreateTeamForm{}), org.EditTeamPost)
|
||||
m.Post("/teams/:team/delete", org.DeleteTeam)
|
||||
|
||||
m.Group("/settings", func() {
|
||||
m.Combo("").Get(org.Settings).
|
||||
Post(bindIgnErr(auth.UpdateOrgSettingForm{}), org.SettingsPost)
|
||||
m.Post("/avatar", binding.MultipartForm(auth.AvatarForm{}), org.SettingsAvatar)
|
||||
m.Post("/avatar/delete", org.SettingsDeleteAvatar)
|
||||
|
||||
m.Group("/hooks", func() {
|
||||
m.Get("", org.Webhooks)
|
||||
m.Post("/delete", org.DeleteWebhook)
|
||||
m.Get("/:type/new", repo.WebhooksNew)
|
||||
m.Post("/gogs/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost)
|
||||
m.Post("/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost)
|
||||
m.Get("/:id", repo.WebHooksEdit)
|
||||
m.Post("/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
||||
m.Post("/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
|
||||
})
|
||||
|
||||
m.Route("/delete", "GET,POST", org.SettingsDelete)
|
||||
})
|
||||
|
||||
m.Route("/invitations/new", "GET,POST", org.Invitation)
|
||||
}, context.OrgAssignment(true, true))
|
||||
}, reqSignIn)
|
||||
// ***** END: Organization *****
|
||||
|
||||
// ***** START: Repository *****
|
||||
m.Group("/repo", func() {
|
||||
m.Get("/create", repo.Create)
|
||||
m.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost)
|
||||
m.Get("/migrate", repo.Migrate)
|
||||
m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost)
|
||||
m.Combo("/fork/:repoid").Get(repo.Fork).
|
||||
Post(bindIgnErr(auth.CreateRepoForm{}), repo.ForkPost)
|
||||
}, reqSignIn)
|
||||
|
||||
m.Group("/:username/:reponame", func() {
|
||||
m.Group("/settings", func() {
|
||||
m.Combo("").Get(repo.Settings).
|
||||
Post(bindIgnErr(auth.RepoSettingForm{}), repo.SettingsPost)
|
||||
m.Group("/collaboration", func() {
|
||||
m.Combo("").Get(repo.Collaboration).Post(repo.CollaborationPost)
|
||||
m.Post("/access_mode", repo.ChangeCollaborationAccessMode)
|
||||
m.Post("/delete", repo.DeleteCollaboration)
|
||||
})
|
||||
|
||||
m.Group("/hooks", func() {
|
||||
m.Get("", repo.Webhooks)
|
||||
m.Post("/delete", repo.DeleteWebhook)
|
||||
m.Get("/:type/new", repo.WebhooksNew)
|
||||
m.Post("/gogs/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost)
|
||||
m.Post("/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost)
|
||||
m.Get("/:id", repo.WebHooksEdit)
|
||||
m.Post("/:id/test", repo.TestWebhook)
|
||||
m.Post("/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
||||
m.Post("/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
|
||||
|
||||
m.Group("/git", func() {
|
||||
m.Get("", repo.GitHooks)
|
||||
m.Combo("/:name").Get(repo.GitHooksEdit).
|
||||
Post(repo.GitHooksEditPost)
|
||||
}, context.GitHookService())
|
||||
})
|
||||
|
||||
m.Group("/keys", func() {
|
||||
m.Combo("").Get(repo.DeployKeys).
|
||||
Post(bindIgnErr(auth.AddSSHKeyForm{}), repo.DeployKeysPost)
|
||||
m.Post("/delete", repo.DeleteDeployKey)
|
||||
})
|
||||
|
||||
}, func(ctx *context.Context) {
|
||||
ctx.Data["PageIsSettings"] = true
|
||||
})
|
||||
}, reqSignIn, context.RepoAssignment(), reqRepoAdmin, context.RepoRef())
|
||||
|
||||
m.Get("/:username/:reponame/action/:action", reqSignIn, context.RepoAssignment(), repo.Action)
|
||||
m.Group("/:username/:reponame", func() {
|
||||
// FIXME: should use different URLs but mostly same logic for comments of issue and pull reuqest.
|
||||
// So they can apply their own enable/disable logic on routers.
|
||||
m.Group("/issues", func() {
|
||||
m.Combo("/new", repo.MustEnableIssues).Get(context.RepoRef(), repo.NewIssue).
|
||||
Post(bindIgnErr(auth.CreateIssueForm{}), repo.NewIssuePost)
|
||||
|
||||
m.Group("/:index", func() {
|
||||
m.Post("/label", repo.UpdateIssueLabel)
|
||||
m.Post("/milestone", repo.UpdateIssueMilestone)
|
||||
m.Post("/assignee", repo.UpdateIssueAssignee)
|
||||
}, reqRepoWriter)
|
||||
|
||||
m.Group("/:index", func() {
|
||||
m.Post("/title", repo.UpdateIssueTitle)
|
||||
m.Post("/content", repo.UpdateIssueContent)
|
||||
m.Combo("/comments").Post(bindIgnErr(auth.CreateCommentForm{}), repo.NewComment)
|
||||
})
|
||||
})
|
||||
m.Group("/comments/:id", func() {
|
||||
m.Post("", repo.UpdateCommentContent)
|
||||
m.Post("/delete", repo.DeleteComment)
|
||||
})
|
||||
m.Group("/labels", func() {
|
||||
m.Post("/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel)
|
||||
m.Post("/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel)
|
||||
m.Post("/delete", repo.DeleteLabel)
|
||||
m.Post("/initialize", bindIgnErr(auth.InitializeLabelsForm{}), repo.InitializeLabels)
|
||||
}, reqRepoWriter, context.RepoRef())
|
||||
m.Group("/milestones", func() {
|
||||
m.Combo("/new").Get(repo.NewMilestone).
|
||||
Post(bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost)
|
||||
m.Get("/:id/edit", repo.EditMilestone)
|
||||
m.Post("/:id/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.EditMilestonePost)
|
||||
m.Get("/:id/:action", repo.ChangeMilestonStatus)
|
||||
m.Post("/delete", repo.DeleteMilestone)
|
||||
}, reqRepoWriter, context.RepoRef())
|
||||
|
||||
m.Group("/releases", func() {
|
||||
m.Get("/new", repo.NewRelease)
|
||||
m.Post("/new", bindIgnErr(auth.NewReleaseForm{}), repo.NewReleasePost)
|
||||
m.Post("/delete", repo.DeleteRelease)
|
||||
}, reqRepoWriter, context.RepoRef())
|
||||
|
||||
m.Group("/releases", func() {
|
||||
m.Get("/edit/*", repo.EditRelease)
|
||||
m.Post("/edit/*", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
||||
}, reqRepoWriter, func(ctx *context.Context) {
|
||||
var err error
|
||||
ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.Repository.DefaultBranch)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetBranchCommit", err)
|
||||
return
|
||||
}
|
||||
ctx.Repo.CommitsCount, err = ctx.Repo.Commit.CommitsCount()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "CommitsCount", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["CommitsCount"] = ctx.Repo.CommitsCount
|
||||
})
|
||||
|
||||
m.Combo("/compare/*", repo.MustAllowPulls, repo.SetEditorconfigIfExists).
|
||||
Get(repo.CompareAndPullRequest).
|
||||
Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)
|
||||
|
||||
m.Group("", func() {
|
||||
m.Combo("/_edit/*").Get(repo.EditFile).
|
||||
Post(bindIgnErr(auth.EditRepoFileForm{}), repo.EditFilePost)
|
||||
m.Combo("/_new/*").Get(repo.NewFile).
|
||||
Post(bindIgnErr(auth.EditRepoFileForm{}), repo.NewFilePost)
|
||||
m.Post("/_preview/*", bindIgnErr(auth.EditPreviewDiffForm{}), repo.DiffPreviewPost)
|
||||
m.Combo("/_delete/*").Get(repo.DeleteFile).
|
||||
Post(bindIgnErr(auth.DeleteRepoFileForm{}), repo.DeleteFilePost)
|
||||
|
||||
m.Group("", func() {
|
||||
m.Combo("/_upload/*").Get(repo.UploadFile).
|
||||
Post(bindIgnErr(auth.UploadRepoFileForm{}), repo.UploadFilePost)
|
||||
m.Post("/upload-file", repo.UploadFileToServer)
|
||||
m.Post("/upload-remove", bindIgnErr(auth.RemoveUploadFileForm{}), repo.RemoveUploadFileFromServer)
|
||||
}, func(ctx *context.Context) {
|
||||
if !setting.Repository.Upload.Enabled {
|
||||
ctx.Handle(404, "", nil)
|
||||
return
|
||||
}
|
||||
})
|
||||
}, reqRepoWriter, context.RepoRef(), func(ctx *context.Context) {
|
||||
if !ctx.Repo.Repository.CanEnableEditor() || ctx.Repo.IsViewCommit {
|
||||
ctx.Handle(404, "", nil)
|
||||
return
|
||||
}
|
||||
})
|
||||
}, reqSignIn, context.RepoAssignment(), repo.MustBeNotBare)
|
||||
|
||||
m.Group("/:username/:reponame", func() {
|
||||
m.Group("", func() {
|
||||
m.Get("/releases", repo.Releases)
|
||||
m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues)
|
||||
m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue)
|
||||
m.Get("/labels/", repo.RetrieveLabels, repo.Labels)
|
||||
m.Get("/milestones", repo.Milestones)
|
||||
}, context.RepoRef())
|
||||
|
||||
// m.Get("/branches", repo.Branches)
|
||||
|
||||
m.Group("/wiki", func() {
|
||||
m.Get("/?:page", repo.Wiki)
|
||||
m.Get("/_pages", repo.WikiPages)
|
||||
|
||||
m.Group("", func() {
|
||||
m.Combo("/_new").Get(repo.NewWiki).
|
||||
Post(bindIgnErr(auth.NewWikiForm{}), repo.NewWikiPost)
|
||||
m.Combo("/:page/_edit").Get(repo.EditWiki).
|
||||
Post(bindIgnErr(auth.NewWikiForm{}), repo.EditWikiPost)
|
||||
m.Post("/:page/delete", repo.DeleteWikiPagePost)
|
||||
}, reqSignIn, reqRepoWriter)
|
||||
}, repo.MustEnableWiki, context.RepoRef())
|
||||
|
||||
m.Get("/archive/*", repo.Download)
|
||||
|
||||
m.Group("/pulls/:index", func() {
|
||||
m.Get("/commits", context.RepoRef(), repo.ViewPullCommits)
|
||||
m.Get("/files", context.RepoRef(), repo.SetEditorconfigIfExists, repo.SetDiffViewStyle, repo.ViewPullFiles)
|
||||
m.Post("/merge", reqRepoWriter, repo.MergePullRequest)
|
||||
}, repo.MustAllowPulls)
|
||||
|
||||
m.Group("", func() {
|
||||
m.Get("/src/*", repo.SetEditorconfigIfExists, repo.Home)
|
||||
m.Get("/raw/*", repo.SingleDownload)
|
||||
m.Get("/commits/*", repo.RefCommits)
|
||||
m.Get("/commit/:sha([a-f0-9]{7,40})$", repo.SetEditorconfigIfExists, repo.SetDiffViewStyle, repo.Diff)
|
||||
m.Get("/forks", repo.Forks)
|
||||
}, context.RepoRef())
|
||||
m.Get("/commit/:sha([a-f0-9]{7,40})\\.:ext(patch|diff)", repo.RawDiff)
|
||||
|
||||
m.Get("/compare/:before([a-z0-9]{40})\\.\\.\\.:after([a-z0-9]{40})", repo.SetEditorconfigIfExists, repo.SetDiffViewStyle, repo.CompareDiff)
|
||||
}, ignSignIn, context.RepoAssignment(), repo.MustBeNotBare)
|
||||
m.Group("/:username/:reponame", func() {
|
||||
m.Get("/stars", repo.Stars)
|
||||
m.Get("/watchers", repo.Watchers)
|
||||
}, ignSignIn, context.RepoAssignment(), context.RepoRef())
|
||||
|
||||
m.Group("/:username", func() {
|
||||
m.Group("/:reponame", func() {
|
||||
m.Get("", repo.SetEditorconfigIfExists, repo.Home)
|
||||
m.Get("\\.git$", repo.SetEditorconfigIfExists, repo.Home)
|
||||
}, ignSignIn, context.RepoAssignment(true), context.RepoRef())
|
||||
|
||||
m.Group("/:reponame", func() {
|
||||
m.Any("/*", ignSignInAndCsrf, repo.HTTP)
|
||||
m.Head("/tasks/trigger", repo.TriggerTask)
|
||||
})
|
||||
})
|
||||
// ***** END: Repository *****
|
||||
|
||||
m.Group("/api", func() {
|
||||
apiv1.RegisterRoutes(m)
|
||||
}, ignSignIn)
|
||||
|
||||
// robots.txt
|
||||
m.Get("/robots.txt", func(ctx *context.Context) {
|
||||
if setting.HasRobotsTxt {
|
||||
ctx.ServeFileContent(path.Join(setting.CustomPath, "robots.txt"))
|
||||
} else {
|
||||
ctx.Error(404)
|
||||
}
|
||||
})
|
||||
|
||||
// Not found handler.
|
||||
m.NotFound(routers.NotFound)
|
||||
m := routes.NewMacaron()
|
||||
routes.RegisterRoutes(m)
|
||||
|
||||
// Flag for port number in case first time run conflict.
|
||||
if ctx.IsSet("port") {
|
||||
@@ -599,18 +76,32 @@ func runWeb(ctx *cli.Context) error {
|
||||
}
|
||||
log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubURL)
|
||||
|
||||
if setting.LFS.StartServer {
|
||||
log.Info("LFS server enabled")
|
||||
}
|
||||
|
||||
if setting.EnablePprof {
|
||||
go func() {
|
||||
log.Info("%v", http.ListenAndServe("localhost:6060", nil))
|
||||
}()
|
||||
}
|
||||
|
||||
var err error
|
||||
switch setting.Protocol {
|
||||
case setting.HTTP:
|
||||
err = http.ListenAndServe(listenAddr, m)
|
||||
err = runHTTP(listenAddr, context2.ClearHandler(m))
|
||||
case setting.HTTPS:
|
||||
server := &http.Server{Addr: listenAddr, TLSConfig: &tls.Config{MinVersion: tls.VersionTLS10}, Handler: m}
|
||||
err = server.ListenAndServeTLS(setting.CertFile, setting.KeyFile)
|
||||
err = runHTTPS(listenAddr, setting.CertFile, setting.KeyFile, context2.ClearHandler(m))
|
||||
case setting.FCGI:
|
||||
err = fcgi.Serve(nil, m)
|
||||
listener, err := net.Listen("tcp", listenAddr)
|
||||
if err != nil {
|
||||
log.Fatal(4, "Failed to bind %s", listenAddr, err)
|
||||
}
|
||||
defer listener.Close()
|
||||
err = fcgi.Serve(listener, context2.ClearHandler(m))
|
||||
case setting.UnixSocket:
|
||||
if err := os.Remove(listenAddr); err != nil {
|
||||
log.Fatal(4, "Fail to remove unix socket directory %s: %v", listenAddr, err)
|
||||
if err := os.Remove(listenAddr); err != nil && !os.IsNotExist(err) {
|
||||
log.Fatal(4, "Failed to remove unix socket directory %s: %v", listenAddr, err)
|
||||
}
|
||||
var listener *net.UnixListener
|
||||
listener, err = net.ListenUnix("unix", &net.UnixAddr{Name: listenAddr, Net: "unix"})
|
||||
@@ -623,13 +114,13 @@ func runWeb(ctx *cli.Context) error {
|
||||
if err = os.Chmod(listenAddr, os.FileMode(setting.UnixSocketPermission)); err != nil {
|
||||
log.Fatal(4, "Failed to set permission of unix socket: %v", err)
|
||||
}
|
||||
err = http.Serve(listener, m)
|
||||
err = http.Serve(listener, context2.ClearHandler(m))
|
||||
default:
|
||||
log.Fatal(4, "Invalid protocol: %s", setting.Protocol)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(4, "Fail to start server: %v", err)
|
||||
log.Fatal(4, "Failed to start server: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
45
cmd/web_graceful.go
Normal file
45
cmd/web_graceful.go
Normal file
@@ -0,0 +1,45 @@
|
||||
// +build !windows
|
||||
|
||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
||||
"github.com/facebookgo/grace/gracehttp"
|
||||
)
|
||||
|
||||
func runHTTP(listenAddr string, m http.Handler) error {
|
||||
return gracehttp.Serve(&http.Server{
|
||||
Addr: listenAddr,
|
||||
Handler: m,
|
||||
})
|
||||
}
|
||||
|
||||
func runHTTPS(listenAddr, certFile, keyFile string, m http.Handler) error {
|
||||
config := &tls.Config{
|
||||
MinVersion: tls.VersionTLS10,
|
||||
}
|
||||
if config.NextProtos == nil {
|
||||
config.NextProtos = []string{"http/1.1"}
|
||||
}
|
||||
|
||||
config.Certificates = make([]tls.Certificate, 1)
|
||||
var err error
|
||||
config.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile)
|
||||
if err != nil {
|
||||
log.Fatal(4, "Failed to load https cert file %s: %v", listenAddr, err)
|
||||
}
|
||||
|
||||
return gracehttp.Serve(&http.Server{
|
||||
Addr: listenAddr,
|
||||
Handler: m,
|
||||
TLSConfig: config,
|
||||
})
|
||||
}
|
19
cmd/web_windows.go
Normal file
19
cmd/web_windows.go
Normal file
@@ -0,0 +1,19 @@
|
||||
// +build windows
|
||||
|
||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func runHTTP(listenAddr string, m http.Handler) error {
|
||||
return http.ListenAndServe(listenAddr, m)
|
||||
}
|
||||
|
||||
func runHTTPS(listenAddr, certFile, keyFile string, m http.Handler) error {
|
||||
return http.ListenAndServeTLS(listenAddr, certFile, keyFile, m)
|
||||
}
|
131
conf/app.ini
vendored
131
conf/app.ini
vendored
@@ -32,6 +32,10 @@ LINE_WRAP_EXTENSIONS = .txt,.md,.markdown,.mdown,.mkd,
|
||||
; Separate values by commas. Preview tab in edit mode won't show if the file extension doesn't match
|
||||
PREVIEWABLE_FILE_MODES = markdown
|
||||
|
||||
[repository.local]
|
||||
; Path for uploads. Defaults to `tmp/local-repo`
|
||||
LOCAL_COPY_PATH = tmp/local-repo
|
||||
|
||||
[repository.upload]
|
||||
; Whether repository file uploads are enabled. Defaults to `true`
|
||||
ENABLED = true
|
||||
@@ -57,6 +61,8 @@ FEED_MAX_COMMIT_NUM = 5
|
||||
THEME_COLOR_META_TAG = `#6cc644`
|
||||
; Max size of files to be displayed (defaults is 8MiB)
|
||||
MAX_DISPLAY_FILE_SIZE = 8388608
|
||||
; Whether show the user email in the Explore Users page
|
||||
SHOW_USER_EMAIL = true
|
||||
|
||||
[ui.admin]
|
||||
; Number of users that are showed in one page
|
||||
@@ -72,6 +78,11 @@ ORG_PAGING_NUM = 50
|
||||
; Number of repos that are showed in one page
|
||||
REPO_PAGING_NUM = 15
|
||||
|
||||
[ui.meta]
|
||||
AUTHOR = Gitea - Git with a cup of tea
|
||||
DESCRIPTION = Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go
|
||||
KEYWORDS = go,git,self-hosted,gitea
|
||||
|
||||
[markdown]
|
||||
; Enable hard line break extension
|
||||
ENABLE_HARD_LINE_BREAK = false
|
||||
@@ -83,9 +94,11 @@ CUSTOM_URL_SCHEMES =
|
||||
FILE_EXTENSIONS = .md,.markdown,.mdown,.mkd
|
||||
|
||||
[server]
|
||||
; Listen protocol. One of 'http', 'https', 'unix' or 'fcgi'.
|
||||
PROTOCOL = http
|
||||
DOMAIN = localhost
|
||||
ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
|
||||
; Listen address. Either a IPv4/IPv6 address or the path to a unix socket.
|
||||
HTTP_ADDR = 0.0.0.0
|
||||
HTTP_PORT = 3000
|
||||
; Permission for unix socket
|
||||
@@ -101,18 +114,22 @@ START_SSH_SERVER = false
|
||||
; Domain name to be exposed in clone URL
|
||||
SSH_DOMAIN = %(DOMAIN)s
|
||||
; Network interface builtin SSH server listens on
|
||||
SSH_LISTEN_HOST =
|
||||
SSH_LISTEN_HOST =
|
||||
; Port number to be exposed in clone URL
|
||||
SSH_PORT = 22
|
||||
; Port number builtin SSH server listens on
|
||||
SSH_LISTEN_PORT = %(SSH_PORT)s
|
||||
; Root path of SSH directory, default is '~/.ssh', but you have to use '/home/git/.ssh'.
|
||||
SSH_ROOT_PATH =
|
||||
; Directory to create temporary files when test publick key using ssh-keygen,
|
||||
; Directory to create temporary files when test public key using ssh-keygen,
|
||||
; default is system temporary directory.
|
||||
SSH_KEY_TEST_PATH =
|
||||
; Path to ssh-keygen, default is 'ssh-keygen' and let shell find out which one to call.
|
||||
SSH_KEYGEN_PATH = ssh-keygen
|
||||
; Enable SSH Authorized Key Backup when rewriting all keys, default is true
|
||||
SSH_BACKUP_AUTHORIZED_KEYS = true
|
||||
; Enable exposure of SSH clone URL to anonymous visitors, default is false
|
||||
SSH_EXPOSE_ANONYMOUS = false
|
||||
; Indicate whether to check minimum key size with corresponding type
|
||||
MINIMUM_KEY_SIZE_CHECK = false
|
||||
; Disable CDN even in "prod" mode
|
||||
@@ -136,6 +153,12 @@ APP_DATA_PATH = data
|
||||
ENABLE_GZIP = false
|
||||
; Landing page for non-logged users, can be "home" or "explore"
|
||||
LANDING_PAGE = home
|
||||
; Enables git-lfs support. true or false, default is false.
|
||||
LFS_START_SERVER = false
|
||||
; Where your lfs files put on, default is data/lfs.
|
||||
LFS_CONTENT_PATH = data/lfs
|
||||
; LFS authentication secret, changed this to yourself.
|
||||
LFS_JWT_SECRET =
|
||||
|
||||
; Define allowed algorithms and their minimum key length (use -1 to disable a type)
|
||||
[ssh.minimum_key_sizes]
|
||||
@@ -145,7 +168,7 @@ RSA = 2048
|
||||
DSA = 1024
|
||||
|
||||
[database]
|
||||
; Either "mysql", "postgres" or "sqlite3", it's your choice
|
||||
; Either "mysql", "postgres", "mssql" or "sqlite3", it's your choice
|
||||
DB_TYPE = mysql
|
||||
HOST = 127.0.0.1:3306
|
||||
NAME = gitea
|
||||
@@ -155,10 +178,19 @@ PASSWD =
|
||||
SSL_MODE = disable
|
||||
; For "sqlite3" and "tidb", use absolute path when you start as service
|
||||
PATH = data/gitea.db
|
||||
; For "sqlite3" only. Query timeout
|
||||
SQLITE_TIMEOUT = 500
|
||||
|
||||
[indexer]
|
||||
ISSUE_INDEXER_PATH = indexers/issues.bleve
|
||||
UPDATE_BUFFER_LEN = 20
|
||||
|
||||
[admin]
|
||||
; Disable regular (non-admin) users to create organizations
|
||||
DISABLE_REGULAR_ORG_CREATION = false
|
||||
|
||||
[security]
|
||||
; Whether the installer is disabled
|
||||
INSTALL_LOCK = false
|
||||
; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!!
|
||||
SECRET_KEY = !#@FDEWREWR&*(
|
||||
@@ -168,9 +200,49 @@ COOKIE_USERNAME = gitea_awesome
|
||||
COOKIE_REMEMBER_NAME = gitea_incredible
|
||||
; Reverse proxy authentication header name of user name
|
||||
REVERSE_PROXY_AUTHENTICATION_USER = X-WEBAUTH-USER
|
||||
; Sets the minimum password length for new Users
|
||||
MIN_PASSWORD_LENGTH = 6
|
||||
; True when users are allowed to import local server paths
|
||||
IMPORT_LOCAL_PATHS = false
|
||||
|
||||
[openid]
|
||||
;
|
||||
; OpenID is an open standard and decentralized authentication protocol.
|
||||
; Your identity is the address of a webpage you provide, which describes
|
||||
; how to prove you are in control of that page.
|
||||
;
|
||||
; For more info: https://en.wikipedia.org/wiki/OpenID
|
||||
;
|
||||
; Current implementation supports OpenID-2.0
|
||||
;
|
||||
; Tested to work providers at the time of writing:
|
||||
; - Any GNUSocial node (your.hostname.tld/username)
|
||||
; - Any SimpleID provider (http://simpleid.koinic.net)
|
||||
; - http://openid.org.cn/
|
||||
; - openid.stackexchange.com
|
||||
; - login.launchpad.net
|
||||
; - <username>.livejournal.com
|
||||
;
|
||||
; Whether to allow signin in via OpenID
|
||||
ENABLE_OPENID_SIGNIN = true
|
||||
; Whether to allow registering via OpenID
|
||||
; Do not include to rely on DISABLE_REGISTRATION setting
|
||||
;ENABLE_OPENID_SIGNUP = true
|
||||
; Allowed URI patterns (POSIX regexp).
|
||||
; Space separated.
|
||||
; Only these would be allowed if non-blank.
|
||||
; Example value: trusted.domain.org trusted.domain.net
|
||||
WHITELISTED_URIS =
|
||||
; Forbidden URI patterns (POSIX regexp).
|
||||
; Space sepaated.
|
||||
; Only used if WHITELISTED_URIS is blank.
|
||||
; Example value: loadaverage.org/badguy stackexchange.com/.*spammer
|
||||
BLACKLISTED_URIS =
|
||||
|
||||
[service]
|
||||
; Time limit to confirm account/email registration
|
||||
ACTIVE_CODE_LIVE_MINUTES = 180
|
||||
; Time limit to confirm forgot password reset process
|
||||
RESET_PASSWD_CODE_LIVE_MINUTES = 180
|
||||
; User need to confirm e-mail for registration
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
@@ -185,6 +257,16 @@ ENABLE_REVERSE_PROXY_AUTHENTICATION = false
|
||||
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = false
|
||||
; Enable captcha validation for registration
|
||||
ENABLE_CAPTCHA = true
|
||||
; Default value for KeepEmailPrivate
|
||||
; New user will get the value of this setting copied into their profile
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||
; Default value for AllowCreateOrganization
|
||||
; New user will have rights set to create organizations depending on this setting
|
||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||
; Default value for the domain part of the user's email address in the git log
|
||||
; if he has set KeepEmailPrivate true. The user's email replaced with a
|
||||
; concatenation of the user name in lower case, "@" and NO_REPLY_ADDRESS.
|
||||
NO_REPLY_ADDRESS = noreply.example.org
|
||||
|
||||
[webhook]
|
||||
; Hook task queue length, increase if webhook shooting starts hanging
|
||||
@@ -222,8 +304,12 @@ FROM =
|
||||
; Mailer user name and password
|
||||
USER =
|
||||
PASSWD =
|
||||
; Use text/html as alternative format of content
|
||||
ENABLE_HTML_ALTERNATIVE = false
|
||||
; Send mails as plain text
|
||||
SEND_AS_PLAIN_TEXT = false
|
||||
; Enable sendmail (override SMTP)
|
||||
USE_SENDMAIL = false
|
||||
; Specifiy an alternative sendmail binary
|
||||
SENDMAIL_PATH = sendmail
|
||||
|
||||
[cache]
|
||||
; Either "memory", "redis", or "memcache", default is "memory"
|
||||
@@ -245,14 +331,14 @@ PROVIDER = memory
|
||||
; mysql: go-sql-driver/mysql dsn config string, e.g. `root:password@/session_table`
|
||||
PROVIDER_CONFIG = data/sessions
|
||||
; Session cookie name
|
||||
COOKIE_NAME = i_like_gogits
|
||||
COOKIE_NAME = i_like_gitea
|
||||
; If you use session in https only, default is false
|
||||
COOKIE_SECURE = false
|
||||
; Enable set cookie, default is true
|
||||
ENABLE_SET_COOKIE = true
|
||||
; Session GC time interval, default is 86400
|
||||
; Session GC time interval in seconds, default is 86400 (1 day)
|
||||
GC_INTERVAL_TIME = 86400
|
||||
; Session life time, default is 86400
|
||||
; Session life time in seconds, default is 86400 (1 day)
|
||||
SESSION_LIFE_TIME = 86400
|
||||
|
||||
[picture]
|
||||
@@ -273,7 +359,7 @@ ENABLE = true
|
||||
; Path for attachments. Defaults to `data/attachments`
|
||||
PATH = data/attachments
|
||||
; One or more allowed types, e.g. image/jpeg|image/png
|
||||
ALLOWED_TYPES = image/jpeg|image/png
|
||||
ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip
|
||||
; Max size of each file. Defaults to 32MB
|
||||
MAX_SIZE = 4
|
||||
; Max number of files per upload. Defaults to 10
|
||||
@@ -369,13 +455,30 @@ ARGS =
|
||||
RUN_AT_START = true
|
||||
SCHEDULE = @every 24h
|
||||
|
||||
; Clean up old repository archives
|
||||
[cron.archive_cleanup]
|
||||
RUN_AT_START = true
|
||||
SCHEDULE = @every 24h
|
||||
; Archives created more than OLDER_THAN ago are subject to deletion
|
||||
OLDER_THAN = 24h
|
||||
|
||||
; Synchronize external user data (only LDAP user synchronization is supported)
|
||||
[cron.sync_external_users]
|
||||
; Syncronize external user data when starting server (default false)
|
||||
RUN_AT_START = false
|
||||
; Interval as a duration between each synchronization (default every 24h)
|
||||
SCHEDULE = @every 24h
|
||||
; Create new users, update existing user data and disable users that are not in external source anymore (default)
|
||||
; or only create new users if UPDATE_EXISTING is set to false
|
||||
UPDATE_EXISTING = true
|
||||
|
||||
[git]
|
||||
; Disables highlight of added and removed changes
|
||||
DISABLE_DIFF_HIGHLIGHT = false
|
||||
; Max number of lines allowed of a single file in diff view
|
||||
MAX_GIT_DIFF_LINES = 1000
|
||||
; Max number of characters of a line allowed in diff view
|
||||
MAX_GIT_DIFF_LINE_CHARACTERS = 500
|
||||
MAX_GIT_DIFF_LINE_CHARACTERS = 5000
|
||||
; Max number of files shown in diff view
|
||||
MAX_GIT_DIFF_FILES = 100
|
||||
; Arguments for command 'git gc', e.g. "--aggressive --auto"
|
||||
@@ -391,8 +494,10 @@ PULL = 300
|
||||
GC = 60
|
||||
|
||||
[mirror]
|
||||
; Default interval in hours between each check
|
||||
DEFAULT_INTERVAL = 8
|
||||
; Default interval as a duration between each check
|
||||
DEFAULT_INTERVAL = 8h
|
||||
; Min interval as a duration must be > 1m
|
||||
MIN_INTERVAL = 10m
|
||||
|
||||
[api]
|
||||
; Max number of items will response in a page
|
||||
@@ -400,7 +505,7 @@ MAX_RESPONSE_ITEMS = 50
|
||||
|
||||
[i18n]
|
||||
LANGS = en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR
|
||||
NAMES = English,简体中文,繁體中文(香港),繁體中文(台湾),Deutsch,Français,Nederlands,Latviešu,Русский,日本語,Español,Português do Brasil,Polski,български,Italiano,Suomalainen,Türkçe,čeština,Српски,Svenska,한국어
|
||||
NAMES = English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,Français,Nederlands,Latviešu,Русский,日本語,Español,Português do Brasil,Polski,български,Italiano,Suomalainen,Türkçe,čeština,Српски,Svenska,한국어
|
||||
|
||||
; Used for datetimepicker
|
||||
[i18n.datelang]
|
||||
|
86
contrib/init/debian/gitea
Normal file
86
contrib/init/debian/gitea
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: gitea
|
||||
# Required-Start: $syslog $network
|
||||
# Required-Stop: $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: A self-hosted Git service written in Go.
|
||||
# Description: A self-hosted Git service written in Go.
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Danny Boisvert
|
||||
|
||||
# Do NOT "set -e"
|
||||
|
||||
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="Git with a cup of tea"
|
||||
NAME=gitea
|
||||
SERVICEVERBOSE=yes
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
WORKINGDIR=/home/git/gitea
|
||||
DAEMON=$WORKINGDIR/$NAME
|
||||
DAEMON_ARGS="web"
|
||||
USER=git
|
||||
USERBIND="setcap cap_net_bind_service=+ep"
|
||||
STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/1/KILL/5}"
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x "$DAEMON" ] || exit 0
|
||||
|
||||
do_start()
|
||||
{
|
||||
$USERBIND $DAEMON
|
||||
sh -c "USER=$USER start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
|
||||
--background --chdir $WORKINGDIR --chuid $USER \\
|
||||
--exec $DAEMON -- $DAEMON_ARGS"
|
||||
}
|
||||
|
||||
do_stop()
|
||||
{
|
||||
start-stop-daemon --stop --quiet --retry=$STOP_SCHEDULE --pidfile $PIDFILE --name $NAME --oknodo
|
||||
rm -f $PIDFILE
|
||||
}
|
||||
|
||||
do_status()
|
||||
{
|
||||
if [ -f $PIDFILE ]; then
|
||||
if kill -0 $(cat "$PIDFILE"); then
|
||||
echo "$NAME is running, PID is $(cat $PIDFILE)"
|
||||
else
|
||||
echo "$NAME process is dead, but pidfile exists"
|
||||
fi
|
||||
else
|
||||
echo "$NAME is not running"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
;;
|
||||
status)
|
||||
do_status
|
||||
;;
|
||||
restart)
|
||||
echo "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
do_start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
206
contrib/migrate/gogs_migrate.sh
Executable file
206
contrib/migrate/gogs_migrate.sh
Executable file
@@ -0,0 +1,206 @@
|
||||
#!/bin/bash
|
||||
|
||||
gitea_version=1.0.1
|
||||
tested_gogs_version="0.9.114.1227"
|
||||
gogs_binary=gogs
|
||||
gitea_binary=gitea
|
||||
download_gitea=true
|
||||
gitea_path=
|
||||
|
||||
function usage() {
|
||||
echo "Optional parameters: [-b Gitea binary] [-i Gitea install dir] [-o gogs binary] [-h help]";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
while getopts ":b::i:o:h:" opt; do
|
||||
case $opt in
|
||||
b)
|
||||
gitea_binary=${OPTARG}
|
||||
download_gitea=false
|
||||
;;
|
||||
i)
|
||||
gitea_path=${OPTARG}
|
||||
;;
|
||||
o)
|
||||
gogs_binary=${OPTARG}
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
;;
|
||||
\?)
|
||||
echo -e "Invalid option: -$OPTARG"
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
function exitOnError() {
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $1
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function checkBinary() {
|
||||
if [ ! -f $1 ]; then
|
||||
echo "Unable to find $1"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function continueYN(){
|
||||
while true; do
|
||||
echo -e "$1 Yes or No"
|
||||
read yn
|
||||
case $yn in
|
||||
[Yy]* ) break;;
|
||||
[Nn]* ) exit 1;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
########## Binary checks
|
||||
if pidof "$gogs_binary" >/dev/null; then
|
||||
echo "Please stop gogs before migrating to Gitea"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
checkBinary "$gogs_binary"
|
||||
|
||||
if [ ! -x "$gogs_binary" ]; then
|
||||
echo "Please make sure that you are running this script as the gogs user"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
########## Version check
|
||||
gogs_version=$(./$gogs_binary --version)
|
||||
original_IFS=$IFS
|
||||
IFS="." && current_version=(${gogs_version#"Gogs version "}) && minimal_version=($tested_gogs_version)
|
||||
IFS=$original_IFS
|
||||
|
||||
count=0
|
||||
for i in "${current_version[@]}"
|
||||
do
|
||||
if [ $i -gt ${minimal_version[$count]} ]; then
|
||||
echo -e "!!!--WARNING--!!!\nYour $gogs_version is newer than the tested Gogs version $tested_gogs_version\nUse this script on your own risk\n!!!--WARNING--!!!"
|
||||
break
|
||||
fi
|
||||
let count+=1
|
||||
done
|
||||
|
||||
########## Disclaimer
|
||||
continueYN "This migration script creates a backup before it starts with the actual migration
|
||||
If something goes wrong you could always resotre this backup.
|
||||
The backups are stored into your gogs folder in gogs-dump-[timestamp].zip file
|
||||
|
||||
Migrating from gogs to gitea, are you sure?"
|
||||
|
||||
########## gogs dump
|
||||
echo "Creating a backup of gogs, this could take a while..."
|
||||
./"$gogs_binary" dump
|
||||
exitOnError "Failed to create a gogs dump"
|
||||
|
||||
########## Create Gitea folder
|
||||
if [ -z "$gitea_path" ]; then
|
||||
echo "Where do you want to install Gitea?"
|
||||
read gitea_path
|
||||
fi
|
||||
|
||||
if [ ! -d "$gitea_path" ]; then
|
||||
mkdir -p "$gitea_path"
|
||||
exitOnError
|
||||
fi
|
||||
|
||||
if [ "$(ls -A $gitea_path)" ]; then
|
||||
continueYN "!!!--WARNING--!!!\nDirectory $gitea_path is not empty, do you want to continue?"
|
||||
fi
|
||||
|
||||
|
||||
########## Download Gitea
|
||||
if [ $download_gitea == true ]; then
|
||||
|
||||
########## Detect os
|
||||
case "$OSTYPE" in
|
||||
darwin*) platform="darwin-10.6";;
|
||||
linux*) platform="linux" ;;
|
||||
freebsd*) platform="bsd" ;;
|
||||
netbsd*) platform="bsd" ;;
|
||||
openbsd*) platform="bsd" ;;
|
||||
*) echo "Unsupported os: $OSTYPE\n Please download/compile your own binary and run this script with the -b option" exit 1;;
|
||||
esac
|
||||
|
||||
arch=""
|
||||
bits=""
|
||||
if [[ "$platform" == "linux" ]] || [[ "$platform" == "bsd" ]]; then
|
||||
arch="$(uname -m | sed -e 's/arm\(.*\)/arm-\1/' -e s/aarch64.*/arm64/)"
|
||||
fi
|
||||
|
||||
if [[ "$platform" == "bsd" ]] && [[ "$arch" != "arm"* ]]; then
|
||||
echo "Currently Gitea only supports arm prebuilt binarys on bsd"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$arch" != "arm"* ]] && [[ "$arch" != "mips"* ]]; then
|
||||
arch=""
|
||||
case "$(getconf LONG_BIT)" in
|
||||
64*) bits="amd64";;
|
||||
32*) bits="386" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
########## Wget Gitea
|
||||
echo "Downloading Gitea"
|
||||
file="gitea-$gitea_version-$platform-$arch$bits"
|
||||
url="https://dl.gitea.io/gitea/$gitea_version/$file"
|
||||
wget "$url" -P "$gitea_path"
|
||||
exitOnError "Failed to download $url"
|
||||
|
||||
wget "$url.sha256" -P "$gitea_path"
|
||||
exitOnError "Failed to Gitea checksum $url.sha256"
|
||||
|
||||
echo "Comparing checksums"
|
||||
gogs_dir=$(pwd)
|
||||
cd "$gitea_path"
|
||||
|
||||
sha256sum -c "$file.sha256"
|
||||
exitOnError "Downloaded Gitea checksums do not match"
|
||||
|
||||
rm "$file.sha256"
|
||||
mv "$file" gitea
|
||||
cd "$gogs_dir"
|
||||
|
||||
else
|
||||
checkBinary "$gitea_binary"
|
||||
if [ "$gitea_binary" != "$gitea_path/gitea" ];then
|
||||
cp "$gitea_binary" "$gitea_path/gitea"
|
||||
fi
|
||||
fi
|
||||
|
||||
########## Copy gogs data to Gitea folder
|
||||
echo "Copying gogs data to Gitea, this could take a while..."
|
||||
cp -R custom "$gitea_path"
|
||||
cp -R data "$gitea_path"
|
||||
#cp -R conf "$gitea_path"
|
||||
|
||||
########## Moving & deleting old files
|
||||
#mv $gitea_path/conf $gitea_path/options
|
||||
cd "$gitea_path"
|
||||
mv "custom/conf/app.ini" "custom/conf/gogs_app.ini"
|
||||
url="https://raw.githubusercontent.com/go-gitea/gitea/v$gitea_version/conf/app.ini"
|
||||
wget "$url" -P "custom/conf/"
|
||||
exitOnError "Unable to download Gitea app.ini"
|
||||
rm -f conf/README.md
|
||||
|
||||
echo -e "Migration is almost complete, you only need to merge custom/conf/gogs_app.ini into custom/conf/app.ini"
|
||||
continueYN "Do you want to start Gitea?"
|
||||
|
||||
########## Starting Gitea
|
||||
echo "Starting Gitea"
|
||||
chmod +x gitea
|
||||
./gitea web
|
||||
exitOnError "Failed to start Gitea"
|
2
contrib/mysql.sql
Normal file
2
contrib/mysql.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
DROP DATABASE IF EXISTS gitea;
|
||||
CREATE DATABASE IF NOT EXISTS gitea CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
@@ -8,7 +8,7 @@ TEMP_PATH = /data/gitea/uploads
|
||||
APP_DATA_PATH = /data/gitea
|
||||
|
||||
[database]
|
||||
HOST = mysql:3306
|
||||
DB_TYPE = sqlite3
|
||||
PATH = /data/gitea/gitea.db
|
||||
|
||||
[session]
|
||||
|
44
integrations/api_branch_test.go
Normal file
44
integrations/api_branch_test.go
Normal file
@@ -0,0 +1,44 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func testAPIGetBranch(t *testing.T, branchName string, exists bool) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
req := NewRequestf(t, "GET", "/api/v1/repos/user2/repo1/branches/%s", branchName)
|
||||
resp := session.MakeRequest(t, req, NoExpectedStatus)
|
||||
if !exists {
|
||||
assert.EqualValues(t, http.StatusNotFound, resp.HeaderCode)
|
||||
return
|
||||
}
|
||||
assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
|
||||
var branch api.Branch
|
||||
DecodeJSON(t, resp, &branch)
|
||||
assert.EqualValues(t, branchName, branch.Name)
|
||||
}
|
||||
|
||||
func TestAPIGetBranch(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
BranchName string
|
||||
Exists bool
|
||||
}{
|
||||
{"master", true},
|
||||
{"master/doesnotexist", false},
|
||||
{"feature/1", true},
|
||||
{"feature/1/doesnotexist", false},
|
||||
} {
|
||||
testAPIGetBranch(t, test.BranchName, test.Exists)
|
||||
}
|
||||
}
|
125
integrations/api_comment_test.go
Normal file
125
integrations/api_comment_test.go
Normal file
@@ -0,0 +1,125 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAPIListRepoComments(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
comment := models.AssertExistsAndLoadBean(t, &models.Comment{},
|
||||
models.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
|
||||
issue := models.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
|
||||
repoOwner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
|
||||
session := loginUser(t, repoOwner.Name)
|
||||
req := NewRequestf(t, "GET", "/api/v1/repos/%s/%s/issues/comments",
|
||||
repoOwner.Name, repo.Name)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var apiComments []*api.Comment
|
||||
DecodeJSON(t, resp, &apiComments)
|
||||
for _, apiComment := range apiComments {
|
||||
c := &models.Comment{ID: apiComment.ID}
|
||||
models.AssertExistsAndLoadBean(t, c,
|
||||
models.Cond("type = ?", models.CommentTypeComment))
|
||||
models.AssertExistsAndLoadBean(t, &models.Issue{ID: c.IssueID, RepoID: repo.ID})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPIListIssueComments(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
comment := models.AssertExistsAndLoadBean(t, &models.Comment{},
|
||||
models.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
|
||||
issue := models.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
|
||||
repoOwner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
|
||||
session := loginUser(t, repoOwner.Name)
|
||||
req := NewRequestf(t, "GET", "/api/v1/repos/%s/%s/issues/%d/comments",
|
||||
repoOwner.Name, repo.Name, issue.Index)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var comments []*api.Comment
|
||||
DecodeJSON(t, resp, &comments)
|
||||
expectedCount := models.GetCount(t, &models.Comment{IssueID: issue.ID},
|
||||
models.Cond("type = ?", models.CommentTypeComment))
|
||||
assert.EqualValues(t, expectedCount, len(comments))
|
||||
}
|
||||
|
||||
func TestAPICreateComment(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
const commentBody = "Comment body"
|
||||
|
||||
issue := models.AssertExistsAndLoadBean(t, &models.Issue{}).(*models.Issue)
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
|
||||
repoOwner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
|
||||
session := loginUser(t, repoOwner.Name)
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/comments",
|
||||
repoOwner.Name, repo.Name, issue.Index)
|
||||
req := NewRequestWithValues(t, "POST", urlStr, map[string]string{
|
||||
"body": commentBody,
|
||||
})
|
||||
resp := session.MakeRequest(t, req, http.StatusCreated)
|
||||
|
||||
var updatedComment api.Comment
|
||||
DecodeJSON(t, resp, &updatedComment)
|
||||
assert.EqualValues(t, commentBody, updatedComment.Body)
|
||||
models.AssertExistsAndLoadBean(t, &models.Comment{ID: updatedComment.ID, IssueID: issue.ID, Content: commentBody})
|
||||
}
|
||||
|
||||
func TestAPIEditComment(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
const newCommentBody = "This is the new comment body"
|
||||
|
||||
comment := models.AssertExistsAndLoadBean(t, &models.Comment{},
|
||||
models.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
|
||||
issue := models.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
|
||||
repoOwner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
|
||||
session := loginUser(t, repoOwner.Name)
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/comments/%d",
|
||||
repoOwner.Name, repo.Name, issue.Index, comment.ID)
|
||||
req := NewRequestWithValues(t, "PATCH", urlStr, map[string]string{
|
||||
"body": newCommentBody,
|
||||
})
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var updatedComment api.Comment
|
||||
DecodeJSON(t, resp, &updatedComment)
|
||||
assert.EqualValues(t, comment.ID, updatedComment.ID)
|
||||
assert.EqualValues(t, newCommentBody, updatedComment.Body)
|
||||
models.AssertExistsAndLoadBean(t, &models.Comment{ID: comment.ID, IssueID: issue.ID, Content: newCommentBody})
|
||||
}
|
||||
|
||||
func TestAPIDeleteComment(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
comment := models.AssertExistsAndLoadBean(t, &models.Comment{},
|
||||
models.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
|
||||
issue := models.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
|
||||
repoOwner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
|
||||
session := loginUser(t, repoOwner.Name)
|
||||
req := NewRequestf(t, "DELETE", "/api/v1/repos/%s/%s/issues/%d/comments/%d",
|
||||
repoOwner.Name, repo.Name, issue.Index, comment.ID)
|
||||
session.MakeRequest(t, req, http.StatusNoContent)
|
||||
|
||||
models.AssertNotExistsBean(t, &models.Comment{ID: comment.ID})
|
||||
}
|
18
integrations/api_fork_test.go
Normal file
18
integrations/api_fork_test.go
Normal file
@@ -0,0 +1,18 @@
|
||||
// Copyright 2017 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
)
|
||||
|
||||
func TestCreateForkNoLogin(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequestWithJSON(t, "POST", "/api/v1/repos/user2/repo1/forks", &api.CreateForkOption{})
|
||||
MakeRequest(t, req, http.StatusUnauthorized)
|
||||
}
|
62
integrations/api_issue_label_test.go
Normal file
62
integrations/api_issue_label_test.go
Normal file
@@ -0,0 +1,62 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAPIAddIssueLabels(t *testing.T) {
|
||||
assert.NoError(t, models.LoadFixtures())
|
||||
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
|
||||
issue := models.AssertExistsAndLoadBean(t, &models.Issue{RepoID: repo.ID}).(*models.Issue)
|
||||
label := models.AssertExistsAndLoadBean(t, &models.Label{RepoID: repo.ID}).(*models.Label)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/labels",
|
||||
owner.Name, repo.Name, issue.Index)
|
||||
req := NewRequestWithJSON(t, "POST", urlStr, &api.IssueLabelsOption{
|
||||
Labels: []int64{label.ID},
|
||||
})
|
||||
session := loginUser(t, owner.Name)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
var apiLabels []*api.Label
|
||||
DecodeJSON(t, resp, &apiLabels)
|
||||
assert.Len(t, apiLabels, models.GetCount(t, &models.IssueLabel{IssueID: issue.ID}))
|
||||
|
||||
models.AssertExistsAndLoadBean(t, &models.IssueLabel{IssueID: issue.ID, LabelID: label.ID})
|
||||
}
|
||||
|
||||
func TestAPIReplaceIssueLabels(t *testing.T) {
|
||||
assert.NoError(t, models.LoadFixtures())
|
||||
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
|
||||
issue := models.AssertExistsAndLoadBean(t, &models.Issue{RepoID: repo.ID}).(*models.Issue)
|
||||
label := models.AssertExistsAndLoadBean(t, &models.Label{RepoID: repo.ID}).(*models.Label)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/labels",
|
||||
owner.Name, repo.Name, issue.Index)
|
||||
req := NewRequestWithJSON(t, "PUT", urlStr, &api.IssueLabelsOption{
|
||||
Labels: []int64{label.ID},
|
||||
})
|
||||
session := loginUser(t, owner.Name)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
var apiLabels []*api.Label
|
||||
DecodeJSON(t, resp, &apiLabels)
|
||||
assert.Len(t, apiLabels, 1)
|
||||
assert.EqualValues(t, label.ID, apiLabels[0].ID)
|
||||
|
||||
models.AssertCount(t, &models.IssueLabel{IssueID: issue.ID}, 1)
|
||||
models.AssertExistsAndLoadBean(t, &models.IssueLabel{IssueID: issue.ID, LabelID: label.ID})
|
||||
}
|
63
integrations/api_issue_test.go
Normal file
63
integrations/api_issue_test.go
Normal file
@@ -0,0 +1,63 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
|
||||
"fmt"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAPIListIssues(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
|
||||
session := loginUser(t, owner.Name)
|
||||
req := NewRequestf(t, "GET", "/api/v1/repos/%s/%s/issues?state=all",
|
||||
owner.Name, repo.Name)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
var apiIssues []*api.Issue
|
||||
DecodeJSON(t, resp, &apiIssues)
|
||||
assert.Len(t, apiIssues, models.GetCount(t, &models.Issue{RepoID: repo.ID}))
|
||||
for _, apiIssue := range apiIssues {
|
||||
models.AssertExistsAndLoadBean(t, &models.Issue{ID: apiIssue.ID, RepoID: repo.ID})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPICreateIssue(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
const body, title = "apiTestBody", "apiTestTitle"
|
||||
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
|
||||
session := loginUser(t, owner.Name)
|
||||
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues?state=all", owner.Name, repo.Name)
|
||||
req := NewRequestWithJSON(t, "POST", urlStr, &api.CreateIssueOption{
|
||||
Body: body,
|
||||
Title: title,
|
||||
Assignee: owner.Name,
|
||||
})
|
||||
resp := session.MakeRequest(t, req, http.StatusCreated)
|
||||
var apiIssue api.Issue
|
||||
DecodeJSON(t, resp, &apiIssue)
|
||||
assert.Equal(t, apiIssue.Body, body)
|
||||
assert.Equal(t, apiIssue.Title, title)
|
||||
|
||||
models.AssertExistsAndLoadBean(t, &models.Issue{
|
||||
RepoID: repo.ID,
|
||||
AssigneeID: owner.ID,
|
||||
Content: body,
|
||||
Title: title,
|
||||
})
|
||||
}
|
39
integrations/api_keys_test.go
Normal file
39
integrations/api_keys_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright 2017 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
)
|
||||
|
||||
func TestViewDeployKeysNoLogin(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo1/keys")
|
||||
MakeRequest(t, req, http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
func TestCreateDeployKeyNoLogin(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequestWithJSON(t, "POST", "/api/v1/repos/user2/repo1/keys", api.CreateKeyOption{
|
||||
Title: "title",
|
||||
Key: "key",
|
||||
})
|
||||
MakeRequest(t, req, http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
func TestGetDeployKeyNoLogin(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo1/keys/1")
|
||||
MakeRequest(t, req, http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
func TestDeleteDeployKeyNoLogin(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequest(t, "DELETE", "/api/v1/repos/user2/repo1/keys/1")
|
||||
MakeRequest(t, req, http.StatusUnauthorized)
|
||||
}
|
30
integrations/api_pull_test.go
Normal file
30
integrations/api_pull_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAPIViewPulls(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
req := NewRequestf(t, "GET", "/api/v1/repos/%s/%s/pulls?state=all", owner.Name, repo.Name)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var pulls []*api.PullRequest
|
||||
DecodeJSON(t, resp, &pulls)
|
||||
expectedLen := models.GetCount(t, &models.Issue{RepoID: repo.ID}, models.Cond("is_pull = ?", true))
|
||||
assert.Len(t, pulls, expectedLen)
|
||||
}
|
94
integrations/api_repo_test.go
Normal file
94
integrations/api_repo_test.go
Normal file
@@ -0,0 +1,94 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAPIUserReposNotLogin(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
|
||||
|
||||
req := NewRequestf(t, "GET", "/api/v1/users/%s/repos", user.Name)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var apiRepos []api.Repository
|
||||
DecodeJSON(t, resp, &apiRepos)
|
||||
expectedLen := models.GetCount(t, models.Repository{OwnerID: user.ID},
|
||||
models.Cond("is_private = ?", false))
|
||||
assert.Len(t, apiRepos, expectedLen)
|
||||
for _, repo := range apiRepos {
|
||||
assert.EqualValues(t, user.ID, repo.Owner.ID)
|
||||
assert.False(t, repo.Private)
|
||||
}
|
||||
}
|
||||
|
||||
type searchResponseBody struct {
|
||||
ok bool
|
||||
data []api.Repository
|
||||
}
|
||||
|
||||
func TestAPISearchRepoNotLogin(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
const keyword = "test"
|
||||
|
||||
req := NewRequestf(t, "GET", "/api/v1/repos/search?q=%s", keyword)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var body searchResponseBody
|
||||
DecodeJSON(t, resp, &body)
|
||||
for _, repo := range body.data {
|
||||
assert.True(t, strings.Contains(repo.Name, keyword))
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPIViewRepo(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo1")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var repo api.Repository
|
||||
DecodeJSON(t, resp, &repo)
|
||||
assert.EqualValues(t, 1, repo.ID)
|
||||
assert.EqualValues(t, "repo1", repo.Name)
|
||||
}
|
||||
|
||||
func TestAPIOrgRepos(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
|
||||
// User3 is an Org. Check their repos.
|
||||
sourceOrg := models.AssertExistsAndLoadBean(t, &models.User{ID: 3}).(*models.User)
|
||||
// Login as User2.
|
||||
session := loginUser(t, user.Name)
|
||||
|
||||
req := NewRequestf(t, "GET", "/api/v1/orgs/%s/repos", sourceOrg.Name)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var apiRepos []*api.Repository
|
||||
DecodeJSON(t, resp, &apiRepos)
|
||||
expectedLen := models.GetCount(t, models.Repository{OwnerID: sourceOrg.ID},
|
||||
models.Cond("is_private = ?", false))
|
||||
assert.Len(t, apiRepos, expectedLen)
|
||||
for _, repo := range apiRepos {
|
||||
assert.False(t, repo.Private)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPIGetRepoByIDUnauthorized(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 4}).(*models.User)
|
||||
sess := loginUser(t, user.Name)
|
||||
req := NewRequestf(t, "GET", "/api/v1/repositories/2")
|
||||
sess.MakeRequest(t, req, http.StatusNotFound)
|
||||
}
|
31
integrations/api_team_test.go
Normal file
31
integrations/api_team_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAPITeam(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
teamUser := models.AssertExistsAndLoadBean(t, &models.TeamUser{}).(*models.TeamUser)
|
||||
team := models.AssertExistsAndLoadBean(t, &models.Team{ID: teamUser.TeamID}).(*models.Team)
|
||||
user := models.AssertExistsAndLoadBean(t, &models.User{ID: teamUser.UID}).(*models.User)
|
||||
|
||||
session := loginUser(t, user.Name)
|
||||
req := NewRequestf(t, "GET", "/api/v1/teams/%d", teamUser.TeamID)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var apiTeam api.Team
|
||||
DecodeJSON(t, resp, &apiTeam)
|
||||
assert.EqualValues(t, team.ID, apiTeam.ID)
|
||||
assert.Equal(t, team.Name, apiTeam.Name)
|
||||
}
|
28
integrations/bare_repo_test.go
Normal file
28
integrations/bare_repo_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
)
|
||||
|
||||
func TestBareRepo(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
subpaths := []string{
|
||||
"commits/master",
|
||||
"raw/foo",
|
||||
"commit/1ae57b34ccf7e18373",
|
||||
"graph",
|
||||
}
|
||||
bareRepo := models.AssertExistsAndLoadBean(t, &models.Repository{}, models.Cond("is_bare = ?", true)).(*models.Repository)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: bareRepo.OwnerID}).(*models.User)
|
||||
for _, subpath := range subpaths {
|
||||
req := NewRequestf(t, "GET", "/%s/%s/%s", owner.Name, bareRepo.Name, subpath)
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
}
|
||||
}
|
38
integrations/change_default_branch_test.go
Normal file
38
integrations/change_default_branch_test.go
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
)
|
||||
|
||||
func TestChangeDefaultBranch(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
|
||||
session := loginUser(t, owner.Name)
|
||||
branchesURL := fmt.Sprintf("/%s/%s/settings/branches", owner.Name, repo.Name)
|
||||
|
||||
csrf := GetCSRF(t, session, branchesURL)
|
||||
req := NewRequestWithValues(t, "POST", branchesURL, map[string]string{
|
||||
"_csrf": csrf,
|
||||
"action": "default_branch",
|
||||
"branch": "DefaultBranch",
|
||||
})
|
||||
session.MakeRequest(t, req, http.StatusFound)
|
||||
|
||||
csrf = GetCSRF(t, session, branchesURL)
|
||||
req = NewRequestWithValues(t, "POST", branchesURL, map[string]string{
|
||||
"_csrf": csrf,
|
||||
"action": "default_branch",
|
||||
"branch": "does_not_exist",
|
||||
})
|
||||
session.MakeRequest(t, req, http.StatusNotFound)
|
||||
}
|
27
integrations/delete_user_test.go
Normal file
27
integrations/delete_user_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
)
|
||||
|
||||
func TestDeleteUser(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
session := loginUser(t, "user1")
|
||||
|
||||
csrf := GetCSRF(t, session, "/admin/users/8")
|
||||
req := NewRequestWithValues(t, "POST", "/admin/users/8/delete", map[string]string{
|
||||
"_csrf": csrf,
|
||||
})
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
models.AssertNotExistsBean(t, &models.User{ID: 8})
|
||||
models.CheckConsistencyFor(t, &models.User{})
|
||||
}
|
154
integrations/editor_test.go
Normal file
154
integrations/editor_test.go
Normal file
@@ -0,0 +1,154 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCreateFile(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
// Request editor page
|
||||
req := NewRequest(t, "GET", "/user2/repo1/_new/master/")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
doc := NewHTMLParser(t, resp.Body)
|
||||
lastCommit := doc.GetInputValueByName("last_commit")
|
||||
assert.NotEmpty(t, lastCommit)
|
||||
|
||||
// Save new file to master branch
|
||||
req = NewRequestWithValues(t, "POST", "/user2/repo1/_new/master/", map[string]string{
|
||||
"_csrf": doc.GetCSRF(),
|
||||
"last_commit": lastCommit,
|
||||
"tree_path": "test.txt",
|
||||
"content": "Content",
|
||||
"commit_choice": "direct",
|
||||
})
|
||||
resp = session.MakeRequest(t, req, http.StatusFound)
|
||||
}
|
||||
|
||||
func TestCreateFileOnProtectedBranch(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
csrf := GetCSRF(t, session, "/user2/repo1/settings/branches")
|
||||
// Change master branch to protected
|
||||
req := NewRequestWithValues(t, "POST", "/user2/repo1/settings/branches?action=protected_branch", map[string]string{
|
||||
"_csrf": csrf,
|
||||
"branchName": "master",
|
||||
"canPush": "false",
|
||||
})
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
// Check if master branch has been locked successfully
|
||||
flashCookie := session.GetCookie("macaron_flash")
|
||||
assert.NotNil(t, flashCookie)
|
||||
assert.EqualValues(t, flashCookie.Value, "success%3Dmaster%2BLocked%2Bsuccessfully")
|
||||
|
||||
// Request editor page
|
||||
req = NewRequest(t, "GET", "/user2/repo1/_new/master/")
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
doc := NewHTMLParser(t, resp.Body)
|
||||
lastCommit := doc.GetInputValueByName("last_commit")
|
||||
assert.NotEmpty(t, lastCommit)
|
||||
|
||||
// Save new file to master branch
|
||||
req = NewRequestWithValues(t, "POST", "/user2/repo1/_new/master/", map[string]string{
|
||||
"_csrf": doc.GetCSRF(),
|
||||
"last_commit": lastCommit,
|
||||
"tree_path": "test.txt",
|
||||
"content": "Content",
|
||||
"commit_choice": "direct",
|
||||
})
|
||||
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
// Check body for error message
|
||||
assert.Contains(t, string(resp.Body), "Can not commit to protected branch 'master'.")
|
||||
}
|
||||
|
||||
func testEditFile(t *testing.T, session *TestSession, user, repo, branch, filePath string) *TestResponse {
|
||||
|
||||
newContent := "Hello, World (Edited)\n"
|
||||
|
||||
// Get to the 'edit this file' page
|
||||
req := NewRequest(t, "GET", path.Join(user, repo, "_edit", branch, filePath))
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
lastCommit := htmlDoc.GetInputValueByName("last_commit")
|
||||
assert.NotEmpty(t, lastCommit)
|
||||
|
||||
// Submit the edits
|
||||
req = NewRequestWithValues(t, "POST", path.Join(user, repo, "_edit", branch, filePath),
|
||||
map[string]string{
|
||||
"_csrf": htmlDoc.GetCSRF(),
|
||||
"last_commit": lastCommit,
|
||||
"tree_path": filePath,
|
||||
"content": newContent,
|
||||
"commit_choice": "direct",
|
||||
},
|
||||
)
|
||||
resp = session.MakeRequest(t, req, http.StatusFound)
|
||||
|
||||
// Verify the change
|
||||
req = NewRequest(t, "GET", path.Join(user, repo, "raw", branch, filePath))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.EqualValues(t, newContent, string(resp.Body))
|
||||
|
||||
return resp
|
||||
}
|
||||
|
||||
func testEditFileToNewBranch(t *testing.T, session *TestSession, user, repo, branch, targetBranch, filePath string) *TestResponse {
|
||||
|
||||
newContent := "Hello, World (Edited)\n"
|
||||
|
||||
// Get to the 'edit this file' page
|
||||
req := NewRequest(t, "GET", path.Join(user, repo, "_edit", branch, filePath))
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
lastCommit := htmlDoc.GetInputValueByName("last_commit")
|
||||
assert.NotEmpty(t, lastCommit)
|
||||
|
||||
// Submit the edits
|
||||
req = NewRequestWithValues(t, "POST", path.Join(user, repo, "_edit", branch, filePath),
|
||||
map[string]string{
|
||||
"_csrf": htmlDoc.GetCSRF(),
|
||||
"last_commit": lastCommit,
|
||||
"tree_path": filePath,
|
||||
"content": newContent,
|
||||
"commit_choice": "commit-to-new-branch",
|
||||
"new_branch_name": targetBranch,
|
||||
},
|
||||
)
|
||||
resp = session.MakeRequest(t, req, http.StatusFound)
|
||||
|
||||
// Verify the change
|
||||
req = NewRequest(t, "GET", path.Join(user, repo, "raw", targetBranch, filePath))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.EqualValues(t, newContent, string(resp.Body))
|
||||
|
||||
return resp
|
||||
}
|
||||
|
||||
func TestEditFile(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
session := loginUser(t, "user2")
|
||||
testEditFile(t, session, "user2", "repo1", "master", "README.md")
|
||||
}
|
||||
|
||||
func TestEditFileToNewBranch(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
session := loginUser(t, "user2")
|
||||
testEditFileToNewBranch(t, session, "user2", "repo1", "master", "feature/test", "README.md")
|
||||
}
|
17
integrations/explore_repos_test.go
Normal file
17
integrations/explore_repos_test.go
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestExploreRepos(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
req := NewRequest(t, "GET", "/explore/repos")
|
||||
MakeRequest(t, req, http.StatusOK)
|
||||
}
|
@@ -0,0 +1 @@
|
||||
ref: refs/heads/master
|
@@ -0,0 +1,4 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = true
|
@@ -0,0 +1 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to check the commit log message taken by
|
||||
# applypatch from an e-mail message.
|
||||
#
|
||||
# The hook should exit with non-zero status after issuing an
|
||||
# appropriate message if it wants to stop the commit. The hook is
|
||||
# allowed to edit the commit message file.
|
||||
#
|
||||
# To enable this hook, rename this file to "applypatch-msg".
|
||||
|
||||
. git-sh-setup
|
||||
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
|
||||
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
|
||||
:
|
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to check the commit log message.
|
||||
# Called by "git commit" with one argument, the name of the file
|
||||
# that has the commit message. The hook should exit with non-zero
|
||||
# status after issuing an appropriate message if it wants to stop the
|
||||
# commit. The hook is allowed to edit the commit message file.
|
||||
#
|
||||
# To enable this hook, rename this file to "commit-msg".
|
||||
|
||||
# Uncomment the below to add a Signed-off-by line to the message.
|
||||
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
||||
# hook is more suited to it.
|
||||
#
|
||||
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
||||
|
||||
# This example catches duplicate Signed-off-by lines.
|
||||
|
||||
test "" = "$(grep '^Signed-off-by: ' "$1" |
|
||||
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
||||
echo >&2 Duplicate Signed-off-by lines.
|
||||
exit 1
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
ORI_DIR=`pwd`
|
||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
cd "$ORI_DIR"
|
||||
for i in `ls "$SHELL_FOLDER/post-receive.d"`; do
|
||||
sh "$SHELL_FOLDER/post-receive.d/$i"
|
||||
done
|
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
"$GITEA_ROOT/gitea" hook --config='integrations/app.ini' post-receive
|
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to prepare a packed repository for use over
|
||||
# dumb transports.
|
||||
#
|
||||
# To enable this hook, rename this file to "post-update".
|
||||
|
||||
exec git update-server-info
|
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to verify what is about to be committed
|
||||
# by applypatch from an e-mail message.
|
||||
#
|
||||
# The hook should exit with non-zero status after issuing an
|
||||
# appropriate message if it wants to stop the commit.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-applypatch".
|
||||
|
||||
. git-sh-setup
|
||||
precommit="$(git rev-parse --git-path hooks/pre-commit)"
|
||||
test -x "$precommit" && exec "$precommit" ${1+"$@"}
|
||||
:
|
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to verify what is about to be committed.
|
||||
# Called by "git commit" with no arguments. The hook should
|
||||
# exit with non-zero status after issuing an appropriate message if
|
||||
# it wants to stop the commit.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-commit".
|
||||
|
||||
if git rev-parse --verify HEAD >/dev/null 2>&1
|
||||
then
|
||||
against=HEAD
|
||||
else
|
||||
# Initial commit: diff against an empty tree object
|
||||
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||||
fi
|
||||
|
||||
# If you want to allow non-ASCII filenames set this variable to true.
|
||||
allownonascii=$(git config --bool hooks.allownonascii)
|
||||
|
||||
# Redirect output to stderr.
|
||||
exec 1>&2
|
||||
|
||||
# Cross platform projects tend to avoid non-ASCII filenames; prevent
|
||||
# them from being added to the repository. We exploit the fact that the
|
||||
# printable range starts at the space character and ends with tilde.
|
||||
if [ "$allownonascii" != "true" ] &&
|
||||
# Note that the use of brackets around a tr range is ok here, (it's
|
||||
# even required, for portability to Solaris 10's /usr/bin/tr), since
|
||||
# the square bracket bytes happen to fall in the designated range.
|
||||
test $(git diff --cached --name-only --diff-filter=A -z $against |
|
||||
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
|
||||
then
|
||||
cat <<\EOF
|
||||
Error: Attempt to add a non-ASCII file name.
|
||||
|
||||
This can cause problems if you want to work with people on other platforms.
|
||||
|
||||
To be portable it is advisable to rename the file.
|
||||
|
||||
If you know what you are doing you can disable this check using:
|
||||
|
||||
git config hooks.allownonascii true
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If there are whitespace errors, print the offending file names and fail.
|
||||
exec git diff-index --check --cached $against --
|
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
|
||||
# An example hook script to verify what is about to be pushed. Called by "git
|
||||
# push" after it has checked the remote status, but before anything has been
|
||||
# pushed. If this script exits with a non-zero status nothing will be pushed.
|
||||
#
|
||||
# This hook is called with the following parameters:
|
||||
#
|
||||
# $1 -- Name of the remote to which the push is being done
|
||||
# $2 -- URL to which the push is being done
|
||||
#
|
||||
# If pushing without using a named remote those arguments will be equal.
|
||||
#
|
||||
# Information about the commits which are being pushed is supplied as lines to
|
||||
# the standard input in the form:
|
||||
#
|
||||
# <local ref> <local sha1> <remote ref> <remote sha1>
|
||||
#
|
||||
# This sample shows how to prevent push of commits where the log message starts
|
||||
# with "WIP" (work in progress).
|
||||
|
||||
remote="$1"
|
||||
url="$2"
|
||||
|
||||
z40=0000000000000000000000000000000000000000
|
||||
|
||||
while read local_ref local_sha remote_ref remote_sha
|
||||
do
|
||||
if [ "$local_sha" = $z40 ]
|
||||
then
|
||||
# Handle delete
|
||||
:
|
||||
else
|
||||
if [ "$remote_sha" = $z40 ]
|
||||
then
|
||||
# New branch, examine all commits
|
||||
range="$local_sha"
|
||||
else
|
||||
# Update to existing branch, examine new commits
|
||||
range="$remote_sha..$local_sha"
|
||||
fi
|
||||
|
||||
# Check for WIP commit
|
||||
commit=`git rev-list -n 1 --grep '^WIP' "$range"`
|
||||
if [ -n "$commit" ]
|
||||
then
|
||||
echo >&2 "Found WIP commit in $local_ref, not pushing"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
@@ -0,0 +1,169 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2006, 2008 Junio C Hamano
|
||||
#
|
||||
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
||||
# its job, and can prevent the command from running by exiting with
|
||||
# non-zero status.
|
||||
#
|
||||
# The hook is called with the following parameters:
|
||||
#
|
||||
# $1 -- the upstream the series was forked from.
|
||||
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
||||
#
|
||||
# This sample shows how to prevent topic branches that are already
|
||||
# merged to 'next' branch from getting rebased, because allowing it
|
||||
# would result in rebasing already published history.
|
||||
|
||||
publish=next
|
||||
basebranch="$1"
|
||||
if test "$#" = 2
|
||||
then
|
||||
topic="refs/heads/$2"
|
||||
else
|
||||
topic=`git symbolic-ref HEAD` ||
|
||||
exit 0 ;# we do not interrupt rebasing detached HEAD
|
||||
fi
|
||||
|
||||
case "$topic" in
|
||||
refs/heads/??/*)
|
||||
;;
|
||||
*)
|
||||
exit 0 ;# we do not interrupt others.
|
||||
;;
|
||||
esac
|
||||
|
||||
# Now we are dealing with a topic branch being rebased
|
||||
# on top of master. Is it OK to rebase it?
|
||||
|
||||
# Does the topic really exist?
|
||||
git show-ref -q "$topic" || {
|
||||
echo >&2 "No such branch $topic"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Is topic fully merged to master?
|
||||
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
||||
if test -z "$not_in_master"
|
||||
then
|
||||
echo >&2 "$topic is fully merged to master; better remove it."
|
||||
exit 1 ;# we could allow it, but there is no point.
|
||||
fi
|
||||
|
||||
# Is topic ever merged to next? If so you should not be rebasing it.
|
||||
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
||||
only_next_2=`git rev-list ^master ${publish} | sort`
|
||||
if test "$only_next_1" = "$only_next_2"
|
||||
then
|
||||
not_in_topic=`git rev-list "^$topic" master`
|
||||
if test -z "$not_in_topic"
|
||||
then
|
||||
echo >&2 "$topic is already up-to-date with master"
|
||||
exit 1 ;# we could allow it, but there is no point.
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
||||
/usr/bin/perl -e '
|
||||
my $topic = $ARGV[0];
|
||||
my $msg = "* $topic has commits already merged to public branch:\n";
|
||||
my (%not_in_next) = map {
|
||||
/^([0-9a-f]+) /;
|
||||
($1 => 1);
|
||||
} split(/\n/, $ARGV[1]);
|
||||
for my $elem (map {
|
||||
/^([0-9a-f]+) (.*)$/;
|
||||
[$1 => $2];
|
||||
} split(/\n/, $ARGV[2])) {
|
||||
if (!exists $not_in_next{$elem->[0]}) {
|
||||
if ($msg) {
|
||||
print STDERR $msg;
|
||||
undef $msg;
|
||||
}
|
||||
print STDERR " $elem->[1]\n";
|
||||
}
|
||||
}
|
||||
' "$topic" "$not_in_next" "$not_in_master"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
<<\DOC_END
|
||||
|
||||
This sample hook safeguards topic branches that have been
|
||||
published from being rewound.
|
||||
|
||||
The workflow assumed here is:
|
||||
|
||||
* Once a topic branch forks from "master", "master" is never
|
||||
merged into it again (either directly or indirectly).
|
||||
|
||||
* Once a topic branch is fully cooked and merged into "master",
|
||||
it is deleted. If you need to build on top of it to correct
|
||||
earlier mistakes, a new topic branch is created by forking at
|
||||
the tip of the "master". This is not strictly necessary, but
|
||||
it makes it easier to keep your history simple.
|
||||
|
||||
* Whenever you need to test or publish your changes to topic
|
||||
branches, merge them into "next" branch.
|
||||
|
||||
The script, being an example, hardcodes the publish branch name
|
||||
to be "next", but it is trivial to make it configurable via
|
||||
$GIT_DIR/config mechanism.
|
||||
|
||||
With this workflow, you would want to know:
|
||||
|
||||
(1) ... if a topic branch has ever been merged to "next". Young
|
||||
topic branches can have stupid mistakes you would rather
|
||||
clean up before publishing, and things that have not been
|
||||
merged into other branches can be easily rebased without
|
||||
affecting other people. But once it is published, you would
|
||||
not want to rewind it.
|
||||
|
||||
(2) ... if a topic branch has been fully merged to "master".
|
||||
Then you can delete it. More importantly, you should not
|
||||
build on top of it -- other people may already want to
|
||||
change things related to the topic as patches against your
|
||||
"master", so if you need further changes, it is better to
|
||||
fork the topic (perhaps with the same name) afresh from the
|
||||
tip of "master".
|
||||
|
||||
Let's look at this example:
|
||||
|
||||
o---o---o---o---o---o---o---o---o---o "next"
|
||||
/ / / /
|
||||
/ a---a---b A / /
|
||||
/ / / /
|
||||
/ / c---c---c---c B /
|
||||
/ / / \ /
|
||||
/ / / b---b C \ /
|
||||
/ / / / \ /
|
||||
---o---o---o---o---o---o---o---o---o---o---o "master"
|
||||
|
||||
|
||||
A, B and C are topic branches.
|
||||
|
||||
* A has one fix since it was merged up to "next".
|
||||
|
||||
* B has finished. It has been fully merged up to "master" and "next",
|
||||
and is ready to be deleted.
|
||||
|
||||
* C has not merged to "next" at all.
|
||||
|
||||
We would want to allow C to be rebased, refuse A, and encourage
|
||||
B to be deleted.
|
||||
|
||||
To compute (1):
|
||||
|
||||
git rev-list ^master ^topic next
|
||||
git rev-list ^master next
|
||||
|
||||
if these match, topic has not merged in next at all.
|
||||
|
||||
To compute (2):
|
||||
|
||||
git rev-list master..topic
|
||||
|
||||
if this is empty, it is fully merged to "master".
|
||||
|
||||
DOC_END
|
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
ORI_DIR=`pwd`
|
||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
cd "$ORI_DIR"
|
||||
for i in `ls "$SHELL_FOLDER/pre-receive.d"`; do
|
||||
sh "$SHELL_FOLDER/pre-receive.d/$i"
|
||||
done
|
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
"$GITEA_ROOT/gitea" hook --config='integrations/app.ini' pre-receive
|
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to prepare the commit log message.
|
||||
# Called by "git commit" with the name of the file that has the
|
||||
# commit message, followed by the description of the commit
|
||||
# message's source. The hook's purpose is to edit the commit
|
||||
# message file. If the hook fails with a non-zero status,
|
||||
# the commit is aborted.
|
||||
#
|
||||
# To enable this hook, rename this file to "prepare-commit-msg".
|
||||
|
||||
# This hook includes three examples. The first comments out the
|
||||
# "Conflicts:" part of a merge commit.
|
||||
#
|
||||
# The second includes the output of "git diff --name-status -r"
|
||||
# into the message, just before the "git status" output. It is
|
||||
# commented because it doesn't cope with --amend or with squashed
|
||||
# commits.
|
||||
#
|
||||
# The third example adds a Signed-off-by line to the message, that can
|
||||
# still be edited. This is rarely a good idea.
|
||||
|
||||
case "$2,$3" in
|
||||
merge,)
|
||||
/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
|
||||
|
||||
# ,|template,)
|
||||
# /usr/bin/perl -i.bak -pe '
|
||||
# print "\n" . `git diff --cached --name-status -r`
|
||||
# if /^#/ && $first++ == 0' "$1" ;;
|
||||
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
ORI_DIR=`pwd`
|
||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
cd "$ORI_DIR"
|
||||
for i in `ls "$SHELL_FOLDER/update.d"`; do
|
||||
sh "$SHELL_FOLDER/update.d/$i" $1 $2 $3
|
||||
done
|
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
"$GITEA_ROOT/gitea" hook --config='integrations/app.ini' update $1 $2 $3
|
@@ -0,0 +1,128 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to block unannotated tags from entering.
|
||||
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
|
||||
#
|
||||
# To enable this hook, rename this file to "update".
|
||||
#
|
||||
# Config
|
||||
# ------
|
||||
# hooks.allowunannotated
|
||||
# This boolean sets whether unannotated tags will be allowed into the
|
||||
# repository. By default they won't be.
|
||||
# hooks.allowdeletetag
|
||||
# This boolean sets whether deleting tags will be allowed in the
|
||||
# repository. By default they won't be.
|
||||
# hooks.allowmodifytag
|
||||
# This boolean sets whether a tag may be modified after creation. By default
|
||||
# it won't be.
|
||||
# hooks.allowdeletebranch
|
||||
# This boolean sets whether deleting branches will be allowed in the
|
||||
# repository. By default they won't be.
|
||||
# hooks.denycreatebranch
|
||||
# This boolean sets whether remotely creating branches will be denied
|
||||
# in the repository. By default this is allowed.
|
||||
#
|
||||
|
||||
# --- Command line
|
||||
refname="$1"
|
||||
oldrev="$2"
|
||||
newrev="$3"
|
||||
|
||||
# --- Safety check
|
||||
if [ -z "$GIT_DIR" ]; then
|
||||
echo "Don't run this script from the command line." >&2
|
||||
echo " (if you want, you could supply GIT_DIR then run" >&2
|
||||
echo " $0 <ref> <oldrev> <newrev>)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
|
||||
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Config
|
||||
allowunannotated=$(git config --bool hooks.allowunannotated)
|
||||
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
|
||||
denycreatebranch=$(git config --bool hooks.denycreatebranch)
|
||||
allowdeletetag=$(git config --bool hooks.allowdeletetag)
|
||||
allowmodifytag=$(git config --bool hooks.allowmodifytag)
|
||||
|
||||
# check for no description
|
||||
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
|
||||
case "$projectdesc" in
|
||||
"Unnamed repository"* | "")
|
||||
echo "*** Project description file hasn't been set" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# --- Check types
|
||||
# if $newrev is 0000...0000, it's a commit to delete a ref.
|
||||
zero="0000000000000000000000000000000000000000"
|
||||
if [ "$newrev" = "$zero" ]; then
|
||||
newrev_type=delete
|
||||
else
|
||||
newrev_type=$(git cat-file -t $newrev)
|
||||
fi
|
||||
|
||||
case "$refname","$newrev_type" in
|
||||
refs/tags/*,commit)
|
||||
# un-annotated tag
|
||||
short_refname=${refname##refs/tags/}
|
||||
if [ "$allowunannotated" != "true" ]; then
|
||||
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
|
||||
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/tags/*,delete)
|
||||
# delete tag
|
||||
if [ "$allowdeletetag" != "true" ]; then
|
||||
echo "*** Deleting a tag is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/tags/*,tag)
|
||||
# annotated tag
|
||||
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
|
||||
then
|
||||
echo "*** Tag '$refname' already exists." >&2
|
||||
echo "*** Modifying a tag is not allowed in this repository." >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/heads/*,commit)
|
||||
# branch
|
||||
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
|
||||
echo "*** Creating a branch is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/heads/*,delete)
|
||||
# delete branch
|
||||
if [ "$allowdeletebranch" != "true" ]; then
|
||||
echo "*** Deleting a branch is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/remotes/*,commit)
|
||||
# tracking branch
|
||||
;;
|
||||
refs/remotes/*,delete)
|
||||
# delete tracking branch
|
||||
if [ "$allowdeletebranch" != "true" ]; then
|
||||
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# Anything else (is there anything else?)
|
||||
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# --- Finished
|
||||
exit 0
|
@@ -0,0 +1,6 @@
|
||||
# git ls-files --others --exclude-from=.git/info/exclude
|
||||
# Lines that start with '#' are comments.
|
||||
# For a project mostly in C, the following would be a good set of
|
||||
# exclude patterns (uncomment them if you want to use them):
|
||||
# *.[oa]
|
||||
# *~
|
@@ -0,0 +1 @@
|
||||
65f1bf27bc3bf70f64657658635e66094edbcb4d refs/heads/master
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
|
@@ -0,0 +1 @@
|
||||
65f1bf27bc3bf70f64657658635e66094edbcb4d
|
@@ -0,0 +1 @@
|
||||
65f1bf27bc3bf70f64657658635e66094edbcb4d
|
@@ -0,0 +1 @@
|
||||
65f1bf27bc3bf70f64657658635e66094edbcb4d
|
@@ -0,0 +1 @@
|
||||
65f1bf27bc3bf70f64657658635e66094edbcb4d
|
@@ -0,0 +1 @@
|
||||
ref: refs/heads/master
|
@@ -0,0 +1,4 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = true
|
@@ -0,0 +1 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to check the commit log message taken by
|
||||
# applypatch from an e-mail message.
|
||||
#
|
||||
# The hook should exit with non-zero status after issuing an
|
||||
# appropriate message if it wants to stop the commit. The hook is
|
||||
# allowed to edit the commit message file.
|
||||
#
|
||||
# To enable this hook, rename this file to "applypatch-msg".
|
||||
|
||||
. git-sh-setup
|
||||
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
|
||||
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
|
||||
:
|
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to check the commit log message.
|
||||
# Called by "git commit" with one argument, the name of the file
|
||||
# that has the commit message. The hook should exit with non-zero
|
||||
# status after issuing an appropriate message if it wants to stop the
|
||||
# commit. The hook is allowed to edit the commit message file.
|
||||
#
|
||||
# To enable this hook, rename this file to "commit-msg".
|
||||
|
||||
# Uncomment the below to add a Signed-off-by line to the message.
|
||||
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
||||
# hook is more suited to it.
|
||||
#
|
||||
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
||||
|
||||
# This example catches duplicate Signed-off-by lines.
|
||||
|
||||
test "" = "$(grep '^Signed-off-by: ' "$1" |
|
||||
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
||||
echo >&2 Duplicate Signed-off-by lines.
|
||||
exit 1
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
ORI_DIR=`pwd`
|
||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
cd "$ORI_DIR"
|
||||
for i in `ls "$SHELL_FOLDER/post-receive.d"`; do
|
||||
sh "$SHELL_FOLDER/post-receive.d/$i"
|
||||
done
|
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
"$GITEA_ROOT/gitea" hook --config='integrations/app.ini' post-receive
|
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to prepare a packed repository for use over
|
||||
# dumb transports.
|
||||
#
|
||||
# To enable this hook, rename this file to "post-update".
|
||||
|
||||
exec git update-server-info
|
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to verify what is about to be committed
|
||||
# by applypatch from an e-mail message.
|
||||
#
|
||||
# The hook should exit with non-zero status after issuing an
|
||||
# appropriate message if it wants to stop the commit.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-applypatch".
|
||||
|
||||
. git-sh-setup
|
||||
precommit="$(git rev-parse --git-path hooks/pre-commit)"
|
||||
test -x "$precommit" && exec "$precommit" ${1+"$@"}
|
||||
:
|
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to verify what is about to be committed.
|
||||
# Called by "git commit" with no arguments. The hook should
|
||||
# exit with non-zero status after issuing an appropriate message if
|
||||
# it wants to stop the commit.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-commit".
|
||||
|
||||
if git rev-parse --verify HEAD >/dev/null 2>&1
|
||||
then
|
||||
against=HEAD
|
||||
else
|
||||
# Initial commit: diff against an empty tree object
|
||||
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||||
fi
|
||||
|
||||
# If you want to allow non-ASCII filenames set this variable to true.
|
||||
allownonascii=$(git config --bool hooks.allownonascii)
|
||||
|
||||
# Redirect output to stderr.
|
||||
exec 1>&2
|
||||
|
||||
# Cross platform projects tend to avoid non-ASCII filenames; prevent
|
||||
# them from being added to the repository. We exploit the fact that the
|
||||
# printable range starts at the space character and ends with tilde.
|
||||
if [ "$allownonascii" != "true" ] &&
|
||||
# Note that the use of brackets around a tr range is ok here, (it's
|
||||
# even required, for portability to Solaris 10's /usr/bin/tr), since
|
||||
# the square bracket bytes happen to fall in the designated range.
|
||||
test $(git diff --cached --name-only --diff-filter=A -z $against |
|
||||
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
|
||||
then
|
||||
cat <<\EOF
|
||||
Error: Attempt to add a non-ASCII file name.
|
||||
|
||||
This can cause problems if you want to work with people on other platforms.
|
||||
|
||||
To be portable it is advisable to rename the file.
|
||||
|
||||
If you know what you are doing you can disable this check using:
|
||||
|
||||
git config hooks.allownonascii true
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If there are whitespace errors, print the offending file names and fail.
|
||||
exec git diff-index --check --cached $against --
|
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
|
||||
# An example hook script to verify what is about to be pushed. Called by "git
|
||||
# push" after it has checked the remote status, but before anything has been
|
||||
# pushed. If this script exits with a non-zero status nothing will be pushed.
|
||||
#
|
||||
# This hook is called with the following parameters:
|
||||
#
|
||||
# $1 -- Name of the remote to which the push is being done
|
||||
# $2 -- URL to which the push is being done
|
||||
#
|
||||
# If pushing without using a named remote those arguments will be equal.
|
||||
#
|
||||
# Information about the commits which are being pushed is supplied as lines to
|
||||
# the standard input in the form:
|
||||
#
|
||||
# <local ref> <local sha1> <remote ref> <remote sha1>
|
||||
#
|
||||
# This sample shows how to prevent push of commits where the log message starts
|
||||
# with "WIP" (work in progress).
|
||||
|
||||
remote="$1"
|
||||
url="$2"
|
||||
|
||||
z40=0000000000000000000000000000000000000000
|
||||
|
||||
while read local_ref local_sha remote_ref remote_sha
|
||||
do
|
||||
if [ "$local_sha" = $z40 ]
|
||||
then
|
||||
# Handle delete
|
||||
:
|
||||
else
|
||||
if [ "$remote_sha" = $z40 ]
|
||||
then
|
||||
# New branch, examine all commits
|
||||
range="$local_sha"
|
||||
else
|
||||
# Update to existing branch, examine new commits
|
||||
range="$remote_sha..$local_sha"
|
||||
fi
|
||||
|
||||
# Check for WIP commit
|
||||
commit=`git rev-list -n 1 --grep '^WIP' "$range"`
|
||||
if [ -n "$commit" ]
|
||||
then
|
||||
echo >&2 "Found WIP commit in $local_ref, not pushing"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
@@ -0,0 +1,169 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2006, 2008 Junio C Hamano
|
||||
#
|
||||
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
||||
# its job, and can prevent the command from running by exiting with
|
||||
# non-zero status.
|
||||
#
|
||||
# The hook is called with the following parameters:
|
||||
#
|
||||
# $1 -- the upstream the series was forked from.
|
||||
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
||||
#
|
||||
# This sample shows how to prevent topic branches that are already
|
||||
# merged to 'next' branch from getting rebased, because allowing it
|
||||
# would result in rebasing already published history.
|
||||
|
||||
publish=next
|
||||
basebranch="$1"
|
||||
if test "$#" = 2
|
||||
then
|
||||
topic="refs/heads/$2"
|
||||
else
|
||||
topic=`git symbolic-ref HEAD` ||
|
||||
exit 0 ;# we do not interrupt rebasing detached HEAD
|
||||
fi
|
||||
|
||||
case "$topic" in
|
||||
refs/heads/??/*)
|
||||
;;
|
||||
*)
|
||||
exit 0 ;# we do not interrupt others.
|
||||
;;
|
||||
esac
|
||||
|
||||
# Now we are dealing with a topic branch being rebased
|
||||
# on top of master. Is it OK to rebase it?
|
||||
|
||||
# Does the topic really exist?
|
||||
git show-ref -q "$topic" || {
|
||||
echo >&2 "No such branch $topic"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Is topic fully merged to master?
|
||||
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
||||
if test -z "$not_in_master"
|
||||
then
|
||||
echo >&2 "$topic is fully merged to master; better remove it."
|
||||
exit 1 ;# we could allow it, but there is no point.
|
||||
fi
|
||||
|
||||
# Is topic ever merged to next? If so you should not be rebasing it.
|
||||
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
||||
only_next_2=`git rev-list ^master ${publish} | sort`
|
||||
if test "$only_next_1" = "$only_next_2"
|
||||
then
|
||||
not_in_topic=`git rev-list "^$topic" master`
|
||||
if test -z "$not_in_topic"
|
||||
then
|
||||
echo >&2 "$topic is already up-to-date with master"
|
||||
exit 1 ;# we could allow it, but there is no point.
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
||||
/usr/bin/perl -e '
|
||||
my $topic = $ARGV[0];
|
||||
my $msg = "* $topic has commits already merged to public branch:\n";
|
||||
my (%not_in_next) = map {
|
||||
/^([0-9a-f]+) /;
|
||||
($1 => 1);
|
||||
} split(/\n/, $ARGV[1]);
|
||||
for my $elem (map {
|
||||
/^([0-9a-f]+) (.*)$/;
|
||||
[$1 => $2];
|
||||
} split(/\n/, $ARGV[2])) {
|
||||
if (!exists $not_in_next{$elem->[0]}) {
|
||||
if ($msg) {
|
||||
print STDERR $msg;
|
||||
undef $msg;
|
||||
}
|
||||
print STDERR " $elem->[1]\n";
|
||||
}
|
||||
}
|
||||
' "$topic" "$not_in_next" "$not_in_master"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
<<\DOC_END
|
||||
|
||||
This sample hook safeguards topic branches that have been
|
||||
published from being rewound.
|
||||
|
||||
The workflow assumed here is:
|
||||
|
||||
* Once a topic branch forks from "master", "master" is never
|
||||
merged into it again (either directly or indirectly).
|
||||
|
||||
* Once a topic branch is fully cooked and merged into "master",
|
||||
it is deleted. If you need to build on top of it to correct
|
||||
earlier mistakes, a new topic branch is created by forking at
|
||||
the tip of the "master". This is not strictly necessary, but
|
||||
it makes it easier to keep your history simple.
|
||||
|
||||
* Whenever you need to test or publish your changes to topic
|
||||
branches, merge them into "next" branch.
|
||||
|
||||
The script, being an example, hardcodes the publish branch name
|
||||
to be "next", but it is trivial to make it configurable via
|
||||
$GIT_DIR/config mechanism.
|
||||
|
||||
With this workflow, you would want to know:
|
||||
|
||||
(1) ... if a topic branch has ever been merged to "next". Young
|
||||
topic branches can have stupid mistakes you would rather
|
||||
clean up before publishing, and things that have not been
|
||||
merged into other branches can be easily rebased without
|
||||
affecting other people. But once it is published, you would
|
||||
not want to rewind it.
|
||||
|
||||
(2) ... if a topic branch has been fully merged to "master".
|
||||
Then you can delete it. More importantly, you should not
|
||||
build on top of it -- other people may already want to
|
||||
change things related to the topic as patches against your
|
||||
"master", so if you need further changes, it is better to
|
||||
fork the topic (perhaps with the same name) afresh from the
|
||||
tip of "master".
|
||||
|
||||
Let's look at this example:
|
||||
|
||||
o---o---o---o---o---o---o---o---o---o "next"
|
||||
/ / / /
|
||||
/ a---a---b A / /
|
||||
/ / / /
|
||||
/ / c---c---c---c B /
|
||||
/ / / \ /
|
||||
/ / / b---b C \ /
|
||||
/ / / / \ /
|
||||
---o---o---o---o---o---o---o---o---o---o---o "master"
|
||||
|
||||
|
||||
A, B and C are topic branches.
|
||||
|
||||
* A has one fix since it was merged up to "next".
|
||||
|
||||
* B has finished. It has been fully merged up to "master" and "next",
|
||||
and is ready to be deleted.
|
||||
|
||||
* C has not merged to "next" at all.
|
||||
|
||||
We would want to allow C to be rebased, refuse A, and encourage
|
||||
B to be deleted.
|
||||
|
||||
To compute (1):
|
||||
|
||||
git rev-list ^master ^topic next
|
||||
git rev-list ^master next
|
||||
|
||||
if these match, topic has not merged in next at all.
|
||||
|
||||
To compute (2):
|
||||
|
||||
git rev-list master..topic
|
||||
|
||||
if this is empty, it is fully merged to "master".
|
||||
|
||||
DOC_END
|
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
ORI_DIR=`pwd`
|
||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
cd "$ORI_DIR"
|
||||
for i in `ls "$SHELL_FOLDER/pre-receive.d"`; do
|
||||
sh "$SHELL_FOLDER/pre-receive.d/$i"
|
||||
done
|
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
"$GITEA_ROOT/gitea" hook --config='integrations/app.ini' pre-receive
|
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to prepare the commit log message.
|
||||
# Called by "git commit" with the name of the file that has the
|
||||
# commit message, followed by the description of the commit
|
||||
# message's source. The hook's purpose is to edit the commit
|
||||
# message file. If the hook fails with a non-zero status,
|
||||
# the commit is aborted.
|
||||
#
|
||||
# To enable this hook, rename this file to "prepare-commit-msg".
|
||||
|
||||
# This hook includes three examples. The first comments out the
|
||||
# "Conflicts:" part of a merge commit.
|
||||
#
|
||||
# The second includes the output of "git diff --name-status -r"
|
||||
# into the message, just before the "git status" output. It is
|
||||
# commented because it doesn't cope with --amend or with squashed
|
||||
# commits.
|
||||
#
|
||||
# The third example adds a Signed-off-by line to the message, that can
|
||||
# still be edited. This is rarely a good idea.
|
||||
|
||||
case "$2,$3" in
|
||||
merge,)
|
||||
/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
|
||||
|
||||
# ,|template,)
|
||||
# /usr/bin/perl -i.bak -pe '
|
||||
# print "\n" . `git diff --cached --name-status -r`
|
||||
# if /^#/ && $first++ == 0' "$1" ;;
|
||||
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
ORI_DIR=`pwd`
|
||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
cd "$ORI_DIR"
|
||||
for i in `ls "$SHELL_FOLDER/update.d"`; do
|
||||
sh "$SHELL_FOLDER/update.d/$i" $1 $2 $3
|
||||
done
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user