首页 > 解决方案 > How can I find where a git submodule was removed?

问题描述

Our project got a submodule fiosdk_kotlin added and now the most recent merge removed it but I can't find why its removal would be considered by git as a "trivial merge" as git instaweb puts it which as far as I understand means the same as git show yielding no chunks.

$ git show 6de05c
commit 6de05c46fb6dd19bf0d834290de8a3c36da22da3
Merge: 2b35c1a67 323b5e121

Now to explore what happened to the submodule:

$ git diff 6de05c46f...06ef8cfec -- fiosdk_kotlin
$ git diff 06ef8cfec...6de05c46f -- fiosdk_kotlin
diff --git a/fiosdk_kotlin b/fiosdk_kotlin
deleted file mode 160000
index 698b2b41f..000000000
--- a/fiosdk_kotlin
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 698b2b41f4c7581bb4934da5d37f253d90963278

So there should be a commit somewhere on the second branch where the module was removed, right?

git log --all --full-history --patch -- .gitmodules should show me all additions or removals of submodules? It shows many commits (merge commits?) that don't show a patch at all. I can filter that down with -Sfiosdk_kotlin:

$ git log --all --full-history --patch -Sfiosdk_kotlin -- .gitmodules
commit 1d6d2af7bcfc043e8a7efb14cecbdd6a9595a1de
Author: Leo Wandersleb <leo.wandersleb@mycelium.com>
Date:   Wed Sep 16 12:35:48 2020 -0300

    add fio as git submodule
    
    remove copied folders androidfioserializationprovider and fiosdk
    fix minSdk via main build.gradle
    restore String.isFioActor() in FIOToken

diff --git a/.gitmodules b/.gitmodules
index d001539c2..fafdcaa6f 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
 [submodule "wallet-android-modularization-tools"]
        path = wallet-android-modularization-tools
        url = git@github.com:mycelium-com/wallet-android-modularization-tools
+[submodule "fiosdk_kotlin"]
+       path = fiosdk_kotlin
+       url = https://github.com/fioprotocol/fiosdk_kotlin

What the hack? It only ever gets added, yet it's gone?

Turns out, it's still there in .gitmodules but not pinned to any revision or something??:

$ cat .gitmodules 
[submodule "wallet-android-modularization-tools"]
    path = wallet-android-modularization-tools
    url = git@github.com:mycelium-com/wallet-android-modularization-tools
[submodule "fiosdk_kotlin"]
    path = fiosdk_kotlin
    url = https://github.com/fioprotocol/fiosdk_kotlin
$ git submodule 
 de7973e0781a8f6245b345999b6d2b7c6c45be6b wallet-android-modularization-tools (remotes/origin/api29submodule)

So as I don't get revisions to show in git log but in git diff, I tried this:

$ for h in $( git log --all --full-history --pretty=format:%h 1d6d2a~1..master ); do git show --oneline --patch $h -- fiosdk_kotlin | cat ; done
362bf3885 update ndk and cmake versions
diff --git a/fiosdk_kotlin b/fiosdk_kotlin
index a8ab9eaec..698b2b41f 160000
--- a/fiosdk_kotlin
+++ b/fiosdk_kotlin
@@ -1 +1 @@
-Subproject commit a8ab9eaec553bfc8fe986a390d89fc459eebc26c
+Subproject commit 698b2b41f4c7581bb4934da5d37f253d90963278
5b684defc Update fiosdk_kotlin
diff --git a/fiosdk_kotlin b/fiosdk_kotlin
index a8ab9eaec..d643a8db5 160000
--- a/fiosdk_kotlin
+++ b/fiosdk_kotlin
@@ -1 +1 @@
-Subproject commit a8ab9eaec553bfc8fe986a390d89fc459eebc26c
+Subproject commit d643a8db507394840ecffb7915d9af0228f45442
4a2a7f343 merge with fio branch
diff --git a/fiosdk_kotlin b/fiosdk_kotlin
index feffc134e..a8ab9eaec 160000
--- a/fiosdk_kotlin
+++ b/fiosdk_kotlin
@@ -1 +1 @@
-Subproject commit feffc134e1904331f7a5dc36b8fe125e6a8fcef1
+Subproject commit a8ab9eaec553bfc8fe986a390d89fc459eebc26c
f646016b6 fix obtRecord send
diff --git a/fiosdk_kotlin b/fiosdk_kotlin
index feffc134e..a8ab9eaec 160000
--- a/fiosdk_kotlin
+++ b/fiosdk_kotlin
@@ -1 +1 @@
-Subproject commit feffc134e1904331f7a5dc36b8fe125e6a8fcef1
+Subproject commit a8ab9eaec553bfc8fe986a390d89fc459eebc26c
405730262 update fiosdk_kotlin submodule to latest master
diff --git a/fiosdk_kotlin b/fiosdk_kotlin
index b57f30432..feffc134e 160000
--- a/fiosdk_kotlin
+++ b/fiosdk_kotlin
@@ -1 +1 @@
-Subproject commit b57f30432d6a72f3a5a75374950fe39ce9cc096e
+Subproject commit feffc134e1904331f7a5dc36b8fe125e6a8fcef1
1d6d2af7b add fio as git submodule
diff --git a/fiosdk_kotlin b/fiosdk_kotlin
new file mode 160000
index 000000000..b57f30432
--- /dev/null
+++ b/fiosdk_kotlin
@@ -0,0 +1 @@
+Subproject commit b57f30432d6a72f3a5a75374950fe39ce9cc096e

and again I see the submodule's addition but not its removal. What am I missing??

标签: gitgit-submodules

解决方案


推荐阅读