List of commits:
Subject Hash Author Date (UTC)
Added rg_git_repo_is_empty function plus func test a13c5439fceffd8b1474f1105ca37c7b703d2fc9 Catalin(ux) M. BOIE 2019-11-08 04:34:34
TODO updates, user_min/max defaults changed d2f35a43f5de793565e0df9889d587c524df5f20 Catalin(ux) M. BOIE 2019-11-06 16:32:08
More rg_exec2 fixes 808297884e42942c83762040c4247c7cf9a593e8 Catalin(ux) M. BOIE 2019-11-06 16:31:09
Always set rg[hostname] - used also for ssh connections for TOTP 1a7a693617ac521967b8df73245cd704004b76b5 Catalin(ux) M. BOIE 2019-11-06 04:10:59
White space corrections 92a1b944842439b9476a954daa2a65c5acfca85c Catalin(ux) M. BOIE 2019-11-05 18:52:08
README updates b57e3765de34c5e4ed7afa8384f24b6337352b17 Catalin(ux) M. BOIE 2019-11-01 03:18:48
download page updates 0185da40f7b2779c886b9c3e67b10fe69b1b112c Catalin(ux) M. BOIE 2019-11-01 03:13:14
css: small updates 59ae919c798d64f74ed8bdeb08241e4e76840afe Catalin(ux) M. BOIE 2019-10-30 21:33:37
comparison: updated pagespeed and other changes 3f423b7b0a98c0342e5d855c254812d37a03a5b8 Catalin(ux) M. BOIE 2019-10-30 21:27:20
html: specify logo size to avoid re-render b2ce82a59029e93438e9e6792f6aa6f7e44741c7 Catalin(ux) M. BOIE 2019-10-30 21:15:10
git(rocketgit_t) needs to map rocketgit_var_t files 2b10062807dd4f478e136aea1c239e117b46caed Catalin(ux) M. BOIE 2019-10-30 21:02:18
css: gravatar is displayed as block to get rid of below extra space b02dc575be2ccd8b99eff7509f8a7e62c57654a6 Catalin(ux) M. BOIE 2019-10-30 20:58:03
SELinux: more rights added 2e71284e917886f9ef2b0dcb005f63ff8153df1f Catalin(ux) M. BOIE 2019-10-30 17:30:08
We need also php-json for API f53e706bea1f29bb678ca39c2295ac8354af76d8 Catalin(ux) M. BOIE 2019-10-30 17:26:35
Small changes in several places 357571a8a8821b82f072bf83808342693e9a649c Catalin(ux) M. BOIE 2019-10-30 17:13:29
SELinux: php tries to map the config file 3e2115c88e7b424171060f14aa2cf4c856bf5e58 Catalin(ux) M. BOIE 2019-10-30 15:09:12
Removed comments from php-fpm.conf 46f4a76b3d0a37b3f6f2bdef8b749eca84246cce Catalin(ux) M. BOIE 2019-10-29 15:14:18
pool sample: removed comments 53364f40abda9cdab63a961e230bedb3c2dfcb67 Catalin(ux) M. BOIE 2019-10-29 15:12:01
Adapt spec file to Fedora 31 599df94445a9396fdc1cc0cc43df50838db973ae Catalin(ux) M. BOIE 2019-10-29 13:59:05
Cosmetic 69abfb69054c86d3b8136a83f3929831b2f75afe Catalin(ux) M. BOIE 2019-10-29 13:56:48
Commit a13c5439fceffd8b1474f1105ca37c7b703d2fc9 - Added rg_git_repo_is_empty function plus func test
Author: Catalin(ux) M. BOIE
Author date (UTC): 2019-11-08 04:34
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2019-11-08 04:34
Parent(s): d2f35a43f5de793565e0df9889d587c524df5f20
Signer:
Signing key:
Signing status: N
Tree: 749b6dad4996bcf6fca2a9054bb318c6a555615d
File Lines added Lines deleted
inc/git.inc.php 35 6
tests/git.php 21 0
File inc/git.inc.php changed (mode: 100644) (index 94cb366..d580e10)
... ... function rg_git_fatal($msg)
41 41 exit(1); exit(1);
42 42 } }
43 43
44 /*
45 * Returns true if a repo is empty, else, false
46 */
47 function rg_git_repo_is_empty($repo_path)
48 {
49 if (empty($repo_path))
50 $repo_path = '.';
51
52 if (file_exists($repo_path . '/.git'))
53 $repo_path .= '/.git';
54
55 if (!file_exists($repo_path . '/refs/heads'))
56 return TRUE;
57
58 $scan = glob($repo_path . '/refs/heads/*');
59 if ($scan === FALSE) {
60 rg_internal_error('globa returned false');
61 return FALSE;
62 }
63
64 if (empty($scan))
65 return TRUE;
66
67 return FALSE;
68 }
69
44 70 /* /*
45 71 * Locks a repo agains concurrent updates * Locks a repo agains concurrent updates
46 72 * @timeout - in seconds * @timeout - in seconds
 
... ... function rg_git_merge_base($repo_path, $a, $b)
595 621
596 622 $ret = FALSE; $ret = FALSE;
597 623 while (1) { while (1) {
624 if (rg_git_repo_is_empty($repo_path)) {
625 $ret = $rg_git_zero;
626 break;
627 }
628
598 629 if (empty($repo_path)) if (empty($repo_path))
599 630 $add = ''; $add = '';
600 631 else else
 
... ... function rg_git_log_simple($repo_path, $max, $from, $to, $also_patch, $files,
1132 1163
1133 1164 $ret = FALSE; $ret = FALSE;
1134 1165 while (1) { while (1) {
1135 if (!file_exists($repo_path . '/refs/heads/master')) {
1136 if (!file_exists($repo_path . '/.git/refs/heads/master')) {
1137 rg_log('Repo is empty.');
1138 $ret = array();
1139 break;
1140 }
1166 if (rg_git_repo_is_empty($repo_path)) {
1167 rg_log('Repo is empty.');
1168 $ret = array();
1169 break;
1141 1170 } }
1142 1171
1143 1172 $max_count = ($max == 0) ? "" : " --max-count=$max"; $max_count = ($max == 0) ? "" : " --max-count=$max";
File tests/git.php changed (mode: 100644) (index 7de37b4..3928b57)
... ... $rg_git_debug = 100;
16 16 $patch_limit = rg_git_patch_limit($db); $patch_limit = rg_git_patch_limit($db);
17 17
18 18
19 rg_log('');
20 rg_log_enter('Testing rg_git_merge_base on an empty repo');
21 $r = rg_exec('mkdir -p temp_repos'
22 . ' && rm -rf temp_repos/git_empty'
23 . ' && mkdir temp_repos/git_empty'
24 . ' && cd temp_repos/git_empty'
25 . ' && git init',
26 '', FALSE, FALSE, FALSE);
27 if ($r['ok'] != 1) {
28 rg_log('Could not create repo: ' . $r['errmsg'] . '!');
29 exit(1);
30 }
31 $r = rg_git_merge_base('temp_repos/git_empty', 'master',
32 '3fa5ae7e933e33308a6f3ec70edcf2499c1914ac');
33 if (strcmp($r, $rg_git_zero) != 0) {
34 rg_log('On an empty repo, merge-base is not zero ($r)!');
35 exit(1);
36 }
37 rg_log_exit();
38
39
19 40 rg_log(''); rg_log('');
20 41 rg_log_enter('Testing rg_git_log with a rename'); rg_log_enter('Testing rg_git_log with a rename');
21 42 $r = rg_exec('mkdir -p temp_repos' $r = rg_exec('mkdir -p temp_repos'
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/rocketgit

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main