List of commits:
Subject Hash Author Date (UTC)
Bulk 61b4d6048dca4647c779777323e23347bc89d1c0 Catalin(ux) M. BOIE 2012-05-09 19:28:35
Bulk d05a5530f3dd7e29a58adf5003944806535e2a41 Catalin(ux) M. BOIE 2012-05-09 03:20:27
Bulk 152dd3be1dc42e1f3585d43750c3c1c42551ae27 Catalin(ux) M. BOIE 2012-04-19 04:06:55
Bulk 2ec92b1397e09b0714d1ee423dcd72f4a220b332 Catalin(ux) M. BOIE 2012-04-16 06:43:38
aa 63a5cea75e640e6c11975bf6ab1c7bc49747a6bb Catalin(ux) M. BOIE 2012-03-26 21:09:23
Misc fixes eac04dc796b2c315b65753025e1e311bc25e83d7 Catalin(ux) M. BOIE 2012-03-26 18:14:32
Fixes for schema autoupdate 63d2a1a4f4c0498135a96f1a3d374868dc3d3535 Catalin(ux) M. BOIE 2012-03-23 04:19:09
Test CSRF token for the rights for a repo. e2d32e100f724e80ee623f191784ce429156ac39 Catalin(ux) M. BOIE 2012-03-22 03:54:37
Fixed anon push without create branch rights 3d474b7a569b16d87a426d4c3b971a50b3299894 Catalin(ux) M. BOIE 2012-03-22 03:43:06
Use rg_repos for repositories e5bda9469fddee7f201c22dfd89292830f4c342b Catalin(ux) M. BOIE 2012-03-22 03:42:06
Corrected <label> tags 7e8621e79480b8964e04de8c54f10f1a702ea1fd Catalin(ux) M. BOIE 2012-03-20 04:25:38
Fixed unit testing 31bfe5672e7d3b620d0e7b3c07ff72d84c149001 Catalin(ux) M. BOIE 2012-03-17 17:21:21
Fixed hook_update.sh unit testing 86c4079e81efc5a4a7878e91d8f4318e443961f7 Catalin(ux) M. BOIE 2012-03-16 22:32:35
Bulk updates f696473a7faee50782d3cc01e96cc85e7900b3de Catalin(ux) M. BOIE 2012-03-14 04:38:23
Style changes. 87e30b1df29b7c6efa438be1cf369192a8068655 Catalin(ux) M. BOIE 2012-02-19 22:50:22
Bulk 0923407bff68a58a0b7b034f8a6b4489ece5b237 Catalin(ux) M. BOIE 2012-02-12 22:21:44
Bulk update 30310488bca37cefeba96b52b71c9c3e72c32907 Catalin(ux) M. BOIE 2011-12-15 23:34:03
Profiling tests. afd1df2940fe440cde9b8ede988ff24c051a10d6 Catalin(ux) M. BOIE 2011-11-03 22:10:13
More bulk updates. a2a2e2545eaad61d0c675ea2afb801f207534515 Catalin(ux) M. BOIE 2011-11-03 22:09:34
Another round of bulk updates. 45bb00a88c420d439b4dd19971808722e4a70895 Catalin(ux) M. BOIE 2011-10-24 22:31:14
Commit 61b4d6048dca4647c779777323e23347bc89d1c0 - Bulk
Author: Catalin(ux) M. BOIE
Author date (UTC): 2012-05-09 19:28
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2012-05-09 19:28
Parent(s): d05a5530f3dd7e29a58adf5003944806535e2a41
Signing key:
Tree: 6dfc7c867700f80d8b3f6303a5c8c14ac11f0d70
File Lines added Lines deleted
TODO 19 2
hooks/post-receive 1 1
inc/gd.inc.php 1 1
inc/git.inc.php 63 13
inc/log.inc.php 2 1
inc/user.inc.php 23 5
inc/user/forgot_send.php 0 1
inc/user/repo-page.php 66 43
inc/util.inc.php 69 6
root/index.php 1 1
root/themes/default/index.php 3 1
root/themes/default/main.css 40 42
root/themes/default/repo/blob.html 1 1
root/themes/default/repo/log/header.html 1 1
root/themes/default/repo/main.html 23 19
root/themes/default/repo/source_r.html 0 4
root/themes/default/repo/tree/line.html 1 1
samples/config.php 6 0
scripts/cron.php 0 8
File TODO changed (mode: 100644) (index ad15ccd..c0d4ecd)
1 1 == BEFORE FIRST RELEASE! == == BEFORE FIRST RELEASE! ==
2 2 [ ] Make available the merge requests. [ ] Make available the merge requests.
3 3 [ ] Add possibility to reject merge requests, to apply, to delete etc. [ ] Add possibility to reject merge requests, to apply, to delete etc.
4 [ ] "Tree" is broken when not on "master" branch.
5 4 [ ] JUNK1/JUNK2: http://rg.embedromix.ro:8000/user/catab/rocketgit/commit/afd1df2..f919c9b [ ] JUNK1/JUNK2: http://rg.embedromix.ro:8000/user/catab/rocketgit/commit/afd1df2..f919c9b
6 5 [ ] Confirmation e-mail comes from rg1. [ ] Confirmation e-mail comes from rg1.
6 [ ] rg_log: why the fd is NULL?!
7 [ ] Install text files in /usr/share/doc
8 [ ] "log" does not list last entries! More exactly, seems the owner does not update repo!
9 [ ] @@branch@@ is not defined for merge requests. Should it? Probably yes, to filter them.
10 [ ] Create a repo and click on it; seems we get error (gabi)!
7 11 [ ] [ ]
8 12
9 13 == Normal priority == == Normal priority ==
10 [ ] Add a @@DUMP@@ in every template, so a user will know what variables can use.
14 [ ] Permit "log" to see more rows.
15 [ ] Allow admin to upload keys for a user.
16 [ ] Make an option to not allow a client to upload keys.
17 [ ] Can we bypass ssh auth to allow pushes?
18 This way maybe we can identify client by fingerprint.
19 [ ] Use rg_git_diff_tree to test for path based restrictions. Also, take care of renmaes, copies etc.
20 [ ] See Gerrit: https://codereview.qt-project.org/#change,22764
21 [ ] user-conf: option: auto-create-repo-on-push
22 [ ] Use git push to do all kind of commands: create repo, delete repo, update description etc.
23 [ ] Allow creating a template for repositories.
24 [ ] Optionally init a repo with some files (README, TODO etc.)
25 [ ] Check https://git.wiki.kernel.org/articles/g/i/t/GitHosting_2036.html
26 [ ] Add RocketGit to https://git.wiki.kernel.org/articles/g/i/t/GitHosting_2036.html
27 [ ] Add a dependency on sendmail.
11 28 [ ] Improve e-mails to not be considered spam. [ ] Improve e-mails to not be considered spam.
12 29 [ ] Statistics (number, tool etc.) for project access. [ ] Statistics (number, tool etc.) for project access.
13 30 [ ] For bugtracker use BerliOS as a starting point. [ ] For bugtracker use BerliOS as a starting point.
File hooks/post-receive changed (mode: 100755) (index a349cbb..b691c6e)
... ... fclose($f);
60 60
61 61
62 62 // Mark repository dirty for disk statistics and other stuff // Mark repository dirty for disk statistics and other stuff
63 @file_put_contents($rg_path . "/dirty", "");
63 @file_put_contents($repo_path . "/dirty", "");
64 64
65 65 $a = array( $a = array(
66 66 "op" => "push", "op" => "push",
File inc/gd.inc.php changed (mode: 100644) (index b0f6f94..e6fdf4f)
6 6 */ */
7 7 function rg_gd_graph($a) function rg_gd_graph($a)
8 8 { {
9 $i = ImageCreateTrueColor($a[w], $a[h]);
9 $i = ImageCreateTrueColor($a['w'], $a['h']);
10 10 if (!$i) if (!$i)
11 11 return FALSE; return FALSE;
12 12
File inc/git.inc.php changed (mode: 100644) (index 099e329..02bcad4)
... ... function rg_git_ls_tree($tree, $path)
355 355 $tree = " HEAD"; $tree = " HEAD";
356 356 } }
357 357
358 $cmd = "git ls-tree --long" . $op . $tree . " " . escapeshellcmd($path);
358 $cmd = "git ls-tree --long" . $op . $tree;
359 if (!empty($path))
360 $cmd .= " " . escapeshellarg($path);
361 rg_log("DEBUG: cmd=$cmd");
359 362 $a = rg_exec($cmd); $a = rg_exec($cmd);
360 363 if ($a['ok'] != 1) { if ($a['ok'] != 1) {
361 364 rg_git_set_error("error on ls-tree (" . $a['errmsg'] . ")"); rg_git_set_error("error on ls-tree (" . $a['errmsg'] . ")");
362 365 return FALSE; return FALSE;
363 366 } }
364 367
368 if (empty($a['data'])) {
369 rg_git_set_error("error on ls-tree: empty answer");
370 return FALSE;
371 }
372
365 373 $output = explode("\n", trim($a['data'])); $output = explode("\n", trim($a['data']));
366 374 foreach ($output as $line) { foreach ($output as $line) {
367 375 $_y = array(); $_y = array();
 
... ... function rg_git_ls_tree($tree, $path)
379 387
380 388 rg_prof_end("git_ls_tree"); rg_prof_end("git_ls_tree");
381 389
390 rg_log("DEBUG: ls-tree: " . print_r($ret, TRUE));
391
382 392 return $ret; return $ret;
383 393 } }
384 394
 
... ... function rg_git_branches_and_tags($repo_dir, $base_url, $current_ref)
959 969 . " current_ref=$current_ref"); . " current_ref=$current_ref");
960 970
961 971 $ret = array(); $ret = array();
972 $ret['HTML:branches_and_tags'] = "";
962 973
963 974 $current = ltrim($current_ref, "/"); $current = ltrim($current_ref, "/");
964 975 if (empty($current)) if (empty($current))
 
