Error when applying patch that removes submodule
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 10.6k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
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 ( d74d491481831ddcd23575d376e56d2197e95910 )
Operating system(s) tested
Linux (Ubuntu 20.04)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached test.c.txt program and reproduce the failure using a patch that removes or modifies a submodule. Trace the patch-application path for the reported “-1 no error” result, then verify that the supplied removal patch applies successfully on Linux. The issue does not name a source file or regression test, so locating the relevant implementation and test coverage will require repository research.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, git
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100