Skip to content

Commit bcdd79a

Browse files
committed
rn-124: add stash and submodule article
1 parent 632c8b6 commit bcdd79a

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

rev_news/drafts/edition-124.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,62 @@ This edition covers what happened during the months of May 2025 and June 2025.
2525
### Reviews
2626
-->
2727

28-
<!---
2928
### Support
30-
-->
29+
30+
* [[BUG] git stash incorrectly showing submodule branch instead of superproject branch](https://lore.kernel.org/git/TO1PPF29324B4CE6D3518208073452C3C51CD97A@TO1PPF29324B4CE.CANPRD01.PROD.OUTLOOK.COM/)
31+
32+
Stuart MacDonald sent a bug report to the mailing list. The report
33+
described a workflow where people worked on a UI project that
34+
included a hardware SDK as a submodule. Both the UI project (the
35+
"superproject") and the SDK project (the submodule) had their own
36+
branches.
37+
38+
When using `git stash` on a bug fix branch on the superproject,
39+
while the submodule was on a feature branch, it appeared that the
40+
command `git stash list` output a message, like:
41+
42+
`stash@{0}: On feature_sdk_foo: debugging`
43+
44+
indicating the stash had been created on the submodule's branch
45+
instead of the superproject's branch. The branch `feature_sdk_foo`
46+
didn't even exist in the superproject.
47+
48+
Stuart mentioned he thought this used to work correctly around 2021,
49+
though he wasn't 100% certain.
50+
51+
K Jayatheerth replied to Stuart confirming the bug happened on
52+
different OSes, showing minimal steps to reproduce it, and saying it
53+
was "one of the most interesting Git bugs" he had seen in a while.
54+
55+
Jayatheerth came back later with
56+
[a patch](https://lore.kernel.org/git/[email protected]/)
57+
that fixed the bug. It appeared that the branch name was obtained
58+
via the `refs_resolve_ref_unsafe()` function, which returns a
59+
pointer to a static buffer, but that static buffer was overwritten.
60+
To fix this, the patch copied the branch name instead of pointing to
61+
the static buffer.
62+
63+
Stuart thanked Jayatheerth even though he couldn't rebuild Git with
64+
the patch.
65+
66+
Junio Hamano, the Git maintainer, replied to the patch with small
67+
suggestions, while Eric Sunshine noted that the change should also
68+
be accompanied by a new test.
69+
70+
Jayatheerth replied to Eric and Junio saying he would fix the small
71+
issues and add tests, which he later did in
72+
[an updated patch](https://lore.kernel.org/git/[email protected]/).
73+
74+
René Scharfe reviewed the updated patch and suggested a number of
75+
improvements to the code and the test.
76+
77+
Jayatheerth then sent
78+
[a v2 of his patch](https://lore.kernel.org/git/[email protected]/)
79+
which addressed René's comments. Junio reviewed it and suggested
80+
further improvements.
81+
82+
[The v3 patch from Jayatheerth](https://lore.kernel.org/git/[email protected]/)
83+
addressed Junio's comment and was merged.
3184

3285
## Community Spotlight: Luca Milanesio
3386

0 commit comments

Comments
 (0)