... ... function rg_git_branches_and_tags($repo_dir, $base_url, $current_ref)
966 977 rg_log("DEBUG: current=[$current]"); rg_log("DEBUG: current=[$current]");
967 978
968 979 $refs = rg_git_refs($repo_dir); $refs = rg_git_refs($repo_dir);
980 $_l = array();
969 981 foreach ($refs as $o => $list) { foreach ($refs as $o => $list) {
970 if (empty($list)) {
971 $_ret['HTML:' . $o] = "";
982 if (empty($list))
972 983 continue; continue;
973 }
974 984
975 $_t = "<div class=\"branch_or_tag $o\">\n";
976 $_t .= "<ul>\n";
977 $_l = array();
978 985 foreach ($list as $name) { foreach ($list as $name) {
979 986 $name = htmlspecialchars($name); $name = htmlspecialchars($name);
980 987 $ename = preg_replace('/\//', ',', $name); $ename = preg_replace('/\//', ',', $name);
 
... ... function rg_git_branches_and_tags($repo_dir, $base_url, $current_ref)
986 993 $add_s = ""; $add_s = "";
987 994 $add_e = ""; $add_e = "";
988 995 } }
989 $_l[] = "<li>"
996 $_l[] = "<span class=\"" . $o . "\">"
990 997 . "<a href=\"" . $base_url . "/source/log/$o/$ename" . "\">" . "<a href=\"" . $base_url . "/source/log/$o/$ename" . "\">"
991 998 . $add_s . $name . $add_e . $add_s . $name . $add_e
992 999 . "</a>" . "</a>"
993 . "</li>\n";
1000 . "</span>\n";
994 1001 } }
995 $_t .= implode("\n", $_l);
996 $_t .= "</ul>\n";
997 $_t .= "</div>\n";
998 $ret['HTML:' . $o] = $_t;
999 1002 } }
1000 1003
1004 $ret['HTML:branches_and_tags'] = "<div class=\"branches_and_tags\">\n";
1005 $ret['HTML:branches_and_tags'] .= implode("\n", $_l);
1006 $ret['HTML:branches_and_tags'] .= "</div>\n";
1007
1008 rg_log("rg_git_branches_and_tags: ret:" . print_r($ret, TRUE));
1009
1001 1010 return $ret; return $ret;
1002 1011 } }
1003 1012
 
