dfetch-org / dfetch

Dependency fetcher
https://dfetch.rtfd.io/
MIT License
11 stars 4 forks source link

Non destructive file update in root and sub directories #616

Open deminngi opened 4 months ago

deminngi commented 4 months ago

When using dfetch update I would like to update a single file or a set of files in a cloned local project root or subdirectory, without deleting the entire content in it, because I would like to preserve some artefacts that were built before.

That means I would like something like:

projects:
  - name: get-scripts-into-root
    repo-path: git.dev/demo.git
    src: '*.sh'
    dst: /
  - name: get-scripts-into-sub
    repo-path: git.dev/demo.git
    src: '*.sh*'
    dst: /sub

I understand that dst accepts only directories, but an update flag may solve my problem.

For example:

dfetch update --non-destructive

The above flag would works for:

deminngi commented 3 months ago

Any news for this topic?

spoorcc commented 3 months ago

Hi Giovanni,

Thanks for your request, sorry for the late reply. I'm on holiday currently.

One of the biggest challenges I see is the case where a file is removed in the source project, and the manifest uses a wildcard for the src. How would dfetch "know" the file is removed.

I considered also adding a file listing to the dfetch_data file to track the exact files. But this may explode for larger projects.

But maybe, I could do this specifically for non-destructive case.

This also sounds like the template feature request. Would #334 also solve your case?