You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo.go 72 kB

11 years ago
11 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
9 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
10 years ago
11 years ago
9 years ago
10 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
9 years ago
11 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
11 years ago
9 years ago
9 years ago
9 years ago
9 years ago
11 years ago
9 years ago
11 years ago
9 years ago
9 years ago
9 years ago
9 years ago
11 years ago
9 years ago
11 years ago
11 years ago
9 years ago
9 years ago
9 years ago
9 years ago
11 years ago
9 years ago
10 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
11 years ago
11 years ago
11 years ago
9 years ago
9 years ago
9 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
10 years ago
9 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
9 years ago
9 years ago
11 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
9 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
9 years ago
9 years ago
11 years ago
9 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package models
  5. import (
  6. "bytes"
  7. "errors"
  8. "fmt"
  9. "html/template"
  10. "io"
  11. "io/ioutil"
  12. "mime/multipart"
  13. "os"
  14. "os/exec"
  15. "path"
  16. "path/filepath"
  17. "regexp"
  18. "sort"
  19. "strings"
  20. "time"
  21. "github.com/Unknwon/cae/zip"
  22. "github.com/Unknwon/com"
  23. "github.com/go-xorm/xorm"
  24. "github.com/mcuadros/go-version"
  25. "gopkg.in/ini.v1"
  26. git "github.com/gogits/git-module"
  27. api "github.com/gogits/go-gogs-client"
  28. gouuid "github.com/satori/go.uuid"
  29. "github.com/gogits/gogs/modules/bindata"
  30. "github.com/gogits/gogs/modules/log"
  31. "github.com/gogits/gogs/modules/markdown"
  32. "github.com/gogits/gogs/modules/process"
  33. "github.com/gogits/gogs/modules/setting"
  34. "github.com/gogits/gogs/modules/sync"
  35. )
  36. const (
  37. _TPL_UPDATE_HOOK = "#!/usr/bin/env %s\n%s update $1 $2 $3 --config='%s'\n"
  38. )
  39. var repoWorkingPool = sync.NewSingleInstancePool()
  40. var (
  41. ErrRepoFileNotExist = errors.New("Repository file does not exist")
  42. ErrRepoFileNotLoaded = errors.New("Repository file not loaded")
  43. ErrMirrorNotExist = errors.New("Mirror does not exist")
  44. ErrInvalidReference = errors.New("Invalid reference specified")
  45. ErrNameEmpty = errors.New("Name is empty")
  46. )
  47. var (
  48. Gitignores, Licenses, Readmes []string
  49. // Maximum items per page in forks, watchers and stars of a repo
  50. ItemsPerPage = 40
  51. )
  52. func LoadRepoConfig() {
  53. // Load .gitignore and license files and readme templates.
  54. types := []string{"gitignore", "license", "readme"}
  55. typeFiles := make([][]string, 3)
  56. for i, t := range types {
  57. files, err := bindata.AssetDir("conf/" + t)
  58. if err != nil {
  59. log.Fatal(4, "Fail to get %s files: %v", t, err)
  60. }
  61. customPath := path.Join(setting.CustomPath, "conf", t)
  62. if com.IsDir(customPath) {
  63. customFiles, err := com.StatDir(customPath)
  64. if err != nil {
  65. log.Fatal(4, "Fail to get custom %s files: %v", t, err)
  66. }
  67. for _, f := range customFiles {
  68. if !com.IsSliceContainsStr(files, f) {
  69. files = append(files, f)
  70. }
  71. }
  72. }
  73. typeFiles[i] = files
  74. }
  75. Gitignores = typeFiles[0]
  76. Licenses = typeFiles[1]
  77. Readmes = typeFiles[2]
  78. sort.Strings(Gitignores)
  79. sort.Strings(Licenses)
  80. sort.Strings(Readmes)
  81. }
  82. func NewRepoContext() {
  83. zip.Verbose = false
  84. // Check Git installation.
  85. if _, err := exec.LookPath("git"); err != nil {
  86. log.Fatal(4, "Fail to test 'git' command: %v (forgotten install?)", err)
  87. }
  88. // Check Git version.
  89. gitVer, err := git.BinVersion()
  90. if err != nil {
  91. log.Fatal(4, "Fail to get Git version: %v", err)
  92. }
  93. log.Info("Git Version: %s", gitVer)
  94. if version.Compare("1.7.1", gitVer, ">") {
  95. log.Fatal(4, "Gogs requires Git version greater or equal to 1.7.1")
  96. }
  97. // Git requires setting user.name and user.email in order to commit changes.
  98. for configKey, defaultValue := range map[string]string{"user.name": "Gogs", "user.email": "gogs@fake.local"} {
  99. if stdout, stderr, err := process.Exec("NewRepoContext(get setting)", "git", "config", "--get", configKey); err != nil || strings.TrimSpace(stdout) == "" {
  100. // ExitError indicates this config is not set
  101. if _, ok := err.(*exec.ExitError); ok || strings.TrimSpace(stdout) == "" {
  102. if _, stderr, gerr := process.Exec("NewRepoContext(set "+configKey+")", "git", "config", "--global", configKey, defaultValue); gerr != nil {
  103. log.Fatal(4, "Fail to set git %s(%s): %s", configKey, gerr, stderr)
  104. }
  105. log.Info("Git config %s set to %s", configKey, defaultValue)
  106. } else {
  107. log.Fatal(4, "Fail to get git %s(%s): %s", configKey, err, stderr)
  108. }
  109. }
  110. }
  111. // Set git some configurations.
  112. if _, stderr, err := process.Exec("NewRepoContext(git config --global core.quotepath false)",
  113. "git", "config", "--global", "core.quotepath", "false"); err != nil {
  114. log.Fatal(4, "Fail to execute 'git config --global core.quotepath false': %s", stderr)
  115. }
  116. RemoveAllWithNotice("Clean up repository temporary data", filepath.Join(setting.AppDataPath, "tmp"))
  117. }
  118. // Repository represents a git repository.
  119. type Repository struct {
  120. ID int64 `xorm:"pk autoincr"`
  121. OwnerID int64 `xorm:"UNIQUE(s)"`
  122. Owner *User `xorm:"-"`
  123. LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
  124. Name string `xorm:"INDEX NOT NULL"`
  125. Description string
  126. Website string
  127. DefaultBranch string
  128. NumWatches int
  129. NumStars int
  130. NumForks int
  131. NumIssues int
  132. NumClosedIssues int
  133. NumOpenIssues int `xorm:"-"`
  134. NumPulls int
  135. NumClosedPulls int
  136. NumOpenPulls int `xorm:"-"`
  137. NumMilestones int `xorm:"NOT NULL DEFAULT 0"`
  138. NumClosedMilestones int `xorm:"NOT NULL DEFAULT 0"`
  139. NumOpenMilestones int `xorm:"-"`
  140. NumTags int `xorm:"-"`
  141. IsPrivate bool
  142. IsBare bool
  143. IsMirror bool
  144. *Mirror `xorm:"-"`
  145. // Advanced settings
  146. EnableWiki bool `xorm:"NOT NULL DEFAULT true"`
  147. EnableExternalWiki bool
  148. ExternalWikiURL string
  149. EnableIssues bool `xorm:"NOT NULL DEFAULT true"`
  150. EnableExternalTracker bool
  151. ExternalTrackerFormat string
  152. ExternalTrackerStyle string
  153. ExternalMetas map[string]string `xorm:"-"`
  154. EnablePulls bool `xorm:"NOT NULL DEFAULT true"`
  155. IsFork bool `xorm:"NOT NULL DEFAULT false"`
  156. ForkID int64
  157. BaseRepo *Repository `xorm:"-"`
  158. Created time.Time `xorm:"-"`
  159. CreatedUnix int64
  160. Updated time.Time `xorm:"-"`
  161. UpdatedUnix int64
  162. }
  163. func (repo *Repository) BeforeInsert() {
  164. repo.CreatedUnix = time.Now().Unix()
  165. repo.UpdatedUnix = repo.CreatedUnix
  166. }
  167. func (repo *Repository) BeforeUpdate() {
  168. repo.UpdatedUnix = time.Now().Unix()
  169. }
  170. func (repo *Repository) AfterSet(colName string, _ xorm.Cell) {
  171. switch colName {
  172. case "default_branch":
  173. // FIXME: use models migration to solve all at once.
  174. if len(repo.DefaultBranch) == 0 {
  175. repo.DefaultBranch = "master"
  176. }
  177. case "num_closed_issues":
  178. repo.NumOpenIssues = repo.NumIssues - repo.NumClosedIssues
  179. case "num_closed_pulls":
  180. repo.NumOpenPulls = repo.NumPulls - repo.NumClosedPulls
  181. case "num_closed_milestones":
  182. repo.NumOpenMilestones = repo.NumMilestones - repo.NumClosedMilestones
  183. case "external_tracker_style":
  184. if len(repo.ExternalTrackerStyle) == 0 {
  185. repo.ExternalTrackerStyle = markdown.ISSUE_NAME_STYLE_NUMERIC
  186. }
  187. case "created_unix":
  188. repo.Created = time.Unix(repo.CreatedUnix, 0).Local()
  189. case "updated_unix":
  190. repo.Updated = time.Unix(repo.UpdatedUnix, 0)
  191. }
  192. }
  193. // MustOwner always returns a valid *User object to avoid
  194. // conceptually impossible error handling.
  195. // It creates a fake object that contains error deftail
  196. // when error occurs.
  197. func (repo *Repository) MustOwner() *User {
  198. return repo.mustOwner(x)
  199. }
  200. func (repo *Repository) FullName() string {
  201. return repo.MustOwner().Name + "/" + repo.Name
  202. }
  203. func (repo *Repository) FullLink() string {
  204. return setting.AppUrl + repo.FullName()
  205. }
  206. // Arguments that are allowed to be nil: permission
  207. func (repo *Repository) APIFormat(permission *api.Permission) *api.Repository {
  208. cloneLink := repo.CloneLink()
  209. return &api.Repository{
  210. ID: repo.ID,
  211. Owner: repo.Owner.APIFormat(),
  212. Name: repo.Name,
  213. FullName: repo.FullName(),
  214. Description: repo.Description,
  215. Private: repo.IsPrivate,
  216. Fork: repo.IsFork,
  217. HTMLURL: repo.FullLink(),
  218. SSHURL: cloneLink.SSH,
  219. CloneURL: cloneLink.HTTPS,
  220. Website: repo.Website,
  221. Stars: repo.NumStars,
  222. Forks: repo.NumForks,
  223. Watchers: repo.NumWatches,
  224. OpenIssues: repo.NumOpenIssues,
  225. DefaultBranch: repo.DefaultBranch,
  226. Created: repo.Created,
  227. Updated: repo.Updated,
  228. Permissions: permission,
  229. }
  230. }
  231. func (repo *Repository) getOwner(e Engine) (err error) {
  232. if repo.Owner != nil {
  233. return nil
  234. }
  235. repo.Owner, err = getUserByID(e, repo.OwnerID)
  236. return err
  237. }
  238. func (repo *Repository) GetOwner() error {
  239. return repo.getOwner(x)
  240. }
  241. func (repo *Repository) mustOwner(e Engine) *User {
  242. if err := repo.getOwner(e); err != nil {
  243. return &User{
  244. Name: "error",
  245. FullName: err.Error(),
  246. }
  247. }
  248. return repo.Owner
  249. }
  250. // ComposeMetas composes a map of metas for rendering external issue tracker URL.
  251. func (repo *Repository) ComposeMetas() map[string]string {
  252. if !repo.EnableExternalTracker {
  253. return nil
  254. } else if repo.ExternalMetas == nil {
  255. repo.ExternalMetas = map[string]string{
  256. "format": repo.ExternalTrackerFormat,
  257. "user": repo.MustOwner().Name,
  258. "repo": repo.Name,
  259. }
  260. switch repo.ExternalTrackerStyle {
  261. case markdown.ISSUE_NAME_STYLE_ALPHANUMERIC:
  262. repo.ExternalMetas["style"] = markdown.ISSUE_NAME_STYLE_ALPHANUMERIC
  263. default:
  264. repo.ExternalMetas["style"] = markdown.ISSUE_NAME_STYLE_NUMERIC
  265. }
  266. }
  267. return repo.ExternalMetas
  268. }
  269. // DeleteWiki removes the actual and local copy of repository wiki.
  270. func (repo *Repository) DeleteWiki() {
  271. wikiPaths := []string{repo.WikiPath(), repo.LocalWikiPath()}
  272. for _, wikiPath := range wikiPaths {
  273. RemoveAllWithNotice("Delete repository wiki", wikiPath)
  274. }
  275. }
  276. func (repo *Repository) getAssignees(e Engine) (_ []*User, err error) {
  277. if err = repo.getOwner(e); err != nil {
  278. return nil, err
  279. }
  280. accesses := make([]*Access, 0, 10)
  281. if err = e.Where("repo_id = ? AND mode >= ?", repo.ID, ACCESS_MODE_WRITE).Find(&accesses); err != nil {
  282. return nil, err
  283. }
  284. if len(accesses) == 0 {
  285. return []*User{}, nil
  286. }
  287. userIDs := make([]int64, len(accesses))
  288. for i := 0; i < len(accesses); i++ {
  289. userIDs[i] = accesses[i].UserID
  290. }
  291. // Leave a seat for owner itself to append later, but if owner is an organization
  292. // and just waste 1 unit is cheaper than re-allocate memory once.
  293. users := make([]*User, 0, len(userIDs)+1)
  294. if err = e.In("id", userIDs).Find(&users); err != nil {
  295. return nil, err
  296. }
  297. if !repo.Owner.IsOrganization() {
  298. users = append(users, repo.Owner)
  299. }
  300. return users, nil
  301. }
  302. // GetAssignees returns all users that have write access and can be assigned to issues
  303. // of the repository,
  304. func (repo *Repository) GetAssignees() (_ []*User, err error) {
  305. return repo.getAssignees(x)
  306. }
  307. // GetAssigneeByID returns the user that has write access of repository by given ID.
  308. func (repo *Repository) GetAssigneeByID(userID int64) (*User, error) {
  309. return GetAssigneeByID(repo, userID)
  310. }
  311. // GetMilestoneByID returns the milestone belongs to repository by given ID.
  312. func (repo *Repository) GetMilestoneByID(milestoneID int64) (*Milestone, error) {
  313. return GetRepoMilestoneByID(repo.ID, milestoneID)
  314. }
  315. // IssueStats returns number of open and closed repository issues by given filter mode.
  316. func (repo *Repository) IssueStats(uid int64, filterMode int, isPull bool) (int64, int64) {
  317. return GetRepoIssueStats(repo.ID, uid, filterMode, isPull)
  318. }
  319. func (repo *Repository) GetMirror() (err error) {
  320. repo.Mirror, err = GetMirror(repo.ID)
  321. return err
  322. }
  323. func (repo *Repository) GetBaseRepo() (err error) {
  324. if !repo.IsFork {
  325. return nil
  326. }
  327. repo.BaseRepo, err = GetRepositoryByID(repo.ForkID)
  328. return err
  329. }
  330. func (repo *Repository) repoPath(e Engine) string {
  331. return RepoPath(repo.mustOwner(e).Name, repo.Name)
  332. }
  333. func (repo *Repository) RepoPath() string {
  334. return repo.repoPath(x)
  335. }
  336. func (repo *Repository) GitConfigPath() string {
  337. return filepath.Join(repo.RepoPath(), "config")
  338. }
  339. func (repo *Repository) Link() string {
  340. return setting.AppSubUrl + "/" + repo.MustOwner().Name + "/" + repo.Name
  341. }
  342. func (repo *Repository) RelLink() string {
  343. return "/" + repo.MustOwner().Name + "/" + repo.Name
  344. }
  345. func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string {
  346. return fmt.Sprintf("%s/%s/compare/%s...%s", repo.MustOwner().Name, repo.Name, oldCommitID, newCommitID)
  347. }
  348. func (repo *Repository) HasAccess(u *User) bool {
  349. has, _ := HasAccess(u, repo, ACCESS_MODE_READ)
  350. return has
  351. }
  352. func (repo *Repository) IsOwnedBy(userID int64) bool {
  353. return repo.OwnerID == userID
  354. }
  355. // CanBeForked returns true if repository meets the requirements of being forked.
  356. func (repo *Repository) CanBeForked() bool {
  357. return !repo.IsBare
  358. }
  359. // CanEnablePulls returns true if repository meets the requirements of accepting pulls.
  360. func (repo *Repository) CanEnablePulls() bool {
  361. return !repo.IsMirror
  362. }
  363. // AllowPulls returns true if repository meets the requirements of accepting pulls and has them enabled.
  364. func (repo *Repository) AllowsPulls() bool {
  365. return repo.CanEnablePulls() && repo.EnablePulls
  366. }
  367. // FIXME: should have a mutex to prevent producing same index for two issues that are created
  368. // closely enough.
  369. func (repo *Repository) NextIssueIndex() int64 {
  370. return int64(repo.NumIssues+repo.NumPulls) + 1
  371. }
  372. var (
  373. DescPattern = regexp.MustCompile(`https?://\S+`)
  374. )
  375. // DescriptionHtml does special handles to description and return HTML string.
  376. func (repo *Repository) DescriptionHtml() template.HTML {
  377. sanitize := func(s string) string {
  378. return fmt.Sprintf(`<a href="%[1]s" target="_blank">%[1]s</a>`, s)
  379. }
  380. return template.HTML(DescPattern.ReplaceAllStringFunc(markdown.Sanitizer.Sanitize(repo.Description), sanitize))
  381. }
  382. func (repo *Repository) LocalCopyPath() string {
  383. return path.Join(setting.AppDataPath, "tmp/local-rpeo", com.ToStr(repo.ID))
  384. }
  385. // UpdateLocalCopy pulls latest changes of given branch from repoPath to localPath.
  386. // It creates a new clone if local copy does not exist.
  387. // This function checks out target branch by default, it is safe to assume subsequent
  388. // operations are operating against target branch when caller has confidence for no race condition.
  389. func UpdateLocalCopyBranch(repoPath, localPath, branch string) error {
  390. if !com.IsExist(localPath) {
  391. if err := git.Clone(repoPath, localPath, git.CloneRepoOptions{
  392. Timeout: time.Duration(setting.Git.Timeout.Clone) * time.Second,
  393. Branch: branch,
  394. }); err != nil {
  395. return fmt.Errorf("Clone: %v", err)
  396. }
  397. } else {
  398. if err := git.Checkout(localPath, git.CheckoutOptions{
  399. Branch: branch,
  400. }); err != nil {
  401. return fmt.Errorf("Checkout: %v", err)
  402. }
  403. if err := git.Pull(localPath, git.PullRemoteOptions{
  404. Remote: "origin",
  405. Branch: branch,
  406. Timeout: time.Duration(setting.Git.Timeout.Pull) * time.Second,
  407. }); err != nil {
  408. return fmt.Errorf("Pull: %v", err)
  409. }
  410. }
  411. return nil
  412. }
  413. // UpdateLocalCopy makes sure the branch of local copy of repository is up-to-date.
  414. func (repo *Repository) UpdateLocalCopyBranch(branch string) error {
  415. return UpdateLocalCopyBranch(repo.RepoPath(), repo.LocalCopyPath(), branch)
  416. }
  417. // PatchPath returns corresponding patch file path of repository by given issue ID.
  418. func (repo *Repository) PatchPath(index int64) (string, error) {
  419. if err := repo.GetOwner(); err != nil {
  420. return "", err
  421. }
  422. return filepath.Join(RepoPath(repo.Owner.Name, repo.Name), "pulls", com.ToStr(index)+".patch"), nil
  423. }
  424. // SavePatch saves patch data to corresponding location by given issue ID.
  425. func (repo *Repository) SavePatch(index int64, patch []byte) error {
  426. patchPath, err := repo.PatchPath(index)
  427. if err != nil {
  428. return fmt.Errorf("PatchPath: %v", err)
  429. }
  430. os.MkdirAll(filepath.Dir(patchPath), os.ModePerm)
  431. if err = ioutil.WriteFile(patchPath, patch, 0644); err != nil {
  432. return fmt.Errorf("WriteFile: %v", err)
  433. }
  434. return nil
  435. }
  436. func isRepositoryExist(e Engine, u *User, repoName string) (bool, error) {
  437. has, err := e.Get(&Repository{
  438. OwnerID: u.ID,
  439. LowerName: strings.ToLower(repoName),
  440. })
  441. return has && com.IsDir(RepoPath(u.Name, repoName)), err
  442. }
  443. // IsRepositoryExist returns true if the repository with given name under user has already existed.
  444. func IsRepositoryExist(u *User, repoName string) (bool, error) {
  445. return isRepositoryExist(x, u, repoName)
  446. }
  447. // CloneLink represents different types of clone URLs of repository.
  448. type CloneLink struct {
  449. SSH string
  450. HTTPS string
  451. Git string
  452. }
  453. // ComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name.
  454. func ComposeHTTPSCloneURL(owner, repo string) string {
  455. return fmt.Sprintf("%s%s/%s.git", setting.AppUrl, owner, repo)
  456. }
  457. func (repo *Repository) cloneLink(isWiki bool) *CloneLink {
  458. repoName := repo.Name
  459. if isWiki {
  460. repoName += ".wiki"
  461. }
  462. repo.Owner = repo.MustOwner()
  463. cl := new(CloneLink)
  464. if setting.SSH.Port != 22 {
  465. cl.SSH = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", setting.RunUser, setting.SSH.Domain, setting.SSH.Port, repo.Owner.Name, repoName)
  466. } else {
  467. cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.SSH.Domain, repo.Owner.Name, repoName)
  468. }
  469. cl.HTTPS = ComposeHTTPSCloneURL(repo.Owner.Name, repo.Name)
  470. return cl
  471. }
  472. // CloneLink returns clone URLs of repository.
  473. func (repo *Repository) CloneLink() (cl *CloneLink) {
  474. return repo.cloneLink(false)
  475. }
  476. // Mirror represents a mirror information of repository.
  477. type Mirror struct {
  478. ID int64 `xorm:"pk autoincr"`
  479. RepoID int64
  480. Repo *Repository `xorm:"-"`
  481. Interval int // Hour.
  482. EnablePrune bool `xorm:"NOT NULL DEFAULT true"`
  483. Updated time.Time `xorm:"-"`
  484. UpdatedUnix int64
  485. NextUpdate time.Time `xorm:"-"`
  486. NextUpdateUnix int64
  487. address string `xorm:"-"`
  488. }
  489. func (m *Mirror) BeforeInsert() {
  490. m.NextUpdateUnix = m.NextUpdate.Unix()
  491. }
  492. func (m *Mirror) BeforeUpdate() {
  493. m.UpdatedUnix = time.Now().Unix()
  494. m.NextUpdateUnix = m.NextUpdate.Unix()
  495. }
  496. func (m *Mirror) AfterSet(colName string, _ xorm.Cell) {
  497. var err error
  498. switch colName {
  499. case "repo_id":
  500. m.Repo, err = GetRepositoryByID(m.RepoID)
  501. if err != nil {
  502. log.Error(3, "GetRepositoryByID[%d]: %v", m.ID, err)
  503. }
  504. case "updated_unix":
  505. m.Updated = time.Unix(m.UpdatedUnix, 0).Local()
  506. case "next_updated_unix":
  507. m.NextUpdate = time.Unix(m.NextUpdateUnix, 0).Local()
  508. }
  509. }
  510. func (m *Mirror) readAddress() {
  511. if len(m.address) > 0 {
  512. return
  513. }
  514. cfg, err := ini.Load(m.Repo.GitConfigPath())
  515. if err != nil {
  516. log.Error(4, "Load: %v", err)
  517. return
  518. }
  519. m.address = cfg.Section("remote \"origin\"").Key("url").Value()
  520. }
  521. // HandleCloneUserCredentials replaces user credentials from HTTP/HTTPS URL
  522. // with placeholder <credentials>.
  523. // It will fail for any other forms of clone addresses.
  524. func HandleCloneUserCredentials(url string, mosaics bool) string {
  525. i := strings.Index(url, "@")
  526. if i == -1 {
  527. return url
  528. }
  529. start := strings.Index(url, "://")
  530. if start == -1 {
  531. return url
  532. }
  533. if mosaics {
  534. return url[:start+3] + "<credentials>" + url[i:]
  535. }
  536. return url[:start+3] + url[i+1:]
  537. }
  538. // Address returns mirror address from Git repository config without credentials.
  539. func (m *Mirror) Address() string {
  540. m.readAddress()
  541. return HandleCloneUserCredentials(m.address, false)
  542. }
  543. // FullAddress returns mirror address from Git repository config.
  544. func (m *Mirror) FullAddress() string {
  545. m.readAddress()
  546. return m.address
  547. }
  548. // SaveAddress writes new address to Git repository config.
  549. func (m *Mirror) SaveAddress(addr string) error {
  550. configPath := m.Repo.GitConfigPath()
  551. cfg, err := ini.Load(configPath)
  552. if err != nil {
  553. return fmt.Errorf("Load: %v", err)
  554. }
  555. cfg.Section("remote \"origin\"").Key("url").SetValue(addr)
  556. return cfg.SaveToIndent(configPath, "\t")
  557. }
  558. func getMirror(e Engine, repoId int64) (*Mirror, error) {
  559. m := &Mirror{RepoID: repoId}
  560. has, err := e.Get(m)
  561. if err != nil {
  562. return nil, err
  563. } else if !has {
  564. return nil, ErrMirrorNotExist
  565. }
  566. return m, nil
  567. }
  568. // GetMirror returns mirror object by given repository ID.
  569. func GetMirror(repoId int64) (*Mirror, error) {
  570. return getMirror(x, repoId)
  571. }
  572. func updateMirror(e Engine, m *Mirror) error {
  573. _, err := e.Id(m.ID).AllCols().Update(m)
  574. return err
  575. }
  576. func UpdateMirror(m *Mirror) error {
  577. return updateMirror(x, m)
  578. }
  579. func DeleteMirrorByRepoID(repoID int64) error {
  580. _, err := x.Delete(&Mirror{RepoID: repoID})
  581. return err
  582. }
  583. func createUpdateHook(repoPath string) error {
  584. return git.SetUpdateHook(repoPath,
  585. fmt.Sprintf(_TPL_UPDATE_HOOK, setting.ScriptType, "\""+setting.AppPath+"\"", setting.CustomConf))
  586. }
  587. type MigrateRepoOptions struct {
  588. Name string
  589. Description string
  590. IsPrivate bool
  591. IsMirror bool
  592. RemoteAddr string
  593. }
  594. /*
  595. GitHub, GitLab, Gogs: *.wiki.git
  596. BitBucket: *.git/wiki
  597. */
  598. var commonWikiURLSuffixes = []string{".wiki.git", ".git/wiki"}
  599. // wikiRemoteURL returns accessible repository URL for wiki if exists.
  600. // Otherwise, it returns an empty string.
  601. func wikiRemoteURL(remote string) string {
  602. remote = strings.TrimSuffix(remote, ".git")
  603. for _, suffix := range commonWikiURLSuffixes {
  604. wikiURL := remote + suffix
  605. if git.IsRepoURLAccessible(wikiURL) {
  606. return wikiURL
  607. }
  608. }
  609. return ""
  610. }
  611. // MigrateRepository migrates a existing repository from other project hosting.
  612. func MigrateRepository(u *User, opts MigrateRepoOptions) (*Repository, error) {
  613. repo, err := CreateRepository(u, CreateRepoOptions{
  614. Name: opts.Name,
  615. Description: opts.Description,
  616. IsPrivate: opts.IsPrivate,
  617. IsMirror: opts.IsMirror,
  618. })
  619. if err != nil {
  620. return nil, err
  621. }
  622. // Clone to temprory path and do the init commit.
  623. tmpDir := filepath.Join(os.TempDir(), fmt.Sprintf("%d", time.Now().Nanosecond()))
  624. os.MkdirAll(tmpDir, os.ModePerm)
  625. repoPath := RepoPath(u.Name, opts.Name)
  626. wikiPath := WikiPath(u.Name, opts.Name)
  627. if u.IsOrganization() {
  628. t, err := u.GetOwnerTeam()
  629. if err != nil {
  630. return nil, err
  631. }
  632. repo.NumWatches = t.NumMembers
  633. } else {
  634. repo.NumWatches = 1
  635. }
  636. migrateTimeout := time.Duration(setting.Git.Timeout.Migrate) * time.Second
  637. os.RemoveAll(repoPath)
  638. if err = git.Clone(opts.RemoteAddr, repoPath, git.CloneRepoOptions{
  639. Mirror: true,
  640. Quiet: true,
  641. Timeout: migrateTimeout,
  642. }); err != nil {
  643. return repo, fmt.Errorf("Clone: %v", err)
  644. }
  645. wikiRemotePath := wikiRemoteURL(opts.RemoteAddr)
  646. if len(wikiRemotePath) > 0 {
  647. os.RemoveAll(wikiPath)
  648. if err = git.Clone(wikiRemotePath, wikiPath, git.CloneRepoOptions{
  649. Mirror: true,
  650. Quiet: true,
  651. Timeout: migrateTimeout,
  652. }); err != nil {
  653. log.Info("Clone wiki: %v", err)
  654. }
  655. }
  656. // Check if repository is empty.
  657. _, stderr, err := com.ExecCmdDir(repoPath, "git", "log", "-1")
  658. if err != nil {
  659. if strings.Contains(stderr, "fatal: bad default revision 'HEAD'") {
  660. repo.IsBare = true
  661. } else {
  662. return repo, fmt.Errorf("check bare: %v - %s", err, stderr)
  663. }
  664. }
  665. if !repo.IsBare {
  666. // Try to get HEAD branch and set it as default branch.
  667. gitRepo, err := git.OpenRepository(repoPath)
  668. if err != nil {
  669. return repo, fmt.Errorf("OpenRepository: %v", err)
  670. }
  671. headBranch, err := gitRepo.GetHEADBranch()
  672. if err != nil {
  673. return repo, fmt.Errorf("GetHEADBranch: %v", err)
  674. }
  675. if headBranch != nil {
  676. repo.DefaultBranch = headBranch.Name
  677. }
  678. }
  679. if opts.IsMirror {
  680. if _, err = x.InsertOne(&Mirror{
  681. RepoID: repo.ID,
  682. Interval: setting.Mirror.DefaultInterval,
  683. EnablePrune: true,
  684. NextUpdate: time.Now().Add(time.Duration(setting.Mirror.DefaultInterval) * time.Hour),
  685. }); err != nil {
  686. return repo, fmt.Errorf("InsertOne: %v", err)
  687. }
  688. repo.IsMirror = true
  689. return repo, UpdateRepository(repo, false)
  690. }
  691. return CleanUpMigrateInfo(repo)
  692. }
  693. // cleanUpMigrateGitConfig removes mirror info which prevents "push --all".
  694. // This also removes possible user credentials.
  695. func cleanUpMigrateGitConfig(configPath string) error {
  696. cfg, err := ini.Load(configPath)
  697. if err != nil {
  698. return fmt.Errorf("open config file: %v", err)
  699. }
  700. cfg.DeleteSection("remote \"origin\"")
  701. if err = cfg.SaveToIndent(configPath, "\t"); err != nil {
  702. return fmt.Errorf("save config file: %v", err)
  703. }
  704. return nil
  705. }
  706. // Finish migrating repository and/or wiki with things that don't need to be done for mirrors.
  707. func CleanUpMigrateInfo(repo *Repository) (*Repository, error) {
  708. repoPath := repo.RepoPath()
  709. if err := createUpdateHook(repoPath); err != nil {
  710. return repo, fmt.Errorf("createUpdateHook: %v", err)
  711. }
  712. if repo.HasWiki() {
  713. if err := createUpdateHook(repo.WikiPath()); err != nil {
  714. return repo, fmt.Errorf("createUpdateHook (wiki): %v", err)
  715. }
  716. }
  717. if err := cleanUpMigrateGitConfig(repo.GitConfigPath()); err != nil {
  718. return repo, fmt.Errorf("cleanUpMigrateGitConfig: %v", err)
  719. }
  720. if repo.HasWiki() {
  721. if err := cleanUpMigrateGitConfig(path.Join(repo.WikiPath(), "config")); err != nil {
  722. return repo, fmt.Errorf("cleanUpMigrateGitConfig (wiki): %v", err)
  723. }
  724. }
  725. return repo, UpdateRepository(repo, false)
  726. }
  727. // initRepoCommit temporarily changes with work directory.
  728. func initRepoCommit(tmpPath string, sig *git.Signature) (err error) {
  729. var stderr string
  730. if _, stderr, err = process.ExecDir(-1,
  731. tmpPath, fmt.Sprintf("initRepoCommit (git add): %s", tmpPath),
  732. "git", "add", "--all"); err != nil {
  733. return fmt.Errorf("git add: %s", stderr)
  734. }
  735. if _, stderr, err = process.ExecDir(-1,
  736. tmpPath, fmt.Sprintf("initRepoCommit (git commit): %s", tmpPath),
  737. "git", "commit", fmt.Sprintf("--author='%s <%s>'", sig.Name, sig.Email),
  738. "-m", "initial commit"); err != nil {
  739. return fmt.Errorf("git commit: %s", stderr)
  740. }
  741. if _, stderr, err = process.ExecDir(-1,
  742. tmpPath, fmt.Sprintf("initRepoCommit (git push): %s", tmpPath),
  743. "git", "push", "origin", "master"); err != nil {
  744. return fmt.Errorf("git push: %s", stderr)
  745. }
  746. return nil
  747. }
  748. type CreateRepoOptions struct {
  749. Name string
  750. Description string
  751. Gitignores string
  752. License string
  753. Readme string
  754. IsPrivate bool
  755. IsMirror bool
  756. AutoInit bool
  757. }
  758. func getRepoInitFile(tp, name string) ([]byte, error) {
  759. relPath := path.Join("conf", tp, strings.TrimLeft(name, "./"))
  760. // Use custom file when available.
  761. customPath := path.Join(setting.CustomPath, relPath)
  762. if com.IsFile(customPath) {
  763. return ioutil.ReadFile(customPath)
  764. }
  765. return bindata.Asset(relPath)
  766. }
  767. func prepareRepoCommit(repo *Repository, tmpDir, repoPath string, opts CreateRepoOptions) error {
  768. // Clone to temprory path and do the init commit.
  769. _, stderr, err := process.Exec(
  770. fmt.Sprintf("initRepository(git clone): %s", repoPath), "git", "clone", repoPath, tmpDir)
  771. if err != nil {
  772. return fmt.Errorf("git clone: %v - %s", err, stderr)
  773. }
  774. // README
  775. data, err := getRepoInitFile("readme", opts.Readme)
  776. if err != nil {
  777. return fmt.Errorf("getRepoInitFile[%s]: %v", opts.Readme, err)
  778. }
  779. cloneLink := repo.CloneLink()
  780. match := map[string]string{
  781. "Name": repo.Name,
  782. "Description": repo.Description,
  783. "CloneURL.SSH": cloneLink.SSH,
  784. "CloneURL.HTTPS": cloneLink.HTTPS,
  785. }
  786. if err = ioutil.WriteFile(filepath.Join(tmpDir, "README.md"),
  787. []byte(com.Expand(string(data), match)), 0644); err != nil {
  788. return fmt.Errorf("write README.md: %v", err)
  789. }
  790. // .gitignore
  791. if len(opts.Gitignores) > 0 {
  792. var buf bytes.Buffer
  793. names := strings.Split(opts.Gitignores, ",")
  794. for _, name := range names {
  795. data, err = getRepoInitFile("gitignore", name)
  796. if err != nil {
  797. return fmt.Errorf("getRepoInitFile[%s]: %v", name, err)
  798. }
  799. buf.WriteString("# ---> " + name + "\n")
  800. buf.Write(data)
  801. buf.WriteString("\n")
  802. }
  803. if buf.Len() > 0 {
  804. if err = ioutil.WriteFile(filepath.Join(tmpDir, ".gitignore"), buf.Bytes(), 0644); err != nil {
  805. return fmt.Errorf("write .gitignore: %v", err)
  806. }
  807. }
  808. }
  809. // LICENSE
  810. if len(opts.License) > 0 {
  811. data, err = getRepoInitFile("license", opts.License)
  812. if err != nil {
  813. return fmt.Errorf("getRepoInitFile[%s]: %v", opts.License, err)
  814. }
  815. if err = ioutil.WriteFile(filepath.Join(tmpDir, "LICENSE"), data, 0644); err != nil {
  816. return fmt.Errorf("write LICENSE: %v", err)
  817. }
  818. }
  819. return nil
  820. }
  821. // InitRepository initializes README and .gitignore if needed.
  822. func initRepository(e Engine, repoPath string, u *User, repo *Repository, opts CreateRepoOptions) (err error) {
  823. // Somehow the directory could exist.
  824. if com.IsExist(repoPath) {
  825. return fmt.Errorf("initRepository: path already exists: %s", repoPath)
  826. }
  827. // Init bare new repository.
  828. if err = git.InitRepository(repoPath, true); err != nil {
  829. return fmt.Errorf("InitRepository: %v", err)
  830. } else if err = createUpdateHook(repoPath); err != nil {
  831. return fmt.Errorf("createUpdateHook: %v", err)
  832. }
  833. tmpDir := filepath.Join(os.TempDir(), "gogs-"+repo.Name+"-"+com.ToStr(time.Now().Nanosecond()))
  834. // Initialize repository according to user's choice.
  835. if opts.AutoInit {
  836. os.MkdirAll(tmpDir, os.ModePerm)
  837. defer os.RemoveAll(tmpDir)
  838. if err = prepareRepoCommit(repo, tmpDir, repoPath, opts); err != nil {
  839. return fmt.Errorf("prepareRepoCommit: %v", err)
  840. }
  841. // Apply changes and commit.
  842. if err = initRepoCommit(tmpDir, u.NewGitSig()); err != nil {
  843. return fmt.Errorf("initRepoCommit: %v", err)
  844. }
  845. }
  846. // Re-fetch the repository from database before updating it (else it would
  847. // override changes that were done earlier with sql)
  848. if repo, err = getRepositoryByID(e, repo.ID); err != nil {
  849. return fmt.Errorf("getRepositoryByID: %v", err)
  850. }
  851. if !opts.AutoInit {
  852. repo.IsBare = true
  853. }
  854. repo.DefaultBranch = "master"
  855. if err = updateRepository(e, repo, false); err != nil {
  856. return fmt.Errorf("updateRepository: %v", err)
  857. }
  858. return nil
  859. }
  860. var (
  861. reservedRepoNames = []string{".", ".."}
  862. reservedRepoPatterns = []string{"*.git", "*.wiki"}
  863. )
  864. func IsUsableRepoName(name string) error {
  865. return isUsableName(reservedRepoNames, reservedRepoPatterns, name)
  866. }
  867. func createRepository(e *xorm.Session, u *User, repo *Repository) (err error) {
  868. if err = IsUsableRepoName(repo.Name); err != nil {
  869. return err
  870. }
  871. has, err := isRepositoryExist(e, u, repo.Name)
  872. if err != nil {
  873. return fmt.Errorf("IsRepositoryExist: %v", err)
  874. } else if has {
  875. return ErrRepoAlreadyExist{u.Name, repo.Name}
  876. }
  877. if _, err = e.Insert(repo); err != nil {
  878. return err
  879. }
  880. u.NumRepos++
  881. // Remember visibility preference.
  882. u.LastRepoVisibility = repo.IsPrivate
  883. if err = updateUser(e, u); err != nil {
  884. return fmt.Errorf("updateUser: %v", err)
  885. }
  886. // Give access to all members in owner team.
  887. if u.IsOrganization() {
  888. t, err := u.getOwnerTeam(e)
  889. if err != nil {
  890. return fmt.Errorf("getOwnerTeam: %v", err)
  891. } else if err = t.addRepository(e, repo); err != nil {
  892. return fmt.Errorf("addRepository: %v", err)
  893. }
  894. } else {
  895. // Organization automatically called this in addRepository method.
  896. if err = repo.recalculateAccesses(e); err != nil {
  897. return fmt.Errorf("recalculateAccesses: %v", err)
  898. }
  899. }
  900. if err = watchRepo(e, u.ID, repo.ID, true); err != nil {
  901. return fmt.Errorf("watchRepo: %v", err)
  902. } else if err = newRepoAction(e, u, repo); err != nil {
  903. return fmt.Errorf("newRepoAction: %v", err)
  904. }
  905. return nil
  906. }
  907. // CreateRepository creates a repository for given user or organization.
  908. func CreateRepository(u *User, opts CreateRepoOptions) (_ *Repository, err error) {
  909. if !u.CanCreateRepo() {
  910. return nil, ErrReachLimitOfRepo{u.MaxRepoCreation}
  911. }
  912. repo := &Repository{
  913. OwnerID: u.ID,
  914. Owner: u,
  915. Name: opts.Name,
  916. LowerName: strings.ToLower(opts.Name),
  917. Description: opts.Description,
  918. IsPrivate: opts.IsPrivate,
  919. EnableWiki: true,
  920. EnableIssues: true,
  921. EnablePulls: true,
  922. }
  923. sess := x.NewSession()
  924. defer sessionRelease(sess)
  925. if err = sess.Begin(); err != nil {
  926. return nil, err
  927. }
  928. if err = createRepository(sess, u, repo); err != nil {
  929. return nil, err
  930. }
  931. // No need for init mirror.
  932. if !opts.IsMirror {
  933. repoPath := RepoPath(u.Name, repo.Name)
  934. if err = initRepository(sess, repoPath, u, repo, opts); err != nil {
  935. if err2 := os.RemoveAll(repoPath); err2 != nil {
  936. log.Error(4, "initRepository: %v", err)
  937. return nil, fmt.Errorf(
  938. "delete repo directory %s/%s failed(2): %v", u.Name, repo.Name, err2)
  939. }
  940. return nil, fmt.Errorf("initRepository: %v", err)
  941. }
  942. _, stderr, err := process.ExecDir(-1,
  943. repoPath, fmt.Sprintf("CreateRepository(git update-server-info): %s", repoPath),
  944. "git", "update-server-info")
  945. if err != nil {
  946. return nil, errors.New("CreateRepository(git update-server-info): " + stderr)
  947. }
  948. }
  949. return repo, sess.Commit()
  950. }
  951. func countRepositories(userID int64, private bool) int64 {
  952. sess := x.Where("id > 0")
  953. if userID > 0 {
  954. sess.And("owner_id = ?", userID)
  955. }
  956. if !private {
  957. sess.And("is_private=?", false)
  958. }
  959. count, err := sess.Count(new(Repository))
  960. if err != nil {
  961. log.Error(4, "countRepositories: %v", err)
  962. }
  963. return count
  964. }
  965. // CountRepositories returns number of repositories.
  966. // Argument private only takes effect when it is false,
  967. // set it true to count all repositories.
  968. func CountRepositories(private bool) int64 {
  969. return countRepositories(-1, private)
  970. }
  971. // CountUserRepositories returns number of repositories user owns.
  972. // Argument private only takes effect when it is false,
  973. // set it true to count all repositories.
  974. func CountUserRepositories(userID int64, private bool) int64 {
  975. return countRepositories(userID, private)
  976. }
  977. func Repositories(page, pageSize int) (_ []*Repository, err error) {
  978. repos := make([]*Repository, 0, pageSize)
  979. return repos, x.Limit(pageSize, (page-1)*pageSize).Asc("id").Find(&repos)
  980. }
  981. // RepositoriesWithUsers returns number of repos in given page.
  982. func RepositoriesWithUsers(page, pageSize int) (_ []*Repository, err error) {
  983. repos, err := Repositories(page, pageSize)
  984. if err != nil {
  985. return nil, fmt.Errorf("Repositories: %v", err)
  986. }
  987. for i := range repos {
  988. if err = repos[i].GetOwner(); err != nil {
  989. return nil, err
  990. }
  991. }
  992. return repos, nil
  993. }
  994. // RepoPath returns repository path by given user and repository name.
  995. func RepoPath(userName, repoName string) string {
  996. return filepath.Join(UserPath(userName), strings.ToLower(repoName)+".git")
  997. }
  998. // TransferOwnership transfers all corresponding setting from old user to new one.
  999. func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
  1000. newOwner, err := GetUserByName(newOwnerName)
  1001. if err != nil {
  1002. return fmt.Errorf("get new owner '%s': %v", newOwnerName, err)
  1003. }
  1004. // Check if new owner has repository with same name.
  1005. has, err := IsRepositoryExist(newOwner, repo.Name)
  1006. if err != nil {
  1007. return fmt.Errorf("IsRepositoryExist: %v", err)
  1008. } else if has {
  1009. return ErrRepoAlreadyExist{newOwnerName, repo.Name}
  1010. }
  1011. sess := x.NewSession()
  1012. defer sessionRelease(sess)
  1013. if err = sess.Begin(); err != nil {
  1014. return fmt.Errorf("sess.Begin: %v", err)
  1015. }
  1016. owner := repo.Owner
  1017. // Note: we have to set value here to make sure recalculate accesses is based on
  1018. // new owner.
  1019. repo.OwnerID = newOwner.ID
  1020. repo.Owner = newOwner
  1021. // Update repository.
  1022. if _, err := sess.Id(repo.ID).Update(repo); err != nil {
  1023. return fmt.Errorf("update owner: %v", err)
  1024. }
  1025. // Remove redundant collaborators.
  1026. collaborators, err := repo.getCollaborators(sess)
  1027. if err != nil {
  1028. return fmt.Errorf("getCollaborators: %v", err)
  1029. }
  1030. // Dummy object.
  1031. collaboration := &Collaboration{RepoID: repo.ID}
  1032. for _, c := range collaborators {
  1033. collaboration.UserID = c.ID
  1034. if c.ID == newOwner.ID || newOwner.IsOrgMember(c.ID) {
  1035. if _, err = sess.Delete(collaboration); err != nil {
  1036. return fmt.Errorf("remove collaborator '%d': %v", c.ID, err)
  1037. }
  1038. }
  1039. }
  1040. // Remove old team-repository relations.
  1041. if owner.IsOrganization() {
  1042. if err = owner.getTeams(sess); err != nil {
  1043. return fmt.Errorf("getTeams: %v", err)
  1044. }
  1045. for _, t := range owner.Teams {
  1046. if !t.hasRepository(sess, repo.ID) {
  1047. continue
  1048. }
  1049. t.NumRepos--
  1050. if _, err := sess.Id(t.ID).AllCols().Update(t); err != nil {
  1051. return fmt.Errorf("decrease team repository count '%d': %v", t.ID, err)
  1052. }
  1053. }
  1054. if err = owner.removeOrgRepo(sess, repo.ID); err != nil {
  1055. return fmt.Errorf("removeOrgRepo: %v", err)
  1056. }
  1057. }
  1058. if newOwner.IsOrganization() {
  1059. t, err := newOwner.getOwnerTeam(sess)
  1060. if err != nil {
  1061. return fmt.Errorf("getOwnerTeam: %v", err)
  1062. } else if err = t.addRepository(sess, repo); err != nil {
  1063. return fmt.Errorf("add to owner team: %v", err)
  1064. }
  1065. } else {
  1066. // Organization called this in addRepository method.
  1067. if err = repo.recalculateAccesses(sess); err != nil {
  1068. return fmt.Errorf("recalculateAccesses: %v", err)
  1069. }
  1070. }
  1071. // Update repository count.
  1072. if _, err = sess.Exec("UPDATE `user` SET num_repos=num_repos+1 WHERE id=?", newOwner.ID); err != nil {
  1073. return fmt.Errorf("increase new owner repository count: %v", err)
  1074. } else if _, err = sess.Exec("UPDATE `user` SET num_repos=num_repos-1 WHERE id=?", owner.ID); err != nil {
  1075. return fmt.Errorf("decrease old owner repository count: %v", err)
  1076. }
  1077. if err = watchRepo(sess, newOwner.ID, repo.ID, true); err != nil {
  1078. return fmt.Errorf("watchRepo: %v", err)
  1079. } else if err = transferRepoAction(sess, u, owner, newOwner, repo); err != nil {
  1080. return fmt.Errorf("transferRepoAction: %v", err)
  1081. }
  1082. // Rename remote repository to new path and delete local copy.
  1083. os.MkdirAll(UserPath(newOwner.Name), os.ModePerm)
  1084. if err = os.Rename(RepoPath(owner.Name, repo.Name), RepoPath(newOwner.Name, repo.Name)); err != nil {
  1085. return fmt.Errorf("rename repository directory: %v", err)
  1086. }
  1087. RemoveAllWithNotice("Delete repository local copy", repo.LocalCopyPath())
  1088. // Rename remote wiki repository to new path and delete local copy.
  1089. wikiPath := WikiPath(owner.Name, repo.Name)
  1090. if com.IsExist(wikiPath) {
  1091. RemoveAllWithNotice("Delete repository wiki local copy", repo.LocalWikiPath())
  1092. if err = os.Rename(wikiPath, WikiPath(newOwner.Name, repo.Name)); err != nil {
  1093. return fmt.Errorf("rename repository wiki: %v", err)
  1094. }
  1095. }
  1096. return sess.Commit()
  1097. }
  1098. // ChangeRepositoryName changes all corresponding setting from old repository name to new one.
  1099. func ChangeRepositoryName(u *User, oldRepoName, newRepoName string) (err error) {
  1100. oldRepoName = strings.ToLower(oldRepoName)
  1101. newRepoName = strings.ToLower(newRepoName)
  1102. if err = IsUsableRepoName(newRepoName); err != nil {
  1103. return err
  1104. }
  1105. has, err := IsRepositoryExist(u, newRepoName)
  1106. if err != nil {
  1107. return fmt.Errorf("IsRepositoryExist: %v", err)
  1108. } else if has {
  1109. return ErrRepoAlreadyExist{u.Name, newRepoName}
  1110. }
  1111. repo, err := GetRepositoryByName(u.ID, oldRepoName)
  1112. if err != nil {
  1113. return fmt.Errorf("GetRepositoryByName: %v", err)
  1114. }
  1115. // Change repository directory name.
  1116. if err = os.Rename(repo.RepoPath(), RepoPath(u.Name, newRepoName)); err != nil {
  1117. return fmt.Errorf("rename repository directory: %v", err)
  1118. }
  1119. wikiPath := repo.WikiPath()
  1120. if com.IsExist(wikiPath) {
  1121. if err = os.Rename(wikiPath, WikiPath(u.Name, newRepoName)); err != nil {
  1122. return fmt.Errorf("rename repository wiki: %v", err)
  1123. }
  1124. RemoveAllWithNotice("Delete repository wiki local copy", repo.LocalWikiPath())
  1125. }
  1126. return nil
  1127. }
  1128. func getRepositoriesByForkID(e Engine, forkID int64) ([]*Repository, error) {
  1129. repos := make([]*Repository, 0, 10)
  1130. return repos, e.Where("fork_id=?", forkID).Find(&repos)
  1131. }
  1132. // GetRepositoriesByForkID returns all repositories with given fork ID.
  1133. func GetRepositoriesByForkID(forkID int64) ([]*Repository, error) {
  1134. return getRepositoriesByForkID(x, forkID)
  1135. }
  1136. func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err error) {
  1137. repo.LowerName = strings.ToLower(repo.Name)
  1138. if len(repo.Description) > 255 {
  1139. repo.Description = repo.Description[:255]
  1140. }
  1141. if len(repo.Website) > 255 {
  1142. repo.Website = repo.Website[:255]
  1143. }
  1144. if _, err = e.Id(repo.ID).AllCols().Update(repo); err != nil {
  1145. return fmt.Errorf("update: %v", err)
  1146. }
  1147. if visibilityChanged {
  1148. if err = repo.getOwner(e); err != nil {
  1149. return fmt.Errorf("getOwner: %v", err)
  1150. }
  1151. if repo.Owner.IsOrganization() {
  1152. // Organization repository need to recalculate access table when visivility is changed.
  1153. if err = repo.recalculateTeamAccesses(e, 0); err != nil {
  1154. return fmt.Errorf("recalculateTeamAccesses: %v", err)
  1155. }
  1156. }
  1157. // Create/Remove git-daemon-export-ok for git-daemon...
  1158. daemonExportFile := path.Join(repo.RepoPath(), `git-daemon-export-ok`)
  1159. if repo.IsPrivate && com.IsExist(daemonExportFile) {
  1160. if err = os.Remove(daemonExportFile); err != nil {
  1161. log.Error(4, "Failed to remove %s: %v", daemonExportFile, err)
  1162. }
  1163. } else if !repo.IsPrivate && !com.IsExist(daemonExportFile) {
  1164. if f, err := os.Create(daemonExportFile); err != nil {
  1165. log.Error(4, "Failed to create %s: %v", daemonExportFile, err)
  1166. } else {
  1167. f.Close()
  1168. }
  1169. }
  1170. forkRepos, err := getRepositoriesByForkID(e, repo.ID)
  1171. if err != nil {
  1172. return fmt.Errorf("getRepositoriesByForkID: %v", err)
  1173. }
  1174. for i := range forkRepos {
  1175. forkRepos[i].IsPrivate = repo.IsPrivate
  1176. if err = updateRepository(e, forkRepos[i], true); err != nil {
  1177. return fmt.Errorf("updateRepository[%d]: %v", forkRepos[i].ID, err)
  1178. }
  1179. }
  1180. }
  1181. return nil
  1182. }
  1183. func UpdateRepository(repo *Repository, visibilityChanged bool) (err error) {
  1184. sess := x.NewSession()
  1185. defer sessionRelease(sess)
  1186. if err = sess.Begin(); err != nil {
  1187. return err
  1188. }
  1189. if err = updateRepository(x, repo, visibilityChanged); err != nil {
  1190. return fmt.Errorf("updateRepository: %v", err)
  1191. }
  1192. return sess.Commit()
  1193. }
  1194. // DeleteRepository deletes a repository for a user or organization.
  1195. func DeleteRepository(uid, repoID int64) error {
  1196. repo := &Repository{ID: repoID, OwnerID: uid}
  1197. has, err := x.Get(repo)
  1198. if err != nil {
  1199. return err
  1200. } else if !has {
  1201. return ErrRepoNotExist{repoID, uid, ""}
  1202. }
  1203. // In case is a organization.
  1204. org, err := GetUserByID(uid)
  1205. if err != nil {
  1206. return err
  1207. }
  1208. if org.IsOrganization() {
  1209. if err = org.GetTeams(); err != nil {
  1210. return err
  1211. }
  1212. }
  1213. sess := x.NewSession()
  1214. defer sessionRelease(sess)
  1215. if err = sess.Begin(); err != nil {
  1216. return err
  1217. }
  1218. if org.IsOrganization() {
  1219. for _, t := range org.Teams {
  1220. if !t.hasRepository(sess, repoID) {
  1221. continue
  1222. } else if err = t.removeRepository(sess, repo, false); err != nil {
  1223. return err
  1224. }
  1225. }
  1226. }
  1227. if err = deleteBeans(sess,
  1228. &Repository{ID: repoID},
  1229. &Access{RepoID: repo.ID},
  1230. &Action{RepoID: repo.ID},
  1231. &Watch{RepoID: repoID},
  1232. &Star{RepoID: repoID},
  1233. &Mirror{RepoID: repoID},
  1234. &IssueUser{RepoID: repoID},
  1235. &Milestone{RepoID: repoID},
  1236. &Release{RepoID: repoID},
  1237. &Collaboration{RepoID: repoID},
  1238. &PullRequest{BaseRepoID: repoID},
  1239. ); err != nil {
  1240. return fmt.Errorf("deleteBeans: %v", err)
  1241. }
  1242. // Delete comments and attachments.
  1243. issues := make([]*Issue, 0, 25)
  1244. attachmentPaths := make([]string, 0, len(issues))
  1245. if err = sess.Where("repo_id=?", repoID).Find(&issues); err != nil {
  1246. return err
  1247. }
  1248. for i := range issues {
  1249. if _, err = sess.Delete(&Comment{IssueID: issues[i].ID}); err != nil {
  1250. return err
  1251. }
  1252. attachments := make([]*Attachment, 0, 5)
  1253. if err = sess.Where("issue_id=?", issues[i].ID).Find(&attachments); err != nil {
  1254. return err
  1255. }
  1256. for j := range attachments {
  1257. attachmentPaths = append(attachmentPaths, attachments[j].LocalPath())
  1258. }
  1259. if _, err = sess.Delete(&Attachment{IssueID: issues[i].ID}); err != nil {
  1260. return err
  1261. }
  1262. }
  1263. if _, err = sess.Delete(&Issue{RepoID: repoID}); err != nil {
  1264. return err
  1265. }
  1266. if repo.IsFork {
  1267. if _, err = sess.Exec("UPDATE `repository` SET num_forks=num_forks-1 WHERE id=?", repo.ForkID); err != nil {
  1268. return fmt.Errorf("decrease fork count: %v", err)
  1269. }
  1270. }
  1271. if _, err = sess.Exec("UPDATE `user` SET num_repos=num_repos-1 WHERE id=?", uid); err != nil {
  1272. return err
  1273. }
  1274. // Remove repository files.
  1275. repoPath := repo.repoPath(sess)
  1276. RemoveAllWithNotice("Delete repository files", repoPath)
  1277. repo.DeleteWiki()
  1278. // Remove attachment files.
  1279. for i := range attachmentPaths {
  1280. RemoveAllWithNotice("Delete attachment", attachmentPaths[i])
  1281. }
  1282. if err = sess.Commit(); err != nil {
  1283. return fmt.Errorf("Commit: %v", err)
  1284. }
  1285. if repo.NumForks > 0 {
  1286. if _, err = x.Exec("UPDATE `repository` SET fork_id=0,is_fork=? WHERE fork_id=?", false, repo.ID); err != nil {
  1287. log.Error(4, "reset 'fork_id' and 'is_fork': %v", err)
  1288. }
  1289. }
  1290. return nil
  1291. }
  1292. // GetRepositoryByRef returns a Repository specified by a GFM reference.
  1293. // See https://help.github.com/articles/writing-on-github#references for more information on the syntax.
  1294. func GetRepositoryByRef(ref string) (*Repository, error) {
  1295. n := strings.IndexByte(ref, byte('/'))
  1296. if n < 2 {
  1297. return nil, ErrInvalidReference
  1298. }
  1299. userName, repoName := ref[:n], ref[n+1:]
  1300. user, err := GetUserByName(userName)
  1301. if err != nil {
  1302. return nil, err
  1303. }
  1304. return GetRepositoryByName(user.ID, repoName)
  1305. }
  1306. // GetRepositoryByName returns the repository by given name under user if exists.
  1307. func GetRepositoryByName(uid int64, repoName string) (*Repository, error) {
  1308. repo := &Repository{
  1309. OwnerID: uid,
  1310. LowerName: strings.ToLower(repoName),
  1311. }
  1312. has, err := x.Get(repo)
  1313. if err != nil {
  1314. return nil, err
  1315. } else if !has {
  1316. return nil, ErrRepoNotExist{0, uid, repoName}
  1317. }
  1318. return repo, err
  1319. }
  1320. func getRepositoryByID(e Engine, id int64) (*Repository, error) {
  1321. repo := new(Repository)
  1322. has, err := e.Id(id).Get(repo)
  1323. if err != nil {
  1324. return nil, err
  1325. } else if !has {
  1326. return nil, ErrRepoNotExist{id, 0, ""}
  1327. }
  1328. return repo, nil
  1329. }
  1330. // GetRepositoryByID returns the repository by given id if exists.
  1331. func GetRepositoryByID(id int64) (*Repository, error) {
  1332. return getRepositoryByID(x, id)
  1333. }
  1334. // GetUserRepositories returns a list of repositories of given user.
  1335. func GetUserRepositories(userID int64, private bool, page, pageSize int) ([]*Repository, error) {
  1336. sess := x.Where("owner_id = ?", userID).Desc("updated_unix")
  1337. if !private {
  1338. sess.And("is_private=?", false)
  1339. }
  1340. if page <= 0 {
  1341. page = 1
  1342. }
  1343. sess.Limit(pageSize, (page-1)*pageSize)
  1344. repos := make([]*Repository, 0, pageSize)
  1345. return repos, sess.Find(&repos)
  1346. }
  1347. // GetUserRepositories returns a list of mirror repositories of given user.
  1348. func GetUserMirrorRepositories(userID int64) ([]*Repository, error) {
  1349. repos := make([]*Repository, 0, 10)
  1350. return repos, x.Where("owner_id = ?", userID).And("is_mirror = ?", true).Find(&repos)
  1351. }
  1352. // GetRecentUpdatedRepositories returns the list of repositories that are recently updated.
  1353. func GetRecentUpdatedRepositories(page, pageSize int) (repos []*Repository, err error) {
  1354. return repos, x.Limit(pageSize, (page-1)*pageSize).
  1355. Where("is_private=?", false).Limit(pageSize).Desc("updated_unix").Find(&repos)
  1356. }
  1357. func getRepositoryCount(e Engine, u *User) (int64, error) {
  1358. return x.Count(&Repository{OwnerID: u.ID})
  1359. }
  1360. // GetRepositoryCount returns the total number of repositories of user.
  1361. func GetRepositoryCount(u *User) (int64, error) {
  1362. return getRepositoryCount(x, u)
  1363. }
  1364. type SearchRepoOptions struct {
  1365. Keyword string
  1366. OwnerID int64
  1367. OrderBy string
  1368. Private bool // Include private repositories in results
  1369. Page int
  1370. PageSize int // Can be smaller than or equal to setting.ExplorePagingNum
  1371. }
  1372. // SearchRepositoryByName takes keyword and part of repository name to search,
  1373. // it returns results in given range and number of total results.
  1374. func SearchRepositoryByName(opts *SearchRepoOptions) (repos []*Repository, _ int64, _ error) {
  1375. if len(opts.Keyword) == 0 {
  1376. return repos, 0, nil
  1377. }
  1378. opts.Keyword = strings.ToLower(opts.Keyword)
  1379. if opts.Page <= 0 {
  1380. opts.Page = 1
  1381. }
  1382. repos = make([]*Repository, 0, opts.PageSize)
  1383. // Append conditions
  1384. sess := x.Where("LOWER(lower_name) LIKE ?", "%"+opts.Keyword+"%")
  1385. if opts.OwnerID > 0 {
  1386. sess.And("owner_id = ?", opts.OwnerID)
  1387. }
  1388. if !opts.Private {
  1389. sess.And("is_private=?", false)
  1390. }
  1391. var countSess xorm.Session
  1392. countSess = *sess
  1393. count, err := countSess.Count(new(Repository))
  1394. if err != nil {
  1395. return nil, 0, fmt.Errorf("Count: %v", err)
  1396. }
  1397. if len(opts.OrderBy) > 0 {
  1398. sess.OrderBy(opts.OrderBy)
  1399. }
  1400. return repos, count, sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize).Find(&repos)
  1401. }
  1402. // DeleteRepositoryArchives deletes all repositories' archives.
  1403. func DeleteRepositoryArchives() error {
  1404. return x.Where("id > 0").Iterate(new(Repository),
  1405. func(idx int, bean interface{}) error {
  1406. repo := bean.(*Repository)
  1407. return os.RemoveAll(filepath.Join(repo.RepoPath(), "archives"))
  1408. })
  1409. }
  1410. func gatherMissingRepoRecords() ([]*Repository, error) {
  1411. repos := make([]*Repository, 0, 10)
  1412. if err := x.Where("id > 0").Iterate(new(Repository),
  1413. func(idx int, bean interface{}) error {
  1414. repo := bean.(*Repository)
  1415. if !com.IsDir(repo.RepoPath()) {
  1416. repos = append(repos, repo)
  1417. }
  1418. return nil
  1419. }); err != nil {
  1420. if err2 := CreateRepositoryNotice(fmt.Sprintf("gatherMissingRepoRecords: %v", err)); err2 != nil {
  1421. return nil, fmt.Errorf("CreateRepositoryNotice: %v", err)
  1422. }
  1423. }
  1424. return repos, nil
  1425. }
  1426. // DeleteMissingRepositories deletes all repository records that lost Git files.
  1427. func DeleteMissingRepositories() error {
  1428. repos, err := gatherMissingRepoRecords()
  1429. if err != nil {
  1430. return fmt.Errorf("gatherMissingRepoRecords: %v", err)
  1431. }
  1432. if len(repos) == 0 {
  1433. return nil
  1434. }
  1435. for _, repo := range repos {
  1436. log.Trace("Deleting %d/%d...", repo.OwnerID, repo.ID)
  1437. if err := DeleteRepository(repo.OwnerID, repo.ID); err != nil {
  1438. if err2 := CreateRepositoryNotice(fmt.Sprintf("DeleteRepository [%d]: %v", repo.ID, err)); err2 != nil {
  1439. return fmt.Errorf("CreateRepositoryNotice: %v", err)
  1440. }
  1441. }
  1442. }
  1443. return nil
  1444. }
  1445. // ReinitMissingRepositories reinitializes all repository records that lost Git files.
  1446. func ReinitMissingRepositories() error {
  1447. repos, err := gatherMissingRepoRecords()
  1448. if err != nil {
  1449. return fmt.Errorf("gatherMissingRepoRecords: %v", err)
  1450. }
  1451. if len(repos) == 0 {
  1452. return nil
  1453. }
  1454. for _, repo := range repos {
  1455. log.Trace("Initializing %d/%d...", repo.OwnerID, repo.ID)
  1456. if err := git.InitRepository(repo.RepoPath(), true); err != nil {
  1457. if err2 := CreateRepositoryNotice(fmt.Sprintf("InitRepository [%d]: %v", repo.ID, err)); err2 != nil {
  1458. return fmt.Errorf("CreateRepositoryNotice: %v", err)
  1459. }
  1460. }
  1461. }
  1462. return nil
  1463. }
  1464. // RewriteRepositoryUpdateHook rewrites all repositories' update hook.
  1465. func RewriteRepositoryUpdateHook() error {
  1466. return x.Where("id > 0").Iterate(new(Repository),
  1467. func(idx int, bean interface{}) error {
  1468. repo := bean.(*Repository)
  1469. return createUpdateHook(repo.RepoPath())
  1470. })
  1471. }
  1472. // Prevent duplicate running tasks.
  1473. var taskStatusTable = sync.NewStatusTable()
  1474. const (
  1475. _MIRROR_UPDATE = "mirror_update"
  1476. _GIT_FSCK = "git_fsck"
  1477. _CHECK_REPOs = "check_repos"
  1478. )
  1479. // MirrorUpdate checks and updates mirror repositories.
  1480. func MirrorUpdate() {
  1481. if taskStatusTable.IsRunning(_MIRROR_UPDATE) {
  1482. return
  1483. }
  1484. taskStatusTable.Start(_MIRROR_UPDATE)
  1485. defer taskStatusTable.Stop(_MIRROR_UPDATE)
  1486. log.Trace("Doing: MirrorUpdate")
  1487. mirrors := make([]*Mirror, 0, 10)
  1488. if err := x.Where("next_update_unix<=?", time.Now().Unix()).Iterate(new(Mirror), func(idx int, bean interface{}) error {
  1489. m := bean.(*Mirror)
  1490. if m.Repo == nil {
  1491. log.Error(4, "Disconnected mirror repository found: %d", m.ID)
  1492. return nil
  1493. }
  1494. repoPath := m.Repo.RepoPath()
  1495. wikiPath := m.Repo.WikiPath()
  1496. timeout := time.Duration(setting.Git.Timeout.Mirror) * time.Second
  1497. gitArgs := []string{"remote", "update"}
  1498. if m.EnablePrune {
  1499. gitArgs = append(gitArgs, "--prune")
  1500. }
  1501. if _, stderr, err := process.ExecDir(
  1502. timeout, repoPath, fmt.Sprintf("MirrorUpdate: %s", repoPath),
  1503. "git", gitArgs...); err != nil {
  1504. desc := fmt.Sprintf("Fail to update mirror repository(%s): %s", repoPath, stderr)
  1505. log.Error(4, desc)
  1506. if err = CreateRepositoryNotice(desc); err != nil {
  1507. log.Error(4, "CreateRepositoryNotice: %v", err)
  1508. }
  1509. return nil
  1510. }
  1511. if m.Repo.HasWiki() {
  1512. if _, stderr, err := process.ExecDir(
  1513. timeout, wikiPath, fmt.Sprintf("MirrorUpdate: %s", wikiPath),
  1514. "git", "remote", "update", "--prune"); err != nil {
  1515. desc := fmt.Sprintf("Fail to update mirror wiki repository(%s): %s", wikiPath, stderr)
  1516. log.Error(4, desc)
  1517. if err = CreateRepositoryNotice(desc); err != nil {
  1518. log.Error(4, "CreateRepositoryNotice: %v", err)
  1519. }
  1520. return nil
  1521. }
  1522. }
  1523. m.NextUpdate = time.Now().Add(time.Duration(m.Interval) * time.Hour)
  1524. mirrors = append(mirrors, m)
  1525. return nil
  1526. }); err != nil {
  1527. log.Error(4, "MirrorUpdate: %v", err)
  1528. }
  1529. for i := range mirrors {
  1530. if err := UpdateMirror(mirrors[i]); err != nil {
  1531. log.Error(4, "UpdateMirror[%d]: %v", mirrors[i].ID, err)
  1532. }
  1533. }
  1534. }
  1535. // GitFsck calls 'git fsck' to check repository health.
  1536. func GitFsck() {
  1537. if taskStatusTable.IsRunning(_GIT_FSCK) {
  1538. return
  1539. }
  1540. taskStatusTable.Start(_GIT_FSCK)
  1541. defer taskStatusTable.Stop(_GIT_FSCK)
  1542. log.Trace("Doing: GitFsck")
  1543. if err := x.Where("id>0").Iterate(new(Repository),
  1544. func(idx int, bean interface{}) error {
  1545. repo := bean.(*Repository)
  1546. repoPath := repo.RepoPath()
  1547. if err := git.Fsck(repoPath, setting.Cron.RepoHealthCheck.Timeout, setting.Cron.RepoHealthCheck.Args...); err != nil {
  1548. desc := fmt.Sprintf("Fail to health check repository (%s): %v", repoPath, err)
  1549. log.Warn(desc)
  1550. if err = CreateRepositoryNotice(desc); err != nil {
  1551. log.Error(4, "CreateRepositoryNotice: %v", err)
  1552. }
  1553. }
  1554. return nil
  1555. }); err != nil {
  1556. log.Error(4, "GitFsck: %v", err)
  1557. }
  1558. }
  1559. func GitGcRepos() error {
  1560. args := append([]string{"gc"}, setting.Git.GCArgs...)
  1561. return x.Where("id > 0").Iterate(new(Repository),
  1562. func(idx int, bean interface{}) error {
  1563. repo := bean.(*Repository)
  1564. if err := repo.GetOwner(); err != nil {
  1565. return err
  1566. }
  1567. _, stderr, err := process.ExecDir(
  1568. time.Duration(setting.Git.Timeout.GC)*time.Second,
  1569. RepoPath(repo.Owner.Name, repo.Name), "Repository garbage collection",
  1570. "git", args...)
  1571. if err != nil {
  1572. return fmt.Errorf("%v: %v", err, stderr)
  1573. }
  1574. return nil
  1575. })
  1576. }
  1577. type repoChecker struct {
  1578. querySQL, correctSQL string
  1579. desc string
  1580. }
  1581. func repoStatsCheck(checker *repoChecker) {
  1582. results, err := x.Query(checker.querySQL)
  1583. if err != nil {
  1584. log.Error(4, "Select %s: %v", checker.desc, err)
  1585. return
  1586. }
  1587. for _, result := range results {
  1588. id := com.StrTo(result["id"]).MustInt64()
  1589. log.Trace("Updating %s: %d", checker.desc, id)
  1590. _, err = x.Exec(checker.correctSQL, id, id)
  1591. if err != nil {
  1592. log.Error(4, "Update %s[%d]: %v", checker.desc, id, err)
  1593. }
  1594. }
  1595. }
  1596. func CheckRepoStats() {
  1597. if taskStatusTable.IsRunning(_CHECK_REPOs) {
  1598. return
  1599. }
  1600. taskStatusTable.Start(_CHECK_REPOs)
  1601. defer taskStatusTable.Stop(_CHECK_REPOs)
  1602. log.Trace("Doing: CheckRepoStats")
  1603. checkers := []*repoChecker{
  1604. // Repository.NumWatches
  1605. {
  1606. "SELECT repo.id FROM `repository` repo WHERE repo.num_watches!=(SELECT COUNT(*) FROM `watch` WHERE repo_id=repo.id)",
  1607. "UPDATE `repository` SET num_watches=(SELECT COUNT(*) FROM `watch` WHERE repo_id=?) WHERE id=?",
  1608. "repository count 'num_watches'",
  1609. },
  1610. // Repository.NumStars
  1611. {
  1612. "SELECT repo.id FROM `repository` repo WHERE repo.num_stars!=(SELECT COUNT(*) FROM `star` WHERE repo_id=repo.id)",
  1613. "UPDATE `repository` SET num_stars=(SELECT COUNT(*) FROM `star` WHERE repo_id=?) WHERE id=?",
  1614. "repository count 'num_stars'",
  1615. },
  1616. // Label.NumIssues
  1617. {
  1618. "SELECT label.id FROM `label` WHERE label.num_issues!=(SELECT COUNT(*) FROM `issue_label` WHERE label_id=label.id)",
  1619. "UPDATE `label` SET num_issues=(SELECT COUNT(*) FROM `issue_label` WHERE label_id=?) WHERE id=?",
  1620. "label count 'num_issues'",
  1621. },
  1622. // User.NumRepos
  1623. {
  1624. "SELECT `user`.id FROM `user` WHERE `user`.num_repos!=(SELECT COUNT(*) FROM `repository` WHERE owner_id=`user`.id)",
  1625. "UPDATE `user` SET num_repos=(SELECT COUNT(*) FROM `repository` WHERE owner_id=?) WHERE id=?",
  1626. "user count 'num_repos'",
  1627. },
  1628. // Issue.NumComments
  1629. {
  1630. "SELECT `issue`.id FROM `issue` WHERE `issue`.num_comments!=(SELECT COUNT(*) FROM `comment` WHERE issue_id=`issue`.id AND type=0)",
  1631. "UPDATE `issue` SET num_comments=(SELECT COUNT(*) FROM `comment` WHERE issue_id=? AND type=0) WHERE id=?",
  1632. "issue count 'num_comments'",
  1633. },
  1634. }
  1635. for i := range checkers {
  1636. repoStatsCheck(checkers[i])
  1637. }
  1638. // ***** START: Repository.NumClosedIssues *****
  1639. desc := "repository count 'num_closed_issues'"
  1640. results, err := x.Query("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", true, false)
  1641. if err != nil {
  1642. log.Error(4, "Select %s: %v", desc, err)
  1643. } else {
  1644. for _, result := range results {
  1645. id := com.StrTo(result["id"]).MustInt64()
  1646. log.Trace("Updating %s: %d", desc, id)
  1647. _, err = x.Exec("UPDATE `repository` SET num_closed_issues=(SELECT COUNT(*) FROM `issue` WHERE repo_id=? AND is_closed=? AND is_pull=?) WHERE id=?", id, true, false, id)
  1648. if err != nil {
  1649. log.Error(4, "Update %s[%d]: %v", desc, id, err)
  1650. }
  1651. }
  1652. }
  1653. // ***** END: Repository.NumClosedIssues *****
  1654. // FIXME: use checker when stop supporting old fork repo format.
  1655. // ***** START: Repository.NumForks *****
  1656. results, err = x.Query("SELECT repo.id FROM `repository` repo WHERE repo.num_forks!=(SELECT COUNT(*) FROM `repository` WHERE fork_id=repo.id)")
  1657. if err != nil {
  1658. log.Error(4, "Select repository count 'num_forks': %v", err)
  1659. } else {
  1660. for _, result := range results {
  1661. id := com.StrTo(result["id"]).MustInt64()
  1662. log.Trace("Updating repository count 'num_forks': %d", id)
  1663. repo, err := GetRepositoryByID(id)
  1664. if err != nil {
  1665. log.Error(4, "GetRepositoryByID[%d]: %v", id, err)
  1666. continue
  1667. }
  1668. rawResult, err := x.Query("SELECT COUNT(*) FROM `repository` WHERE fork_id=?", repo.ID)
  1669. if err != nil {
  1670. log.Error(4, "Select count of forks[%d]: %v", repo.ID, err)
  1671. continue
  1672. }
  1673. repo.NumForks = int(parseCountResult(rawResult))
  1674. if err = UpdateRepository(repo, false); err != nil {
  1675. log.Error(4, "UpdateRepository[%d]: %v", id, err)
  1676. continue
  1677. }
  1678. }
  1679. }
  1680. // ***** END: Repository.NumForks *****
  1681. }
  1682. type RepositoryList []*Repository
  1683. func (repos RepositoryList) loadAttributes(e Engine) error {
  1684. if len(repos) == 0 {
  1685. return nil
  1686. }
  1687. // Load owners.
  1688. set := make(map[int64]*User)
  1689. for i := range repos {
  1690. set[repos[i].OwnerID] = nil
  1691. }
  1692. userIDs := make([]int64, 0, len(set))
  1693. for userID := range set {
  1694. userIDs = append(userIDs, userID)
  1695. }
  1696. users := make([]*User, 0, len(userIDs))
  1697. if err := e.Where("id > 0").In("id", userIDs).Find(&users); err != nil {
  1698. return fmt.Errorf("find users: %v", err)
  1699. }
  1700. for i := range users {
  1701. set[users[i].ID] = users[i]
  1702. }
  1703. for i := range repos {
  1704. repos[i].Owner = set[repos[i].OwnerID]
  1705. }
  1706. return nil
  1707. }
  1708. func (repos RepositoryList) LoadAttributes() error {
  1709. return repos.loadAttributes(x)
  1710. }
  1711. type MirrorRepositoryList []*Repository
  1712. func (repos MirrorRepositoryList) loadAttributes(e Engine) error {
  1713. if len(repos) == 0 {
  1714. return nil
  1715. }
  1716. // Load mirrors.
  1717. repoIDs := make([]int64, 0, len(repos))
  1718. for i := range repos {
  1719. if !repos[i].IsMirror {
  1720. continue
  1721. }
  1722. repoIDs = append(repoIDs, repos[i].ID)
  1723. }
  1724. mirrors := make([]*Mirror, 0, len(repoIDs))
  1725. if err := e.Where("id > 0").In("repo_id", repoIDs).Find(&mirrors); err != nil {
  1726. return fmt.Errorf("find mirrors: %v", err)
  1727. }
  1728. set := make(map[int64]*Mirror)
  1729. for i := range mirrors {
  1730. set[mirrors[i].RepoID] = mirrors[i]
  1731. }
  1732. for i := range repos {
  1733. repos[i].Mirror = set[repos[i].ID]
  1734. }
  1735. return nil
  1736. }
  1737. func (repos MirrorRepositoryList) LoadAttributes() error {
  1738. return repos.loadAttributes(x)
  1739. }
  1740. // __ __ __ .__
  1741. // / \ / \_____ _/ |_ ____ | |__
  1742. // \ \/\/ /\__ \\ __\/ ___\| | \
  1743. // \ / / __ \| | \ \___| Y \
  1744. // \__/\ / (____ /__| \___ >___| /
  1745. // \/ \/ \/ \/
  1746. // Watch is connection request for receiving repository notification.
  1747. type Watch struct {
  1748. ID int64 `xorm:"pk autoincr"`
  1749. UserID int64 `xorm:"UNIQUE(watch)"`
  1750. RepoID int64 `xorm:"UNIQUE(watch)"`
  1751. }
  1752. func isWatching(e Engine, userID, repoID int64) bool {
  1753. has, _ := e.Get(&Watch{0, userID, repoID})
  1754. return has
  1755. }
  1756. // IsWatching checks if user has watched given repository.
  1757. func IsWatching(userID, repoID int64) bool {
  1758. return isWatching(x, userID, repoID)
  1759. }
  1760. func watchRepo(e Engine, userID, repoID int64, watch bool) (err error) {
  1761. if watch {
  1762. if isWatching(e, userID, repoID) {
  1763. return nil
  1764. }
  1765. if _, err = e.Insert(&Watch{RepoID: repoID, UserID: userID}); err != nil {
  1766. return err
  1767. }
  1768. _, err = e.Exec("UPDATE `repository` SET num_watches = num_watches + 1 WHERE id = ?", repoID)
  1769. } else {
  1770. if !isWatching(e, userID, repoID) {
  1771. return nil
  1772. }
  1773. if _, err = e.Delete(&Watch{0, userID, repoID}); err != nil {
  1774. return err
  1775. }
  1776. _, err = e.Exec("UPDATE `repository` SET num_watches = num_watches - 1 WHERE id = ?", repoID)
  1777. }
  1778. return err
  1779. }
  1780. // Watch or unwatch repository.
  1781. func WatchRepo(userID, repoID int64, watch bool) (err error) {
  1782. return watchRepo(x, userID, repoID, watch)
  1783. }
  1784. func getWatchers(e Engine, repoID int64) ([]*Watch, error) {
  1785. watches := make([]*Watch, 0, 10)
  1786. return watches, e.Find(&watches, &Watch{RepoID: repoID})
  1787. }
  1788. // GetWatchers returns all watchers of given repository.
  1789. func GetWatchers(repoID int64) ([]*Watch, error) {
  1790. return getWatchers(x, repoID)
  1791. }
  1792. // Repository.GetWatchers returns range of users watching given repository.
  1793. func (repo *Repository) GetWatchers(page int) ([]*User, error) {
  1794. users := make([]*User, 0, ItemsPerPage)
  1795. sess := x.Limit(ItemsPerPage, (page-1)*ItemsPerPage).Where("watch.repo_id=?", repo.ID)
  1796. if setting.UsePostgreSQL {
  1797. sess = sess.Join("LEFT", "watch", `"user".id=watch.user_id`)
  1798. } else {
  1799. sess = sess.Join("LEFT", "watch", "user.id=watch.user_id")
  1800. }
  1801. return users, sess.Find(&users)
  1802. }
  1803. func notifyWatchers(e Engine, act *Action) error {
  1804. // Add feeds for user self and all watchers.
  1805. watches, err := getWatchers(e, act.RepoID)
  1806. if err != nil {
  1807. return fmt.Errorf("get watchers: %v", err)
  1808. }
  1809. // Add feed for actioner.
  1810. act.UserID = act.ActUserID
  1811. if _, err = e.InsertOne(act); err != nil {
  1812. return fmt.Errorf("insert new actioner: %v", err)
  1813. }
  1814. for i := range watches {
  1815. if act.ActUserID == watches[i].UserID {
  1816. continue
  1817. }
  1818. act.ID = 0
  1819. act.UserID = watches[i].UserID
  1820. if _, err = e.InsertOne(act); err != nil {
  1821. return fmt.Errorf("insert new action: %v", err)
  1822. }
  1823. }
  1824. return nil
  1825. }
  1826. // NotifyWatchers creates batch of actions for every watcher.
  1827. func NotifyWatchers(act *Action) error {
  1828. return notifyWatchers(x, act)
  1829. }
  1830. // _________ __
  1831. // / _____// |______ _______
  1832. // \_____ \\ __\__ \\_ __ \
  1833. // / \| | / __ \| | \/
  1834. // /_______ /|__| (____ /__|
  1835. // \/ \/
  1836. type Star struct {
  1837. ID int64 `xorm:"pk autoincr"`
  1838. UID int64 `xorm:"UNIQUE(s)"`
  1839. RepoID int64 `xorm:"UNIQUE(s)"`
  1840. }
  1841. // Star or unstar repository.
  1842. func StarRepo(userID, repoID int64, star bool) (err error) {
  1843. if star {
  1844. if IsStaring(userID, repoID) {
  1845. return nil
  1846. }
  1847. if _, err = x.Insert(&Star{UID: userID, RepoID: repoID}); err != nil {
  1848. return err
  1849. } else if _, err = x.Exec("UPDATE `repository` SET num_stars = num_stars + 1 WHERE id = ?", repoID); err != nil {
  1850. return err
  1851. }
  1852. _, err = x.Exec("UPDATE `user` SET num_stars = num_stars + 1 WHERE id = ?", userID)
  1853. } else {
  1854. if !IsStaring(userID, repoID) {
  1855. return nil
  1856. }
  1857. if _, err = x.Delete(&Star{0, userID, repoID}); err != nil {
  1858. return err
  1859. } else if _, err = x.Exec("UPDATE `repository` SET num_stars = num_stars - 1 WHERE id = ?", repoID); err != nil {
  1860. return err
  1861. }
  1862. _, err = x.Exec("UPDATE `user` SET num_stars = num_stars - 1 WHERE id = ?", userID)
  1863. }
  1864. return err
  1865. }
  1866. // IsStaring checks if user has starred given repository.
  1867. func IsStaring(userID, repoID int64) bool {
  1868. has, _ := x.Get(&Star{0, userID, repoID})
  1869. return has
  1870. }
  1871. func (repo *Repository) GetStargazers(page int) ([]*User, error) {
  1872. users := make([]*User, 0, ItemsPerPage)
  1873. sess := x.Limit(ItemsPerPage, (page-1)*ItemsPerPage).Where("star.repo_id=?", repo.ID)
  1874. if setting.UsePostgreSQL {
  1875. sess = sess.Join("LEFT", "star", `"user".id=star.uid`)
  1876. } else {
  1877. sess = sess.Join("LEFT", "star", "user.id=star.uid")
  1878. }
  1879. return users, sess.Find(&users)
  1880. }
  1881. // ___________ __
  1882. // \_ _____/__________| | __
  1883. // | __)/ _ \_ __ \ |/ /
  1884. // | \( <_> ) | \/ <
  1885. // \___ / \____/|__| |__|_ \
  1886. // \/ \/
  1887. // HasForkedRepo checks if given user has already forked a repository with given ID.
  1888. func HasForkedRepo(ownerID, repoID int64) (*Repository, bool) {
  1889. repo := new(Repository)
  1890. has, _ := x.Where("owner_id=? AND fork_id=?", ownerID, repoID).Get(repo)
  1891. return repo, has
  1892. }
  1893. func ForkRepository(u *User, oldRepo *Repository, name, desc string) (_ *Repository, err error) {
  1894. repo := &Repository{
  1895. OwnerID: u.ID,
  1896. Owner: u,
  1897. Name: name,
  1898. LowerName: strings.ToLower(name),
  1899. Description: desc,
  1900. DefaultBranch: oldRepo.DefaultBranch,
  1901. IsPrivate: oldRepo.IsPrivate,
  1902. IsFork: true,
  1903. ForkID: oldRepo.ID,
  1904. }
  1905. sess := x.NewSession()
  1906. defer sessionRelease(sess)
  1907. if err = sess.Begin(); err != nil {
  1908. return nil, err
  1909. }
  1910. if err = createRepository(sess, u, repo); err != nil {
  1911. return nil, err
  1912. }
  1913. if _, err = sess.Exec("UPDATE `repository` SET num_forks=num_forks+1 WHERE id=?", oldRepo.ID); err != nil {
  1914. return nil, err
  1915. }
  1916. repoPath := RepoPath(u.Name, repo.Name)
  1917. _, stderr, err := process.ExecTimeout(10*time.Minute,
  1918. fmt.Sprintf("ForkRepository(git clone): %s/%s", u.Name, repo.Name),
  1919. "git", "clone", "--bare", oldRepo.RepoPath(), repoPath)
  1920. if err != nil {
  1921. return nil, fmt.Errorf("git clone: %v", stderr)
  1922. }
  1923. _, stderr, err = process.ExecDir(-1,
  1924. repoPath, fmt.Sprintf("ForkRepository(git update-server-info): %s", repoPath),
  1925. "git", "update-server-info")
  1926. if err != nil {
  1927. return nil, fmt.Errorf("git update-server-info: %v", err)
  1928. }
  1929. if err = createUpdateHook(repoPath); err != nil {
  1930. return nil, fmt.Errorf("createUpdateHook: %v", err)
  1931. }
  1932. return repo, sess.Commit()
  1933. }
  1934. func (repo *Repository) GetForks() ([]*Repository, error) {
  1935. forks := make([]*Repository, 0, repo.NumForks)
  1936. return forks, x.Find(&forks, &Repository{ForkID: repo.ID})
  1937. }
  1938. // ____ ___ .__ .___ ___________.___.__
  1939. // | | \______ | | _________ __| _/ \_ _____/| | | ____ ______
  1940. // | | /\____ \| | / _ \__ \ / __ | | __) | | | _/ __ \ / ___/
  1941. // | | / | |_> > |_( <_> ) __ \_/ /_/ | | \ | | |_\ ___/ \___ \
  1942. // |______/ | __/|____/\____(____ /\____ | \___ / |___|____/\___ >____ >
  1943. // |__| \/ \/ \/ \/ \/
  1944. //
  1945. // uploadRepoFiles uploads new files to repository.
  1946. func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, treeName, message string, uuids []string) (err error) {
  1947. repoWorkingPool.CheckIn(com.ToStr(repo.ID))
  1948. defer repoWorkingPool.CheckOut(com.ToStr(repo.ID))
  1949. localPath := repo.LocalCopyPath()
  1950. if err = discardLocalRepoBranchChanges(localPath, oldBranchName); err != nil {
  1951. return fmt.Errorf("discardLocalRepoChanges: %v", err)
  1952. } else if err = repo.UpdateLocalCopyBranch(oldBranchName); err != nil {
  1953. return fmt.Errorf("UpdateLocalCopyBranch: %v", err)
  1954. }
  1955. if oldBranchName != branchName {
  1956. repo.CheckoutNewBranch(oldBranchName, branchName)
  1957. }
  1958. dirPath := path.Join(localPath, treeName)
  1959. os.MkdirAll(dirPath, os.ModePerm)
  1960. // Copy uploaded files into repository.
  1961. for _, uuid := range uuids {
  1962. upload, err := getUpload(uuid, doer.ID, repo.ID)
  1963. if err != nil {
  1964. if IsErrUploadNotExist(err) {
  1965. continue
  1966. }
  1967. return fmt.Errorf("getUpload[%s]: %v", uuid, err)
  1968. }
  1969. uuidPath := upload.LocalPath()
  1970. filePath := dirPath + "/" + upload.Name
  1971. if err := os.Rename(uuidPath, filePath); err != nil {
  1972. DeleteUpload(upload, true)
  1973. return fmt.Errorf("Rename[%s -> %s]: %v", uuidPath, filePath, err)
  1974. }
  1975. DeleteUpload(upload, false) // false because we have moved the file
  1976. }
  1977. if len(message) == 0 {
  1978. message = "Add files to '" + treeName + "'"
  1979. }
  1980. if err = git.AddChanges(localPath, true); err != nil {
  1981. return fmt.Errorf("AddChanges: %v", err)
  1982. } else if err = git.CommitChanges(localPath, message, doer.NewGitSig()); err != nil {
  1983. return fmt.Errorf("CommitChanges: %v", err)
  1984. } else if err = git.Push(localPath, "origin", branchName); err != nil {
  1985. return fmt.Errorf("Push: %v", err)
  1986. }
  1987. return nil
  1988. }
  1989. // Upload represent a uploaded file to a repo to be deleted when moved
  1990. type Upload struct {
  1991. ID int64 `xorm:"pk autoincr"`
  1992. UUID string `xorm:"uuid UNIQUE"`
  1993. UID int64 `xorm:"INDEX"`
  1994. RepoID int64 `xorm:"INDEX"`
  1995. Name string
  1996. Created time.Time `xorm:"-"`
  1997. CreatedUnix int64
  1998. }
  1999. func (u *Upload) BeforeInsert() {
  2000. u.CreatedUnix = time.Now().UTC().Unix()
  2001. }
  2002. func (u *Upload) AfterSet(colName string, _ xorm.Cell) {
  2003. switch colName {
  2004. case "created_unix":
  2005. u.Created = time.Unix(u.CreatedUnix, 0).Local()
  2006. }
  2007. }
  2008. // UploadLocalPath returns where uploads is stored in local file system based on given UUID.
  2009. func UploadLocalPath(uuid string) string {
  2010. return path.Join(setting.Repository.Upload.TempPath, uuid[0:1], uuid[1:2], uuid)
  2011. }
  2012. // LocalPath returns where uploads are temporarily stored in local file system.
  2013. func (upload *Upload) LocalPath() string {
  2014. return UploadLocalPath(upload.UUID)
  2015. }
  2016. // NewUpload creates a new upload object.
  2017. func NewUpload(name string, buf []byte, file multipart.File, userId, repoId int64) (_ *Upload, err error) {
  2018. up := &Upload{
  2019. UUID: gouuid.NewV4().String(),
  2020. Name: name,
  2021. UID: userId,
  2022. RepoID: repoId,
  2023. }
  2024. if err = os.MkdirAll(path.Dir(up.LocalPath()), os.ModePerm); err != nil {
  2025. return nil, fmt.Errorf("MkdirAll: %v", err)
  2026. }
  2027. fw, err := os.Create(up.LocalPath())
  2028. if err != nil {
  2029. return nil, fmt.Errorf("Create: %v", err)
  2030. }
  2031. defer fw.Close()
  2032. if _, err = fw.Write(buf); err != nil {
  2033. return nil, fmt.Errorf("Write: %v", err)
  2034. } else if _, err = io.Copy(fw, file); err != nil {
  2035. return nil, fmt.Errorf("Copy: %v", err)
  2036. }
  2037. sess := x.NewSession()
  2038. defer sessionRelease(sess)
  2039. if err := sess.Begin(); err != nil {
  2040. return nil, err
  2041. }
  2042. if _, err := sess.Insert(up); err != nil {
  2043. return nil, err
  2044. }
  2045. return up, sess.Commit()
  2046. }
  2047. // RemoveUpload removes the file by UUID
  2048. func RemoveUpload(uuid string, userId, repoId int64) (err error) {
  2049. sess := x.NewSession()
  2050. defer sessionRelease(sess)
  2051. if err := sess.Begin(); err != nil {
  2052. return err
  2053. }
  2054. upload, err := getUpload(uuid, userId, repoId)
  2055. if err != nil {
  2056. return fmt.Errorf("getUpload[%s]: %v", uuid, err)
  2057. }
  2058. if err := DeleteUpload(upload, true); err != nil {
  2059. return fmt.Errorf("DeleteUpload[%s]: %v", uuid, err)
  2060. }
  2061. return nil
  2062. }
  2063. func getUpload(uuid string, userID, repoID int64) (*Upload, error) {
  2064. up := &Upload{UUID: uuid, UID: userID, RepoID: repoID}
  2065. has, err := x.Get(up)
  2066. if err != nil {
  2067. return nil, err
  2068. } else if !has {
  2069. return nil, ErrUploadNotExist{0, uuid, userID, repoID}
  2070. }
  2071. return up, nil
  2072. }
  2073. // GetUpload returns Upload by given UUID.
  2074. func GetUpload(uuid string, userId, repoId int64) (*Upload, error) {
  2075. return getUpload(uuid, userId, repoId)
  2076. }
  2077. // DeleteUpload deletes the given upload
  2078. func DeleteUpload(u *Upload, remove bool) error {
  2079. _, err := DeleteUploads([]*Upload{u}, remove)
  2080. return err
  2081. }
  2082. // DeleteUploads deletes the given uploads
  2083. func DeleteUploads(uploads []*Upload, remove bool) (int, error) {
  2084. for i, u := range uploads {
  2085. if remove {
  2086. if err := os.Remove(u.LocalPath()); err != nil {
  2087. return i, err
  2088. }
  2089. }
  2090. if _, err := x.Delete(u); err != nil {
  2091. return i, err
  2092. }
  2093. }
  2094. return len(uploads), nil
  2095. }
  2096. // __________ .__
  2097. // \______ \____________ ____ ____ | |__
  2098. // | | _/\_ __ \__ \ / \_/ ___\| | \
  2099. // | | \ | | \// __ \| | \ \___| Y \
  2100. // |______ / |__| (____ /___| /\___ >___| /
  2101. // \/ \/ \/ \/ \/
  2102. //
  2103. func (repo *Repository) CreateNewBranch(doer *User, oldBranchName, branchName string) (err error) {
  2104. repoWorkingPool.CheckIn(com.ToStr(repo.ID))
  2105. defer repoWorkingPool.CheckOut(com.ToStr(repo.ID))
  2106. localPath := repo.LocalCopyPath()
  2107. if err = discardLocalRepoBranchChanges(localPath, oldBranchName); err != nil {
  2108. return fmt.Errorf("discardLocalRepoChanges: %v", err)
  2109. } else if err = repo.UpdateLocalCopyBranch(oldBranchName); err != nil {
  2110. return fmt.Errorf("UpdateLocalCopyBranch: %v", err)
  2111. }
  2112. if err = repo.CheckoutNewBranch(oldBranchName, branchName); err != nil {
  2113. return fmt.Errorf("CreateNewBranch: %v", err)
  2114. }
  2115. if err = git.Push(localPath, "origin", branchName); err != nil {
  2116. return fmt.Errorf("Push: %v", err)
  2117. }
  2118. return nil
  2119. }