... ... function rg_git_parse_ref(&$paras)
1038 1047 return $ret; return $ret;
1039 1048 } }
1040 1049
1050 /*
1051 * Returns a diff between two trees
1052 */
1053 function rg_git_diff_tree($tree1, $tree2)
1054 {
1055 rg_prof_start("git_diff_tree");
1056
1057 rg_log("rg_git_diff_tree: tree1=$tree1 tree2=$tree2");
1058
1059 $ret = array();
1060
1061 $cmd = "git diff-tree -r " . escapeshellarg($tree1)
1062 . " " . escapeshellarg($tree2);
1063 rg_log("DEBUG: cmd=$cmd");
1064 $a = rg_exec($cmd);
1065 if ($a['ok'] != 1) {
1066 rg_git_set_error("error on diff-tree (" . $a['errmsg'] . ")");
1067 return FALSE;
1068 }
1069
1070 $output = explode("\n", trim($a['data']));
1071 foreach ($output as $line) {
1072 $_y = array();
1073 $_t = explode(" ", $line, 5);
1074 $_y['mode1'] = $_t[0];
1075 $_y['mode2'] = $_t[1];
1076 $_y['ref1'] = $_t[2];
1077 $_y['ref2'] = $_t[3];
1078
1079 $_op_file = explode("\t", $_t[4], 2);
1080 $_y['op'] = $_op_file[0];
1081 $_y['file'] = $_op_file[1]; // TODO: here, the filename is not UTF-8!
1082 $ret[] = $_y;
1083 }
1084
1085 rg_prof_end("git_diff_tree");
1086
1087 rg_log("DEBUG: diff-tree: " . print_r($ret, TRUE));
1088
1089 return $ret;
1090 }
1041 1091 ?> ?>
File inc/log.inc.php changed (mode: 100644) (index ac1a06a..0247f02)
... ... function rg_log($str)
36 36 $buf = gmdate("Y-m-d H:i:s", $t['sec']) . "." . sprintf("%03u", $t['usec'] / 1000); $buf = gmdate("Y-m-d H:i:s", $t['sec']) . "." . sprintf("%03u", $t['usec'] / 1000);
37 37 $buf .= " " . $rg_log_sid . " " . $str . "\n"; $buf .= " " . $rg_log_sid . " " . $str . "\n";
38 38
39 fwrite($rg_log_fd, $buf);
39 if ($rg_log_fd !== NULL)
40 fwrite($rg_log_fd, $buf);
40 41 } }
41 42
42 43 function r66_fatal($msg) function r66_fatal($msg)
File inc/user.inc.php changed (mode: 100644) (index 7107b57..560c59b)
... ... function rg_user_auto_login($db, $uid, &$rg_ui)
339 339 if ($rg_ui['exists'] != 1) if ($rg_ui['exists'] != 1)
340 340 return FALSE; return FALSE;
341 341
342 $secure = FALSE;
343 if (isset($_SERVER['HTTPS']))
344 $secure = TRUE;
345
342 346 $sid = rg_id(40); $sid = rg_id(40);
343 347 rg_sess_add($db, $uid, $sid, $rg_ui['session_time']); rg_sess_add($db, $uid, $sid, $rg_ui['session_time']);
344 348 setcookie("sid", $sid, 0, "/", $_SERVER['SERVER_NAME'], setcookie("sid", $sid, 0, "/", $_SERVER['SERVER_NAME'],
345 @strcmp($_SERVER['HTTPS'], "on") == 0 /* secure */,
346 TRUE /* httponly */);
349 $secure, TRUE /* httponly */);
347 350
348 351 return TRUE; return TRUE;
349 352 } }
 
... ... function rg_user_forgot_pass_mail_prepare($db, $email)
656 659 $ret['ok'] = 1; $ret['ok'] = 1;
657 660 $ret['exists'] = 1; $ret['exists'] = 1;
658 661 $ret['token'] = $token; $ret['token'] = $token;
662
663 rg_log("DEBUG: user_forgot_pass_mail_prepare: ret=" . rg_array2string($ret));
664
659 665 return $ret; return $ret;
660 666 } }
661 667
 
