Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when applying patch that removes submodule #6779

Open
marcosdiazr opened this issue Mar 21, 2024 · 1 comment
Open

Error when applying patch that removes submodule #6779

marcosdiazr opened this issue Mar 21, 2024 · 1 comment

Comments

@marcosdiazr
Copy link

marcosdiazr commented Mar 21, 2024

Reproduction steps

on any existing repo that contains a submodule generate a diff that removes it:

$ git rm <submodule name>
$ git diff --staged > remove-submodule.patch

(I used git 2.25.1)
my generated patch looks like this:

diff --git a/.gitmodules b/.gitmodules
index 1b59123..e69de29 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +0,0 @@
-[submodule "submodule"]
-	path = submodule
-	url = ../submodule
diff --git a/submodule b/submodule
deleted file mode 160000
index xxxxx..0000000
--- a/fus-modules
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit xxxxxxxxxxxxxxxxxxxxxxxxxxx

And when running this small program that uses libgit2:
test.c.txt
built using
gcc test.c -lgit2 -L <path to libgit2>/libgit2/build/ -Wall -pedantic -I <path to libgit2>/libgit2/include/
And run like this:
LD_LIBRARY_PATH=<path to libgit2>/libgit2/build/ ./a.out <Path to repo> <path to patch file>

Expected behavior

It successfully applies the change

Actual behavior

Error applying patch: -1 no error

I checked also modifying the submodule and it fails too

Version of libgit2 (release number or SHA1)

1.3.0 and main ( d74d491 )

Operating system(s) tested

Linux (Ubuntu 20.04)

@ethomson
Copy link
Member

Thanks for this report as well, I'm glad that you're exercising the patch functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants