Skip to content

Edit patch #883

@spoorcc

Description

@spoorcc

Related to #614

Sometimes it would be nice to edit the patch, currently this is documented but a little involved.

Updating the patch

If you have further changes to a project with a patch, you can update the patch by first reversing the patch, using
apply and with the --directory argument as shown above. To reverse the patch you also require the -R.
This will return the project to the state before the patch was applied. You can then stage the project and re-apply
the patch to the project to have an editable patch.

   # First apply the reverse patch
   git apply --verbose --directory='some-project' -R some-project.patch

   # Stage the project in its unpatched state
   git add some-project

   # Re-apply the patch
   git apply --verbose --directory='some-project' some-project.patch

Now you can make further changes to the project, and re-generate the patch using the raw git command as shown below.

   # Generate the patch from the directory again
   cd some-project
   git diff --relative --binary --no-ext-diff --no-color . > ../some-project.patch

   # Force a fetch and update the patch to test your changes
   dfetch update -f some-project

Proposal

Add a new dfetch edit-patch <project> command.
It should check if a project has a patch and then perform above steps to make patch editable.

Also extend dfetch diff to have a output file path and that it can diff regularly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions