From 22c1f92b2b299f6171eaada934eb5dc60fad6d1a Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Wed, 11 Jul 2012 00:17:23 +0200 Subject: [PATCH] Use git's "find copies harder" algorithm to - well - find copies in changesets and render them as such. --- NEWS.mdtext | 2 ++ src/IDF/Scm/Git.php | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS.mdtext b/NEWS.mdtext index 2545b30..dccc790 100644 --- a/NEWS.mdtext +++ b/NEWS.mdtext @@ -29,6 +29,8 @@ or newer to run properly! been copied. This has been changed insofar that now all properties except the project's URL, logo and individual SCM settings are copied by default. +- Indefero now shows detected copies in git changesets. + # InDefero 1.3.2 - Wed May 09 20:05 2012 UTC ## Bugfixes diff --git a/src/IDF/Scm/Git.php b/src/IDF/Scm/Git.php index 86b9055..e357988 100644 --- a/src/IDF/Scm/Git.php +++ b/src/IDF/Scm/Git.php @@ -52,11 +52,11 @@ class IDF_Scm_Git extends IDF_Scm * A doc/Guide utilisateur/images/ftp-nautilus.png * M doc/Guide utilisateur/textes/log_boot_PEGASE.txt * - * Status letters mean : Added (A), Deleted (D), Modified (M), Renamed (R) + * Status letters mean : Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R) */ public function getChanges($commit) { - $cmd = sprintf('GIT_DIR=%s '.Pluf::f('git_path', 'git').' show %s --name-status --pretty="format:" --diff-filter="[A|D|M|R]" -M', + $cmd = sprintf('GIT_DIR=%s '.Pluf::f('git_path', 'git').' show %s --name-status --pretty="format:" --diff-filter="[A|C|D|M|R]" -C -C', escapeshellarg($this->repo), escapeshellarg($commit)); $out = array(); @@ -89,6 +89,9 @@ class IDF_Scm_Git extends IDF_Scm } else if ($action == 'R') { $matches = preg_split("/\t/", $line); $return->renames[$matches[1]] = $matches[2]; + } else if ($action == 'C') { + $matches = preg_split("/\t/", $line); + $return->copies[$matches[1]] = $matches[2]; } } }