Git Product home page Git Product logo

Comments (5)

colluca avatar colluca commented on August 21, 2024

Further when trying to create a patch with bender vendor patch, after staging an untracked file (Makefile in this example), it fails with the following error:

error: Could not apply staged changes on top of patched upstream repository. Did you commit all previously patched modifications? Git command (Command { std: cd "/tmp/.tmpNv0osW" && "git" "apply" "--directory" "" "-p1" "/tmp/.tmp0UG66v/staged.diff", kill_on_drop: false }) in directory "/tmp/.tmpNv0osW" failed with exit code 1:

error: Makefile: already exists in working directory

from bender.

colluca avatar colluca commented on August 21, 2024

I tried to circumvent the previous error by creating a patch with the following command, executed in the vendored target_dir:

git format-patch --relative -o <relative_path_to_patch_dir> HEAD^1

However, when running bender vendor init it fails with the following error:

     Cloning musl (https://github.com/kraj/musl.git)
     Copying musl files from upstream
    Patching musl with 0001-musl-Patch-to-adapt-to-Snitch.patch
error: Failed to apply patch "/scratch/colluca/workspace/CLSPLIT/snitch_cluster/sw/deps/patches/musl/0001-musl-Patch-to-adapt-to-Snitch.patch". Git command (Command { std: cd "/tmp/.tmppMR4Uf" && "git" "apply" "--directory" "" "-p1" "/scratch/colluca/workspace/CLSPLIT/snitch_cluster/sw/deps/patches/musl/0001-musl-Patch-to-adapt-to-Snitch.patch", kill_on_drop: false }) in directory "/tmp/.tmppMR4Uf" failed with exit code 1:

error: Makefile: already exists in working directory

At this point I believe this is a bug, as there doesn't seem to be a way to use bender vendor for dependencies which need to be extended with additional files.

from bender.

micprog avatar micprog commented on August 21, 2024

To properly circumvent this issue, you may need to first commit the cloned files (before doing modifications). Alternatively, you should be able to use the --plain flag to generate a patch based on a simple diff.

from bender.

colluca avatar colluca commented on August 21, 2024

I did commit the cloned files before doing the modifications. And I tried the --plain flag, with which the command at least doesn't fail. But it still fails to include the untracked files to the patch (even if they are staged). And I believe this is a problem because rerunning bender vendor init, would then delete these files.

from bender.

colluca avatar colluca commented on August 21, 2024

The issue is solved by adding the untracked files to the include_from_upstream attribute in the Bender.yml file.

The problem was due to a misunderstanding of the patch creation and application process. Patches are applied to the upstream dependency. When creating a new file (not in the include_from_upstream list) with the same name as a file which exists upstream, a conflict occurs, expectedly leading to the observed error:

error: Makefile: already exists in working directory

The remote sources are vendored-in after patch application on the remote. Only files listed in include_from_upstream are copied locally. Therefore, if you create a new file as part of a patch, you should also list this under include_from_upstream.

from bender.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.