array(" echo -n `ls -l $2|cut -f 5 -d ' '`, echo `ls -l $1|cut -f 5 -d ' '`")," cat $1 >> $2 EOF * then put what "find" outputs into the $d array below */ /* git stuff: * init a git thing: git init * add files to it: git add * * first commit: git commit * copy repo: git clone --bare /path/to/repo * you can remove branches, hooks, maybe others * then you can use this as a master git repo * when done: git update-server-info * to be run after a commit/push, before putting all back to free.fr * run the "find" stuff, modify the php file, put the php and data files * to the server, done. */ /* obviously, you can remove all those useless comments in production... */ function err() { $protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'); header($protocol . ' 404 Not Found'); $GLOBALS['http_response_code'] = 404; exit(); } if (!isset($_SERVER) || !isset($_SERVER['REQUEST_URI'])) err(); $u = $_SERVER['REQUEST_URI']; $u = strtok($u, '?'); $d = array( "/test2-git/test.git/HEAD"=>array(1600,23), "/test2-git/test.git/config"=>array(1623,66), "/test2-git/test.git/objects/6b/7531ef13d13d4ec06bdd79094e10543afd6f25"=>array(1689,153), "/test2-git/test.git/objects/69/b7b6c75a5737b46c3b90694e15be80846d5671"=>array(1842,82), "/test2-git/test.git/objects/bc/f7e4ce88361d3191f4286e1e115e61b9c6bc46"=>array(1924,22), "/test2-git/test.git/objects/a0/bbb647f93c8abbf2e9697b65072dc088c184f2"=>array(1946,78), "/test2-git/test.git/objects/22/cdbb9f7e76404b23a6948428afd643799ea0c4"=>array(2024,28), "/test2-git/test.git/objects/44/2bb5baa6b7ac8bc4551b57206a98915e6cedc0"=>array(2052,46), "/test2-git/test.git/objects/a7/6c01b2eb0ac400d3a505f8740715008d960df8"=>array(2098,51), "/test2-git/test.git/objects/f2/02246f34750a339d6443ac55a716332fcd69d0"=>array(2149,51), "/test2-git/test.git/objects/d5/efbdda18c275cce018de620022193e9927c140"=>array(2200,118), "/test2-git/test.git/objects/info/packs"=>array(2318,1), "/test2-git/test.git/objects/fa/555a4d38f0407e4b97f7a65ef42f0695a55d78"=>array(2319,34), "/test2-git/test.git/objects/f7/dd1ed0ea791873917afd6828870f614a9b2e7b"=>array(2353,159), "/test2-git/test.git/objects/83/6d1e3f81e3cf21e950108f58616c307191067e"=>array(2512,78), "/test2-git/test.git/objects/de/7dd6e7bbddea9609b9dfe8cf82c598551d398a"=>array(2590,153), "/test2-git/test.git/objects/b5/0d269c86b61aac4a004a849493ab5649e56dc4"=>array(2743,51), "/test2-git/test.git/objects/29/8b1e6b9377b4b1c00935b43eedd3106f5214a1"=>array(2794,154), "/test2-git/test.git/objects/03/4427d724a30d1c1e2a1d664b88dd9b5981a226"=>array(2948,152), "/test2-git/test.git/info/refs"=>array(3100,59), "/test2-git/test.git/refs/heads/master"=>array(3159,41), ); if (!isset($d[$u])) err(); header("Content-Type: application/octet-stream"); header("Content-Length: " . $d[$u][1]); $f = fopen("test.git.data", "r"); fseek($f, $d[$u][0]); $len = $d[$u][1]; while ($len >= 4096) { echo fread($f, 4096); $len -= 4096; } if ($len) echo fread($f, $len); fclose($f); ?>