How to get an array of changed files?
There is the method hasChanges() which returns true, if there are any changed files. But I don't see a method which returns what files have been changed. Am I overlooking something?
Hello, you are right, there is no method which returns what files have been changed. Can you send PR?
Yes. I think about the implementation details. We get filenames and a letter determine the type of status for any file (new file, modified file, deleted file) from git status command line. example given "M myfile.php" would mean, the already added file myfile.php was changed.
So it makes sense to make getChanges() to return an associative array of filename => Type of status. Additionally we should have constants for the file status type GIT_FILE_STATUS_NEW GIT_FILE_STATUS_CHANGED GIT_FILE_STATUS_DELETED
Do you confirm with that?
I implemented a getChanges Method.
https://github.com/czproject/git-php/pull/42
Unfortunately i wasn't able to get the tests running on my Windoze machine. But I verified it's function with a simple php script. Which just calls getChanges() on a repository and shows the output. You have to extend your tests by yourself.
C:\Users\deruli\Documents\GitHub\git-php>php test.php
array(1) {
["src/GitRepository.php"]=>
string(1) "M"
}