Use git's "find copies harder" algorithm to - well - find copies in changesets

and render them as such.
release-1.3
Thomas Keller 2012-07-11 00:17:23 +02:00
parent d17098e703
commit 22c1f92b2b
2 changed files with 7 additions and 2 deletions

View File

@ -29,6 +29,8 @@ or newer to run properly!
been copied. This has been changed insofar that now all properties except 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. 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 # InDefero 1.3.2 - Wed May 09 20:05 2012 UTC
## Bugfixes ## Bugfixes

View File

@ -52,11 +52,11 @@ class IDF_Scm_Git extends IDF_Scm
* A doc/Guide utilisateur/images/ftp-nautilus.png * A doc/Guide utilisateur/images/ftp-nautilus.png
* M doc/Guide utilisateur/textes/log_boot_PEGASE.txt * 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) 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($this->repo),
escapeshellarg($commit)); escapeshellarg($commit));
$out = array(); $out = array();
@ -89,6 +89,9 @@ class IDF_Scm_Git extends IDF_Scm
} else if ($action == 'R') { } else if ($action == 'R') {
$matches = preg_split("/\t/", $line); $matches = preg_split("/\t/", $line);
$return->renames[$matches[1]] = $matches[2]; $return->renames[$matches[1]] = $matches[2];
} else if ($action == 'C') {
$matches = preg_split("/\t/", $line);
$return->copies[$matches[1]] = $matches[2];
} }
} }
} }