From cfafdbfde47e8e6b7916fdee7ea93fc598bc4ecf Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Fri, 27 Feb 2009 13:38:22 +0100 Subject: [PATCH] Fixed issues 137 and 138, support of the git submodules. --- src/IDF/Scm/Git.php | 33 +++++++++++++++++++++ src/IDF/templates/idf/source/git/tree.html | 6 +++- www/media/idf/img/extern.png | Bin 0 -> 660 bytes 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 www/media/idf/img/extern.png diff --git a/src/IDF/Scm/Git.php b/src/IDF/Scm/Git.php index 33c24d4..58ab1f8 100644 --- a/src/IDF/Scm/Git.php +++ b/src/IDF/Scm/Git.php @@ -165,6 +165,10 @@ class IDF_Scm_Git $file->author = 'Unknown'; } $file->fullpath = ($folder) ? $folder.'/'.$file->file : $file->file; + if ($file->type == 'commit') { + // We have a submodule + $file = $this->getSubmodule($file, $commit); + } $res[] = $file; } return $res; @@ -418,4 +422,33 @@ class IDF_Scm_Git escapeshellarg($commit)); } + /* + * ===================================================== + * Specific Git Commands + * ===================================================== + */ + + /** + * Get submodule details. + * + * Given a "commit" file in the tree, find the submodule details. + * + * @param stdClass File description of the module + * @param string Current commit + * @return stdClass File description + */ + public function getSubmodule($file, $commit) + { + $file->type = 'extern'; + $info = $this->getFileInfo('.gitmodules', $commit); + if ($info == false) { + return $file; + } + $gitmodules = $this->getBlob($info); + if (preg_match('#\[submodule\s+\"'.$file->fullpath.'\"\]\s+path\s=\s(\S+)\s+url\s=\s(\S+)#mi', $gitmodules, $matches)) { + $file->extern = $matches[2]; + } + return $file; + } + } \ No newline at end of file diff --git a/src/IDF/templates/idf/source/git/tree.html b/src/IDF/templates/idf/source/git/tree.html index 8de19e9..3bcbcd3 100644 --- a/src/IDF/templates/idf/source/git/tree.html +++ b/src/IDF/templates/idf/source/git/tree.html @@ -31,13 +31,17 @@ {aurl 'url', 'IDF_Views_Source::tree', array($project.shortname, $commit, $file.fullpath)} {$file.type} -{$file.file} +{if $file.type != 'extern'} +{$file.file}{else}{$file.file}{/if} {if $file.type == 'blob'} {if isset($file.date) and $file.log != '----'} {$file.date|dateago:"wihtout"} {$file.author|strip_tags|trim}{trans ':'} {issuetext $file.log, $request, true, false} {else}{/if} {$file.size|size}{/if} +{if $file.type == 'extern'} +{$file.extern} +{/if} {/foreach} diff --git a/www/media/idf/img/extern.png b/www/media/idf/img/extern.png new file mode 100644 index 0000000000000000000000000000000000000000..c8aa43c247feb1b6f69e053f84df360b461d6225 GIT binary patch literal 660 zcmV;F0&D$=P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iXD} z3;-A&O9hJn00IU6jZ$xQG@Rq_rA{7J^~5$U;=gnMQj}?>+B0@3xp}CS(Te z+g$k0;X6OhxuWBQ|5{B=&2=_ON|}Dw<=LSpBabK`apBT=)!TDAZ_&0b28SMF7)EDs zEHqj$!0$WG+=sbBLztX;z1g}G91C3rZ~^FgDU}sf1p|D?{OM^zAcP<^9_$0s0a8jV z%jDJj1hdgnwxn_&EoXdcTZ#QCOE4QP<=&OU*fN!CR0@R1n^96+#Kl`L8(jdFWdiVR z)nceZJJ(GOxyC5{pxG*F;2wT5aB0Ge&v=z4ziuJ|GP^Z@0$3s=gbd!dPHBa$Y| zNHa|{OR!m=my^Ukjv}OiTXUFShQ_&W>dKPYp6m|tDdm8-xu4xHTC!ei&p3?i!R(mN z1r#DMZD8Rctw#enGd@FW=Tjoj8rawHJV)Tx92B6GLI{DA+CU}&PZNB(4aHvAFhItj zY*&Wl2-;tQ`igbp3CU92Vlig1xGGt!J4YlO2G34#SAkwn>}L|R5+Wl$0*Qe%!T0D2 z&HLM#`MQ=ll|m_atDU6176?Dc?VzoVchg}8otxNe3&Y~TsT)(KyY}E#KHz