-
Notifications
You must be signed in to change notification settings - Fork 365
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
Git submodule gets deleted and cannot be restored #5246
Comments
Ok, I thought I figured out a workaround but it seems to be more subtle than that
I then created an empty commit using git
I then squashed that commit down onto
Finally, I abandoned the extra commit that got added for some reason I don't understand
And now, things work as expected
The weird thing though is that now my reproducer doesn't reproduce the issue anymore, I can hop between And the diff for
|
One more update: That workaround didn't work right away in my real world repo, to make it work I had to |
And another case of the same or a similar bug: Cloning https://gitlab.com/spade-lang/spade/ then Edit: I wonder if this is related to submodules in directories. This works as expected touch file \
&& git add file \
&& git commit -m "init" \
&& git submodule add [email protected]:jj-vcs/jj.git \
&& git commit -m "Add submodule" \
&& jj git init --colocate While this results in a stuck submodule touch file \
&& git add file \
&& git commit -m "init" \
&& mkdir dir \
&& cd dir \
&& git submodule add [email protected]:jj-vcs/jj.git \
&& git commit -m "Add submodule"
&& cd .. \
&& jj git init --colocate
` |
I don't follow the other comments, but in the original steps to reproduce:
At this point, unmanaged It's not fancy, but that's the current state of submodule support. Submodule contents aren't managed by |
Yep you're right, The followup comments are as far as I can tell an actual bug though. As soon as I co-locate a repo with a submodule in a subdirectory with
I end up with a deleted I've been trying to investigate this issue to see if I can solve it and I think I've at least discovered a potential cause. Skipping a bunch of debugging steps I did before getting here, I noticed that in
This seems to come down to if let Some(new_file_state) = metadata.as_ref().and_then(file_state) { it gets |
It works for me, but maybe you disabled snapshot.auto-track? Appears that the "ignored directory" code path doesn't have a workaround for submodule dirs. |
Hmm, yes I did disable auto-track. It still seems like there is a bug in here but re-enabling auto-track does seem like a good workaround |
Yes, it's a bug of |
Description
I'm not sure if this is the same problem as #5013 manifesting in a different way, or if this is another issue.
I don't fully understand under what cases this problem occurs, but it sometimes I end up in states where a git submodule is shown as deleted by
jj
, and at that point it seems impossible to restore.Steps to Reproduce the Problem
I have seen 2 ways to reproduce it. First, it seems like if you switch over to a commit that doesn't have a submodule, then go back to one that has it, it is untracked.
Set up a repo with a submodule
Colocate a jj repo
JJ status shows everything is fine
and log
Creating a new commit on top of the initial commit shows some warnings
So far, everything is fine (Though maybe that conflicting changes warning is relevant here 🤔)
Now, switching back to a commit that has the problem
We still get a warning but everything seems fine, But now jj status shows the submodule as deleted
even though the content is there
Some things I have tried to get the
jj restore
does not do anythingThe diff command it suggests shows the submodule as deleted,
restore --from
as it suggests also does not workgit status
is emptyRemoving the submodule and then re-adding it similarly does not resolve the problem
Expected Behavior
Ideally, the submodule shouldn't get deleted, and if it does there should be a way to restore it
Actual Behavior
The submodule cannot get restored
Specifications
The text was updated successfully, but these errors were encountered: