Skip to content

Problems with Applying and reverting patches  #67

@furqan-ahmed

Description

@furqan-ahmed

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.

Activity

alexandresalome

alexandresalome commented on Aug 4, 2014

@alexandresalome
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alexandresalome@furqan-ahmed

        Issue actions

          Problems with Applying and reverting patches · Issue #67 · gitonomy/gitlib