xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
Commit a96013c19fae04a9ec0ec3b1505825c92150c978

If git ls-tree returns nothing, the path is invalid
Author: Catalin(ux) M. BOIE
Author date (UTC): 2016-01-20 19:14
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2016-01-20 19:14
Parent(s): a71ef807917abc1adf19e2416e2d095f1d8dee7e
Signing key:
Tree: 633c04f2ba59ca206ed09b086080b9c790bc76a4
File Lines added Lines deleted
inc/git.inc.php 7 0
inc/user/repo-page.php 12 6
File inc/git.inc.php changed (mode: 100644) (index 06b0b81..fd66798)
... ... function rg_git_ls_tree($repo_path, $tree, $path)
455 455 break; break;
456 456 } }
457 457
458 $a['data'] = trim($a['data']);
459 if (empty($a['data'])) {
460 rg_git_set_error("path does not exists");
461 break;
462 }
463
458 464 $output = explode("\n", trim($a['data'])); $output = explode("\n", trim($a['data']));
459 465 $ret = array(); $ret = array();
460 466 foreach ($output as $line) { foreach ($output as $line) {
467 //rg_log('DEBUG: processing line [' . $line . ']');
461 468 $_y = array(); $_y = array();
462 469 $_t = explode("\t", $line); $_t = explode("\t", $line);
463 470 $_y['file'] = trim($_t[1]); $_y['file'] = trim($_t[1]);
File inc/user/repo-page.php changed (mode: 100644) (index 969eeef..efbcf25)
... ... if (strcmp($_subop, "history") == 0) {
160 160 $rg['path'] = "/" . $_path; $rg['path'] = "/" . $_path;
161 161 $_tree = rg_git_ls_tree($repo_path, $ref, $_path); $_tree = rg_git_ls_tree($repo_path, $ref, $_path);
162 162 if ($_tree === FALSE) { if ($_tree === FALSE) {
163 $_repo_body .= "Invalid path!";
163 $_repo_body .= rg_warning('Error: ' . rg_git_error());
164 164 } else { } else {
165 165 $blob = $_tree[0]; $blob = $_tree[0];
166 166 $_hash = $_tree[0]['ref']; $_hash = $_tree[0]['ref'];
 
... ... if (strcmp($_subop, "history") == 0) {
180 180 $rg['path'] = "/" . $_path; $rg['path'] = "/" . $_path;
181 181 $_tree = rg_git_ls_tree($repo_path, $ref, $_path); $_tree = rg_git_ls_tree($repo_path, $ref, $_path);
182 182 if ($_tree === FALSE) { if ($_tree === FALSE) {
183 $_repo_body .= "Invalid path!";
183 $_repo_body .= rg_warning('Error: ' . rg_git_error());
184 184 } else { } else {
185 185 $_hash = $_tree[0]['ref']; $_hash = $_tree[0]['ref'];
186 186 $_tree = rg_git_ls_tree($repo_path, $_hash, ""); $_tree = rg_git_ls_tree($repo_path, $_hash, "");
187 $_repo_body .= rg_template_table("repo/tree",
188 $_tree, $rg);
187 if ($_tree === FALSE)
188 $_repo_body .= rg_warning('Error: ' . rg_git_error());
189 else
190 $_repo_body .= rg_template_table("repo/tree",
191 $_tree, $rg);
189 192 } }
190 193 } else { // default is to show root tree } else { // default is to show root tree
191 194 $rg['path'] = ""; $rg['path'] = "";
192 195 $_tree = rg_git_ls_tree($repo_path, $ref, ""); $_tree = rg_git_ls_tree($repo_path, $ref, "");
193 $_repo_body .= rg_template_table("repo/tree", $_tree,
194 $rg);
196 if ($_tree === FALSE)
197 $_repo_body .= rg_warning('Error: ' . rg_git_error());
198 else
199 $_repo_body .= rg_template_table("repo/tree", $_tree,
200 $rg);
195 201 } }
196 202 } else { // show the log } else { // show the log
197 203 // TODO: improve the error report (error or empty?) // TODO: improve the error report (error or empty?)
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://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

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