git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Bug with branches/merges in submodules

From
MDMel Dafert <mel@dafert.at>
Date
Jul 7, 2021, 13:13 UTC
Message-ID
<E9E32A45-DA88-47CB-B7F9-F01F9BEC394C@dafert.at>

Hello, I ran into a bug where commits are omitted from `git submodule summary` and friends when the submodule contains merge commits. Originally using 2.30.2, I can also reproduce this with a fresh build on the `next` branch (see attached bugreport). I would assume that this is not intentional, however I cannot find any relevant information on this. Feel free to contact me for extra details. Best regards, Mel

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue) Set up a submodule that has branches/merge commits: ```bash # create repository "child" mkdir child-repo cd child-repo git init touch initial.txt git add initial.txt git commit -m "initial child" cd .. # create repository "parent" mkdir parent cd parent git init # add submodule "child" to repository "parent" git submodule add ../child-repo/ child git commit -am "initial parent" cd child # make two commits in separate branches in "child" git switch -c "secondary" touch s1.txt git add s1.txt git commit -m "s1" git switch master touch m1.txt git add m1.txt git commit -m "m1" # merge branch "secondary" into "master" in "child" - this creates a merge commit git merge secondary --no-edit cd .. ``` Run `git diff --submodule=log` inside the "parent" repository.

What did you expect to happen? (Expected behavior) `git diff --submodule=log` should show all three commits added to the "child" submodule: ``` Submodule child XXXXXXX..YYYYYYY

> Merge branch 'secondary'
> m1
> s1
```

What happened instead? (Actual behavior) `git diff --submodule=log` only shows commits from one ancestor of the merge commit: ``` Submodule child XXXXXXX..YYYYYYY

> Merge branch 'secondary'
> m1
```

What's different between what you expected and what actually happened? All the commits added to the "secondary" branch are missing in `git diff --submodule=log`.

Anything else you want to add: The commit range shown by `git diff --submodule=log` is correct: `cd child; git log XXXXXXX..YYYYYYY` shows the correct list of commits.

This bug also affects `git submodule summary`, and `git show --submodule=log` after the changes have been committed.

[System Info] git version: git version 2.32.0.262.g8c582fcd64 cpu: x86_64 built from commit: 8c582fcd643d12802e0a6d7e307890aa5b6b26e1 sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.11.0-22-generic #23-Ubuntu SMP Thu Jun 17 00:34:23 UTC 2021 x86_64 compiler info: gnuc: 10.3 libc info: glibc: 2.33 $SHELL (typically, interactive shell): /bin/bash

[Enabled Hooks]
Next: Philippe Blain
Message 1 of 4 in “Bug with branches/merges in submodules”
  1. Mel DafertJul 7, 2021
  2. Philippe BlainJul 9, 2021
  3. Mel DafertJul 14, 2021
  4. Philippe BlainJul 14, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.