Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Applying and reverting patches #67

Open
furqan-ahmed opened this issue Aug 2, 2014 · 1 comment
Open

Problems with Applying and reverting patches #67

furqan-ahmed opened this issue Aug 2, 2014 · 1 comment

Comments

@furqan-ahmed
Copy link

Hi,
My name is Furqan Ahmed and I am using gitonomy to manipulate git commands through php. All other things went fine while using gitonomy except I am stuck with applying and reverting patch. As there is no direct function in the library to apply and revert a patch so I am using run in repository.php file to run the commands. Following are the commands that I am using to apply and revert a patch file.

Applying a patch file
$repository = new Repository('../../../furqan-repositories/test-repository/remote-repository');
$patch = PATCH_FILES_FOLDER_PATH.'latest.patch';

    $otpt = $repository->run( 'apply', array( '../../../furqan-repositories/local-repository/patches/first_ever_patch.patch' ) );

Reverting a patch file

$repository = new Repository("c:/furqan-repositories/test-repository/remote-repository");
$otpt = $repository->run( 'apply', array( '-R', 'c:/furqan-repositories/local-repository/patches/first_ever_patch.patch' ) );

I am using the above code to apply and revert patches but the following exception is appearing :

Error while running git command:
"C:\Program Files (x86)\Git\bin\git.exe" "--git-dir" "C:\furqan-repositories\test-repository\remote-repository/.git" "--work-tree" "C:\furqan-repositories\test-repository\remote-repository" "apply" "../../../furqan-repositories/local-repository/patches/first_ever_patch.patch"

error: hello.txt: No such file or directory

The file that has been changed i.e., hello.txt could not be found. However through git bash I can easily apply and revert patches. Can any body please help me out with this issue.

Thanks and Regards,
Furqan Ahmed.

@alexandresalome
Copy link
Member

Try providing it an absolute path, because he's not running from working dir the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants