Unintuitive behaviour of submodule compare link
(Creating a seperate issue for this issue.
MR !37740 (merged) has introduced this link to quickly compare changes introduced by a submodule update.
This works fine in the most common case when a submodule is updated to a commit that is a direct child of the previous commit.
But if the new commit is in a different branch or a rollback, the compare view does not show all changes between the two commits. The diff that is shown in repo/-/compare/oldcommitsha...newcommitsha is the same that would be shown by git diff oldcommitsha...newcommitsha. But from the view of the parent repository, git diff oldcommitsha..newcommitsha would be of more interest.
Unfortunately, the second type of git diff is not available as a gitlab page (or am I missing something). And if it would be available, it would not show commits, only the diff. That is probably the reason why this kind of diff view is not available in the first place.
this is what repo/-/compare shows if the new ref is 'newer'
➜ src git:(master) git diff ac5cacd1be252d3cb680e51274a1901a9c5d783f...359a4e7e19064b150f9db8d085add7c38a3a4452 | cat
diff --git a/sub.c b/sub.c
index 8782b7f..4643d7a 100644
--- a/sub.c
+++ b/sub.c
@@ -1,3 +1,4 @@
// hi
-
+// hoii
// hello world
+// hello cat
but repo/-/compare shows nothing if the new ref is 'older' (a rollback):
➜ src git:(master) git diff 359a4e7e19064b150f9db8d085add7c38a3a4452...ac5cacd1be252d3cb680e51274a1901a9c5d783f | cat
this is what we should show instead (notice .. instead of ...)
going forward
➜ src git:(master) git diff ac5cacd1be252d3cb680e51274a1901a9c5d783f..359a4e7e19064b150f9db8d085add7c38a3a4452 | cat
diff --git a/sub.c b/sub.c
index 8782b7f..4643d7a 100644
--- a/sub.c
+++ b/sub.c
@@ -1,3 +1,4 @@
// hi
-
+// hoii
// hello world
+// hello cat
rolling back
➜ src git:(master) git diff 359a4e7e19064b150f9db8d085add7c38a3a4452..ac5cacd1be252d3cb680e51274a1901a9c5d783f | cat
diff --git a/sub.c b/sub.c
index 4643d7a..8782b7f 100644
--- a/sub.c
+++ b/sub.c
@@ -1,4 +1,3 @@
// hi
-// hoii
+
// hello world
-// hello cat
