File: comment_1_571703fc4e1e2f4e34f54db7a7da7080._comment

package info (click to toggle)
git-annex 10.20250416-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 73,572 kB
  • sloc: haskell: 90,656; javascript: 9,103; sh: 1,469; makefile: 211; perl: 137; ansic: 44
file content (31 lines) | stat: -rw-r--r-- 1,477 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[[!comment format=mdwn
 username="joey"
 subject="""comment 1"""
 date="2023-04-20T17:51:01Z"
 content="""
Notice that your script is doing something a bit unusual. You check out a
branch, add the submodule in that branch, and then check out the original
branch, which is before the submodule was added.

So, git needs to delete the submodule. Deleting the submodule is
mentioned in [[submodules]] as a particular case where git-annex's hack to
support submodules does not work very well.

If that's all this bug is about, its description is over-broad. 
It doesn't seem to prevent using submodules with git-annex in situations
where you are not deleting a submodule, but are updating submodules

Yes, `git checkout main --recurse-submodules` will fail in those
situations, but the workaround in [this comment](https://git-annex.branchable.com/submodules/#comment-0d7c31e3f08e803bf9b13ab0568fedcc)
of using `git checkout main && git submodule update` will work.

And yes, I've verified that does still work, with git 2.40.0.
I modified the test case to add the submodule before checking out
the branch, then add `sub_file2.txt`, and commit that to the branch.
At that point,  `git checkout main && git submodule update` worked fine.

So, nothing changed in git, and git-annex's approach for submodules does
broadly work, except git has issues deleting submodules that have a .git
directory in them. The solution is to `rm -rf` the submodule after
running `git checkout`.
"""]]