Page MenuHomeWildfire Games
Paste P281

Applying patches with Arcanist that contain empty files
ActivePublic

Authored by Langbart on Jul 23 2022, 1:31 AM.
function ap {
arc patch "${@/-id/--diff}" || return 1
for f in $(git diff-index --name-only --diff-filter=d HEAD~1); do
find "$f" -type f -empty -exec rm {} \;
done
git diff --quiet || git commit --all --amend --no-edit
}

Event Timeline

Langbart created this paste.Jul 23 2022, 1:31 AM
Langbart created this object with visibility "Public (No Login Required)".
Langbart added a subscriber: lyv.Jul 23 2022, 1:38 AM
In D4735#201575, @lyv wrote:

the files are always empty and not deleted

If you are applying with patch, you can use the -E flag. I generate patches using git diff which has a slightly different format (even phab shows those files as just deleted while this revision shows the files cleared). If you are using arc patch I have no idea what to do.

What is your workflow with patch , why do you use it?
This workaround with Arcanist would just be ap D4735.

lyv added a comment.EditedJul 23 2022, 1:32 PM

I download the raw diff and apply it with patch. For most cases, it works good enough. I simply don't have arcanist installed is the main reason. Using patch is by no means a better workflow though.

Mostly arc patch gets the job done, if not I use one of @wraitii's formulae:

However, they also do not filter out empty files.

Arcanist is the best tool for me. Uploading images from the terminal is a huge time saver.

lyv added a comment.Jul 23 2022, 8:56 PM

pull0ad is convenient and probably enough for me as I rarely have to patch binary files.