sisong / HDiffPatch

a C\C++ library and command-line tools for Diff & Patch between binary files or directories(folder); cross-platform; runs fast; create small delta/differential; support large files and limit memory requires when diff & patch.
Other
1.52k stars 280 forks source link

Is there a way to patch old directory without making new temporary one. #356

Closed BeastBurst closed 1 year ago

BeastBurst commented 1 year ago

I have a very big old dir that I have created patch file for it. However all the time when patching it creates new tmp dir than it removes the old and renames the new tmp dir to match the name of the old dir.

Is there a way to patch directly the old dir without creating new tmp directory and the follow up procedures of deletion and renaming ?

sisong commented 1 year ago

patch to same dir, have 2 step (see tempDirPatchListener):

  1. step: patch all modified & added files to tmp dir; (slow & revocable&safe process)
  2. step: merge tmp dir to old dir; (fast & irrevocable process)

If you don't want a tmp dir for save disk space, you can creating multiple diffFiles and customizing the patch process by yourself.

BeastBurst commented 1 year ago

What does that mean "If you don't want a tmp dir for save disk space, you can creating multiple diffFiles and customizing the patch process by yourself." ?

I have to create a patchfile for every file that was changed in the dir ?

If so I have a question. Does patching a file create new tmp file or it directly patches the old file ?

sisong commented 1 year ago

Always patch to a new file, hdiffpatch does not support in-place update now.