... ... function rg_user_forgot_pass_mail($db, $email)
670 676
671 677 $ret = array(); $ret = array();
672 678 $ret['ok'] = 0; $ret['ok'] = 0;
679 $ret['exists'] = 0;
673 680
674 681 $r = rg_user_forgot_pass_mail_prepare($db, $email); $r = rg_user_forgot_pass_mail_prepare($db, $email);
675 if ($r['exists'] != 1)
682 if ($r['exists'] != 1) {
683 rg_log("\tUser does not exists.");
676 684 return $r; return $r;
685 }
686
687 $ret['exists'] = 1;
677 688
678 689 $headers = "From: $rg_admin_name <$rg_admin_email>"; $headers = "From: $rg_admin_name <$rg_admin_email>";
679 690
691 if (isset($_SERVER['HTTPS']))
692 $proto = "https";
693 else
694 $proto = "http";
695
680 696 if (!mail($email, if (!mail($email,
681 697 "Forgot password", "Forgot password",
682 698 "Hello!\n\n" "Hello!\n\n"
683 699 . "If you want to reset the password, follow:\n" . "If you want to reset the password, follow:\n"
684 . (@strcmp($_SERVER['HTTPS'], "on") == 0 ? "https://" : "http://")
700 . $proto . "://"
685 701 . @$_SERVER['HTTP_HOST'] . @$_SERVER['HTTP_HOST']
686 . rg_re_url("/op/forgot_link") . "&forgot_token=$forgot_token",
702 . rg_re_url("/op/forgot_link") . "&forgot_token=" . $r['token'],
687 703 $headers, $headers,
688 704 "-f $rg_admin_email")) { "-f $rg_admin_email")) {
689 705 rg_user_set_error("Cannot send mail ($php_errormsg)!"); rg_user_set_error("Cannot send mail ($php_errormsg)!");
 
... ... function rg_user_forgot_pass_mail($db, $email)
691 707 } }
692 708
693 709 $ret['ok'] = 1; $ret['ok'] = 1;
710
711 rg_log("DEBUG: user_forgot_pass_mail: ret=" . rg_array2string($ret) . ".");
694 712 return $ret; return $ret;
695 713 } }
696 714
File inc/user/forgot_send.php changed (mode: 100644) (index 2015b37..e2c7968)
... ... $show_form = 1;
10 10
11 11 if ($doit == 1) { if ($doit == 1) {
12 12 $r = rg_user_forgot_pass_mail($db, $email); $r = rg_user_forgot_pass_mail($db, $email);
13 rg_log("DEBUG: user_forgot_pass_mail: " . rg_array2string($r) . ".");
14 13 if ($r['ok'] == 0) { if ($r['ok'] == 0) {
15 14 $errmsg[] = "Internal error! Try again later."; $errmsg[] = "Internal error! Try again later.";
16 15 } else if ($r['exists'] == 0) { } else if ($r['exists'] == 0) {
File inc/user/repo-page.php changed (mode: 100644) (index 137f1b7..3899721)
... ... if (empty($subop))
50 50
51 51 $_more['repo_body'] = ""; $_more['repo_body'] = "";
52 52 $_more['repo_right'] = ""; $_more['repo_right'] = "";
53 $_repo_body = "";
54 $_repo_right = "";
53 55
54 56 if (strcmp($subop, "admin") == 0) { if (strcmp($subop, "admin") == 0) {
55 57 if ($can_admin != 1) if ($can_admin != 1)
 
... ... if (strcmp($subop, "admin") == 0) {
73 75
74 76 rg_log("DEBUG: subop=[$subop]"); rg_log("DEBUG: subop=[$subop]");
75 77 if (strcmp($subop, "tree") == 0) { if (strcmp($subop, "tree") == 0) {
76 if (empty($paras)) {
77 $type = "tree";
78 } else {
79 $type = array_shift($paras);
80 }
81 rg_log("DEBUG: type=[$type]");
82
83 if (strcmp($type, "tree") == 0) {
84 $_tree = rg_git_ls_tree($ref, implode("/", $paras));
78 $type = array_shift($paras);
79 rg_log("DEBUG: tree: type=$type");
80 if (strcmp($type, "blob") == 0) {
81 // find hash of blob
82 $_path = implode("/", $paras);
83 $_more['path'] = "/" . $_path;
84 $_tree = rg_git_ls_tree($ref, $_path);
85 if ($_tree === FALSE) {
86 $_repo_body .= "Invalid path!";
87 } else {
88 $blob = $_tree[0];
89 $_hash = $_tree[0]['ref'];
90 $c = rg_git_content($_hash);
91 $_content = array(
92 "obj" => $obj,
93 "HTML:content" => rg_template_list($c)
94 );
95 $blob = array_merge($blob, $_content);
96 $_repo_body .= rg_template("repo/blob.html",
97 array_merge($blob, $_more));
98 }
99 } else if (strcmp($type, "tree") == 0) {
100 // find treeish of dir
101 $_path = implode("/", $paras);
102 $_more['path'] = "/" . $_path;
103 $_tree = rg_git_ls_tree($ref, $_path);
104 if ($_tree === FALSE) {
105 $_repo_body .= "Invalid path!";
106 } else {
107 $_hash = $_tree[0]['ref'];
108 $_tree = rg_git_ls_tree($_hash, "");
109 $_repo_body .= rg_template_table("repo/tree", $_tree, $_more);
110 }
111 } else { // default is to show root tree
112 $_more['path'] = "";
113 $_tree = rg_git_ls_tree($ref, "");
85 114 $_repo_body .= rg_template_table("repo/tree", $_tree, $_more); $_repo_body .= rg_template_table("repo/tree", $_tree, $_more);
86 } else if (strcmp($type, "blob") == 0) {
87 // TODO: transform path in tree
88 /*
89 $c = rg_git_content($obj);
90 $blob = array(
91 "obj" => $obj,
92 "HTML:content" => rg_template_list($c)
93 );
94 $_repo_body .= rg_template("repo/blob.html",
95 array_merge($blob, $_more));
96 */
97 115 } }
98 116 } else { // log is default } else { // log is default
117 // show the log
99 118 $log = rg_git_log(10, "", $ref, FALSE); $log = rg_git_log(10, "", $ref, FALSE);
100 119 if ($log === FALSE) { if ($log === FALSE) {
101 120 rg_log("Error generating log (" . rg_git_error() . ")!"); rg_log("Error generating log (" . rg_git_error() . ")!");
 
... ... if (strcmp($subop, "admin") == 0) {
106 125 $_repo_body .= rg_git_log_template($log, $_repo_body .= rg_git_log_template($log,
107 126 "repo/log", $_more); "repo/log", $_more);
108 127 } }
128
129 $type = array_shift($paras);
130 rg_log("DEBUG: log: type=$type");
131 if (strcmp($type, "commit") == 0) {
132 $commit = rg_git_reference($paras[0]);
133 rg_log("Show diff for commit [$commit]");
134
135 if (strstr($commit, "..")) {
136 $t = explode("..", $commit);
137 $first = $t[0];
138 $second = $t[1];
139 } else {
140 $first = $commit . "~1";
141 $second = $commit;
142 }
143
144 $log = rg_git_log(1, $first, $second, TRUE);
145 rg_log("log: " . print_r($log, TRUE));
146
147 // stats
148 $_repo_body .= rg_git_files_stats($log[0]['files'], "repo/fstat");
149
150 // diff
151 //rg_log("patch: " . print_r($log[0]['patches'], TRUE));
152 $_repo_body .= rg_git_diff($log[0]['patches'], "repo/diff.html");
153 }
109 154 } }
110 155 $_repo_right = rg_template("repo/source_r.html", $_more); $_repo_right = rg_template("repo/source_r.html", $_more);
111 156 } else if (strcmp($subop, "issues") == 0) { } else if (strcmp($subop, "issues") == 0) {
 
... ... if (strcmp($subop, "admin") == 0) {
123 168 $_repo_body .= rg_template_table("repo/mr/list", $r, $_more); $_repo_body .= rg_template_table("repo/mr/list", $r, $_more);
124 169 } }
125 170 } else if (strcmp($subop, "mr") == 0) { } else if (strcmp($subop, "mr") == 0) {
171 // TODO: this should be under /mrs path (above)!
126 172 $mr = preg_replace('/[^0-9a-zA-Z_]/', '', $paras[0]); $mr = preg_replace('/[^0-9a-zA-Z_]/', '', $paras[0]);
127 173 $r = rg_mr_load_one($db, $ri['repo_id'], $mr); $r = rg_mr_load_one($db, $ri['repo_id'], $mr);
128 174 if ($r === FALSE) { if ($r === FALSE) {
 
... ... if (strcmp($subop, "admin") == 0) {
130 176 } else { } else {
131 177 $_repo_body .= rg_template("repo/mr/page.html", $r, $_more); $_repo_body .= rg_template("repo/mr/page.html", $r, $_more);
132 178 } }
133 } else if (strcmp($subop, "commit") == 0) {
134 $commit = rg_git_reference($paras[0]);
135 rg_log("Show diff for commit [$commit]");
136
137 if (strstr($commit, "..")) {
138 $t = explode("..", $commit);
139 $first = $t[0];
140 $second = $t[1];
141 } else {
142 $first = $commit . "~1";
143 $second = $commit;
144 }
145
146
147 $log = rg_git_log(1, $first, $second, TRUE);
148 rg_log("log: " . print_r($log, TRUE));
149
150 // stats
151 $_repo_body .= rg_git_files_stats($log[0]['files'], "repo/fstat");
152
153 // diff
154 //rg_log("patch: " . print_r($log[0]['patches'], TRUE));
155 $_repo_body .= rg_git_diff($log[0]['patches'], "repo/diff.html");
156 179 } }
157 180
158 181 $ri2 = $ri; $ri2 = $ri;
File inc/util.inc.php changed (mode: 100644) (index 8ebdb31..e0c87ea)
1 1 <?php <?php
2 2 require_once($INC . "/prof.inc.php"); require_once($INC . "/prof.inc.php");
3 require_once($INC . "/log.inc.php");
4
5 set_error_handler("rg_error_handler");
6 register_shutdown_function("rg_shutdown_error");
3 7
4 8 function rg_util_set_error($str) function rg_util_set_error($str)
5 9 { {
 
... ... function rg_re_repopage($ui, $repo)
164 168
165 169 function rg_re_repo_ssh($rr) function rg_re_repo_ssh($rr)
166 170 { {
167 return "ssh://rocketgit@" . $_SERVER['SERVER_NAME']
171 global $rg_ssh_port;
172
173 if ($rg_ssh_port == 22)
174 $port = "";
175 else
176 $port = ":" . $rg_ssh_port;
177 return "ssh://rocketgit@" . $_SERVER['SERVER_NAME'] . $port
168 178 . $rr['prefix'] . "/" . $rr['user'] . "/" . $rr['repo']; . $rr['prefix'] . "/" . $rr['user'] . "/" . $rr['repo'];
169 179 } }
170 180
171 181 function rg_re_repo_git($rr) function rg_re_repo_git($rr)
172 182 { {
173 return "git://" . $_SERVER['SERVER_NAME']
183 global $rg_git_port;
184
185 if ($rg_git_port == 9418)
186 $port = "";
187 else
188 $port = ":" . $rg_git_port;
189
190 return "git://" . $_SERVER['SERVER_NAME'] . $port
174 191 . $rr['prefix'] . "/" . $rr['user'] . "/" . $rr['repo']; . $rr['prefix'] . "/" . $rr['user'] . "/" . $rr['repo'];
175 192 } }
176 193
 
... ... function rg_rmdir($dir)
248 265 /* /*
249 266 * Generates a menu * Generates a menu
250 267 */ */
251 function rg_menu($a, $rg_ui)
268 function rg_menu($a, $rg_ui, $op, $subop)
252 269 { {
270 rg_log("menu: op=$op subop=$subop");
271
253 272 $menu = "<div class=\"menu\">\n"; $menu = "<div class=\"menu\">\n";
254 273 $menu .= "\t<ul>\n"; $menu .= "\t<ul>\n";
255 274 $menu2 = ""; $menu2 = "";
 
... ... function rg_menu($a, $rg_ui)
270 289 $_text = $_info['text']; $_text = $_info['text'];
271 290 $_url = rg_re_url($_info['op']); $_url = rg_re_url($_info['op']);
272 291 //$menu .= "<!-- op=" . $_info['op'] . " url=$_url." . " -->\n"; //$menu .= "<!-- op=" . $_info['op'] . " url=$_url." . " -->\n";
273 $menu .= "\t\t<li><a href=\"" . $_url . "\">$_text</a></li>\n";
292
293 rg_log("\tDEBUG: compare with [" . $_info['op'] . "]");
294 $add = "";
295 if (strcmp($_info['op'], "/op/" . $op) == 0)
296 $add = " class=\"selected\"";;
297 $menu .= "\t\t<li><a href=\"" . $_url . "\"" . $add . ">"
298 . $_text . "</a></li>\n";
274 299
275 300 if (!isset($_info['sub']) || (count($_info['sub']) == 0)) if (!isset($_info['sub']) || (count($_info['sub']) == 0))
276 301 continue; continue;
 
... ... function rg_menu($a, $rg_ui)
280 305 foreach ($_info['sub'] as $junk => $_info2) { foreach ($_info['sub'] as $junk => $_info2) {
281 306 $_text2 = $_info2['text']; $_text2 = $_info2['text'];
282 307 $_url2 = $_url . "/" . $_info2['op']; $_url2 = $_url . "/" . $_info2['op'];
308 $add = "";
309 rg_log("\tDEBUG: compare with [" . $_info2['op'] . "]");
310 if (strcmp($_info2['op'], $subop) == 0)
311 $add = " class=\"selected\"";;
283 312 $menu2 .= "\t\t<li><a href=\"" $menu2 .= "\t\t<li><a href=\""
284 313 . $_url2 . $_url2
285 . "\">$_text2</a></li>\n";
314 . "\"" . $add . ">" . $_text2 . "</a></li>\n";
286 315 } }
287 316 $menu2 .= "\t</ul>\n"; $menu2 .= "\t</ul>\n";
288 317 $menu2 .= "\t</div>\n"; $menu2 .= "\t</div>\n";
 
... ... function rg_prepare_replace(&$data, &$what, &$values)
328 357 $what['DUMP'] = "/@@DUMP@@/U"; $what['DUMP'] = "/@@DUMP@@/U";
329 358 $values['DUMP'] = print_r($data, TRUE); $values['DUMP'] = print_r($data, TRUE);
330 359
360 // we replace @@unknown@@ with empty
361 //$what['FINAL'] = "/@@.*@@/U";
362 //$values['FINAL'] = "";
363
331 364 //rg_log("DEBUG: what: " . print_r($what, TRUE)); //rg_log("DEBUG: what: " . print_r($what, TRUE));
332 365 //rg_log("DEBUG: values: " . print_r($values, TRUE)); //rg_log("DEBUG: values: " . print_r($values, TRUE));
333 366 } }
 
... ... function rg_array2string($a)
485 518 $ret = ""; $ret = "";
486 519 $add = ""; $add = "";
487 520 foreach ($a as $k => $v) { foreach ($a as $k => $v) {
488 $ret .= $add . " $k=$v";
521 $ret .= $add . "$k=$v";
489 522 $add = " "; $add = " ";
490 523 } }
491 524
 
... ... function rg_copy_tree($src, $dst, $mask)
582 615 return TRUE; return TRUE;
583 616 } }
584 617
618 /*
619 * Called by PHP in case of error
620 */
621 function rg_error_handler($no, $str, $file, $line)
622 {
623 if ($no == 0)
624 return;
625
626 $str = str_replace("\n", "\\n", $str);
627
628 rg_log("PHP ERROR: $file:$line: $str (errno=$no)");
629
630 if ($no == E_ERROR)
631 die();
632
633 return FALSE;
634 }
635
636 /*
637 * shutdown function to call fatal errors
638 */
639 function rg_shutdown_error()
640 {
641 $a = error_get_last();
642 if ($a === NULL)
643 return;
644
645 rg_error_handler($a['type'], $a['message'], $a['file'], $a['line']);
646 }
647
585 648 ?> ?>
File root/index.php changed (mode: 100644) (index 621d2de..fa1a2e2)
... ... $first_menu = array(
132 132 "op" => "/op/logout") "op" => "/op/logout")
133 133 ); );
134 134 $first_menu[$op]['sub'] = $second_menu; $first_menu[$op]['sub'] = $second_menu;
135 $menu = implode("", rg_menu($first_menu, $rg_ui));
135 $menu = implode("", rg_menu($first_menu, $rg_ui, $op, $subop));
136 136
137 137 if ($rg_ui['uid'] > 0) if ($rg_ui['uid'] > 0)
138 138 $rg_username = $rg_ui['username']; $rg_username = $rg_ui['username'];
File root/themes/default/index.php changed (mode: 100644) (index 802dcd7..ca5c534)
15 15 <b><?php echo $rg_username; ?></b> <b><?php echo $rg_username; ?></b>
16 16 </div> </div>
17 17
18 <div style="float: left; font-size:11pt; padding: 5px 20px 5px 0px;">
18 <div style="float: left; font-size:11pt; padding: 5px 10px 5px 0px;">
19 19 <a style="text-decoration: none; color: red;" href="/"><b>RocketGit</b></a> <a style="text-decoration: none; color: red;" href="/"><b>RocketGit</b></a>
20 20 </div> </div>
21 21
 
39 39 </div> </div>
40 40 </div> </div>
41 41
42 <!--
42 43 <div id="profiling"> <div id="profiling">
43 44 Profiling:<br /> Profiling:<br />
44 45 <?php echo rg_prof_html(); ?> <?php echo rg_prof_html(); ?>
45 46 </div> </div>
47 -->
46 48
47 49 </div> <!-- container --> </div> <!-- container -->
48 50
File root/themes/default/main.css changed (mode: 100644) (index 8bcfbd6..d5d7a67)
4 4 } }
5 5
6 6 body { body {
7 font-family: sans-serif;
7 font-family: arial, helvetica, sans-serif;
8 8 font-size: 10pt; font-size: 10pt;
9 9 line-height: 105%; line-height: 105%;
10 10 } }
 
... ... th, td {
26 26 word-wrap: break-word; word-wrap: break-word;
27 27 } }
28 28
29 #container { background-color: #eeeeee; }
29 #container { background-color: #eeeeee; overflow: hidden; }
30 30
31 31 .white_border { border: 1px solid #eeeeee; } .white_border { border: 1px solid #eeeeee; }
32 32
33 #menus {}
33 #menus { float: left; }
34 34
35 .menu { padding: 4px 0px; }
35 .menu { padding: 6px 0px; }
36 36 .menu ul { list-style-type: none; } .menu ul { list-style-type: none; }
37 37 .menu ul li { display: inline; } .menu ul li { display: inline; }
38 38 .menu ul li a { .menu ul li a {
 
... ... th, td {
44 44 border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px;
45 45 } }
46 46 .menu ul li a:hover { border: 1px solid #999999; } .menu ul li a:hover { border: 1px solid #999999; }
47 .menu ul li a.selected { color: #bbbbbb; }
48 .menu ul li a.selected:hover { border: 1px solid #cccccc; }
47 49
48 50 .junk {} .junk {}
49 51
50 .branch_or_tag { padding: 5px; }
51 .branch_or_tag ul { list-style-type: none; }
52 .branch_or_tag ul li a {
53 padding: 2px 2px;
52 .branches_and_tags { padding: 3px 0px; margin: 3px 0px; }
53 .branches_and_tags a {
54 padding: 3px 3px;
54 55 text-decoration: none; text-decoration: none;
55 56 color: black; color: black;
56 border: 1px solid black;
57 border: 1px solid #cccccc;
57 58 border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px;
58 59 font-size: 9pt; font-size: 9pt;
59 margin: 2px;
60 display: block;
61 60 } }
62 .branch ul li a { background-color: #a0ffa0; }
63 .tag ul li a { background-color: #ffffa0; }
61 .branch a { background-color: #a0ffa0; }
62 .tag a { background-color: #ffffa0; }
64 63
65 64 #header { #header {
66 65 padding: 5px; padding: 5px;
66 overflow: hidden;
67 67 } }
68 68
69 69 #main { #main {
70 70 clear: both; clear: both;
71 71 border-top: 1px solid #cccccc; border-top: 1px solid #cccccc;
72 72 padding: 5px; padding: 5px;
73 overflow: hidden;
73 74 } }
74 75
75 76 #footer { #footer {
76 77 clear: both; clear: both;
77 78 border-top: 1px solid #cccccc; border-top: 1px solid #cccccc;
78 79 padding: 5px 5px; padding: 5px 5px;
80 overflow: hidden;
79 81 } }
80 82
81 83 .formarea { .formarea {
 
... ... th, td {
99 101 padding: 5px 5px; padding: 5px 5px;
100 102 border-bottom: 1px solid #cccccc; border-bottom: 1px solid #cccccc;
101 103 font-size: 8pt; font-size: 8pt;
104 overflow: hidden;
102 105 } }
103 106
104 107 .error { .error {
 
... ... label {
125 128 border: 1px solid #cccccc; border: 1px solid #cccccc;
126 129 } }
127 130
128 .repo_title {
129 font-size: 15pt;
130 font-weight: bold;
131 color: red;
132 line-height: 150%;
133 }
134 .repo_title a {
135 text-decoration: none;
136 color: #777777;
137 }
138
139 .repo_desc {
140 font-size: 9pt;
141 color: #888888;
142 }
143
144 131 .blob_title { .blob_title {
145 132 font-size: 10pt; font-size: 10pt;
146 133 color: red; color: red;
 
... ... label {
149 136 .source { .source {
150 137 font-size: 9pt; font-size: 9pt;
151 138 line-height: 110%; line-height: 110%;
139 border: 1px solid #cccccc;
140 padding: 3px;
141 margin-top: 5px;
152 142 } }
153 143
154 144 .diff {} .diff {}
 
... ... label {
160 150 .repo_menu {} .repo_menu {}
161 151 .repo_menu ul li {} .repo_menu ul li {}
162 152
163 .repo_body {
164 float: left;
165 display: inline;
166 padding: 5px;
153 .repo_header { }
154
155 .repo_title {
156 font-size: 15pt;
157 font-weight: bold;
158 color: red;
159 }
160 .repo_title a {
161 text-decoration: none;
162 color: #777777;
167 163 } }
168 164
169 .repo_right {
170 float: right;
171 display: inline;
172 padding: 5px;
173 background-color: #e7e7e7;
165 .repo_desc {
166 font-size: 9pt;
167 color: #888888;
168 margin: 3px 0px;
174 169 } }
175 170
176 .urls { padding: 4px 20px; display: block; float: left; }
171 .repo_body { display: block; }
172
173 .urls { padding: 3px 0px; margin: 5px 0px; }
177 174 .urls ul { list-style-type: none; } .urls ul { list-style-type: none; }
178 175 .urls ul li { .urls ul li {
179 padding: 3px 13px;
176 display: inline;
180 177 border: 1px solid #cccccc; border: 1px solid #cccccc;
181 178 border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px;
182 margin: 2px;
183 font-size: 9pt;
179 font-size: 8pt;
180 padding: 3px 3px;
184 181 } }
185 182 .urls ul li a { .urls ul li a {
186 183 text-decoration: none; text-decoration: none;
187 184 color: #666666; color: #666666;
185 white-space: nowrap;
188 186 } }
File root/themes/default/repo/blob.html changed (mode: 100644) (index 6d26507..7a244b8)
1 <span class="blob_title">Blob <a href="@@url_repo@@/blob/@@obj@@">@@obj@@</a></span><br />
2 1 <br /> <br />
2 <span class="blob_title">@@path@@/@@file@@ (@@size@@ bytes)</span><br />
3 3
4 4 <div class="source"> <div class="source">
5 5 <pre> <pre>
File root/themes/default/repo/log/header.html changed (mode: 100644) (index d3b201b..92dca71)
1 1 <br /> <br />
2 <table width="100%">
2 <table>
3 3 <tr> <tr>
4 4 <th>Subject</th> <th>Subject</th>
5 5 <th>SHA-1</th> <th>SHA-1</th>
File root/themes/default/repo/main.html changed (mode: 100644) (index 266d3d6..296ceb6)
1 <div class="repo_body">
2 <div style="float: left;">
3 <span class="repo_title"><a href="@@url_user@@">@@owner@@</a>/<a href="@@url_repo@@">@@name@@</a></span><br />
4 <span class="repo_desc">@@description@@</span><br />
5 </div>
1 <div class="repo_header">
2 <div class="repo_header">
3 <div class="repo_title">
4 <a href="@@url_user@@">@@owner@@</a>/<a href="@@url_repo@@">@@name@@</a>
5 </div>
6 <div class="repo_desc">
7 @@description@@
8 </div>
6 9
7 <div class="urls">
8 <ul>
9 <li>Git: <a href="@@git@@">@@git@@</a></li>
10 <li>SSH: <a href="@@ssh@@">@@ssh@@</a></li>
11 <li>HTTP: <a href="@@git@@">@@git@@</a></li>
12 </ul>
10 <div class="urls">
11 <ul>
12 <li><a href="@@ssh@@">@@ssh@@</a></li>
13 <li><a href="@@git@@">@@git@@</a></li>
14 <li><a href="@@git@@">@@git@@</a></li>
15 </ul>
16 </div>
17
18 <div>
19 @@branches_and_tags@@
20 </div>
13 21 </div> </div>
14 22
15 23 <div class="menu repo_menu" style="clear: both;"> <div class="menu repo_menu" style="clear: both;">
16 <div class="menu">
17 24 <ul> <ul>
18 25 <li><a href="@@url_repo@@/source">Source</a></li> <li><a href="@@url_repo@@/source">Source</a></li>
19 26 <li><a href="@@url_repo@@/mrs">Merge requests</a></li> <li><a href="@@url_repo@@/mrs">Merge requests</a></li>
20 27 <li><a href="@@url_repo@@/issues">Issues</a></li> <li><a href="@@url_repo@@/issues">Issues</a></li>
21 28 @@if(@@can_admin@@){{<li><a href="@@url_repo@@/admin">Admin</a></li>}}{{}} @@if(@@can_admin@@){{<li><a href="@@url_repo@@/admin">Admin</a></li>}}{{}}
22 29 </ul> </ul>
23 </div>
24 30 </div> </div>
25
26 @@repo_body@@
27 31 </div> </div>
28 32
29 33 <div class="repo_right"> <div class="repo_right">
30 34 @@repo_right@@ @@repo_right@@
35 </div>
31 36
32 Max commit size: @@max_commit_size@@<br />
33 Maximum number of users: @@max_users@@<br />
34 Default rights: @@default_rights@@<br />
35 Maximum commit size: @@max_commit_size@@<br />
37 <div class="repo_body">
38 @@repo_body@@
36 39 </div> </div>
40
File root/themes/default/repo/source_r.html changed (mode: 100644) (index 29bbd29..0bc7fef)
1 1 <!-- Right part when we are on "source" --> <!-- Right part when we are on "source" -->
2
3 @@branch@@
4
5 @@tag@@
File root/themes/default/repo/tree/line.html changed (mode: 100644) (index 72caf71..06063f1)
3 3 <td>@@type@@</td> <td>@@type@@</td>
4 4 <td>@@size@@</td> <td>@@size@@</td>
5 5 <td>@@ref@@</td> <td>@@ref@@</td>
6 <td><a href="@@url_repo@@/source/tree@@ref_url@@/@@type@@/@@file@@">@@file@@</a></td>
6 <td><a href="@@url_repo@@/source/tree@@ref_url@@/@@type@@@@path@@/@@file@@">@@file@@</a></td>
7 7 </tr> </tr>
File samples/config.php changed (mode: 100644) (index 197135b..790e5ad)
... ... $rg_theme = "default";
64 64 // Default language // Default language
65 65 $rg_lang = "en"; $rg_lang = "en";
66 66
67 // SSH port
68 $rg_ssh_port = 22;
69
70 // Git port
71 $rg_git_port = 9418;
72
67 73 ?> ?>
File scripts/cron.php changed (mode: 100644) (index fbcbf65..0c6efbe)
... ... if (date("H") == 23) {
115 115 //TODO: rg_log("Delete repositories..."); //TODO: rg_log("Delete repositories...");
116 116 } }
117 117
118 // This has to be the last thing that touches the database
119 if (date("H") == 3) {
120 rg_log("Run ANALYZE on database...");
121 $sql = "ANALYZE";
122 $res = rg_sql_query($db, $sql);
123 rg_sql_free_result($res);
124 }
125
126 118 rg_log("Done!"); rg_log("Done!");
127 119 ?> ?>
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