From: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
To: smacdonald@kaimaging.com
Cc: git@vger.kernel.org
Subject: Re [BUG] git stash incorrectly showing submodule branch instead of superproject branch
Date: Mon, 12 May 2025 21:42:52 +0530 [thread overview]
Message-ID: <20250512161253.58427-1-jayatheerthkulkarni2005@gmail.com> (raw)
In-Reply-To: <TO1PPF29324B4CE6D3518208073452C3C51CD97A@TO1PPF29324B4CE.CANPRD01.PROD.OUTLOOK.COM>
Thank you for reporting the bug, Stuart.
This is genuinely one of the most interesting Git bugs I’ve seen in a while
I was able to reproduce it with the following minimal steps:
mkdir sdk && cd sdk
git init
echo "SDK file" > sdk.txt
git add sdk.txt
git commit -m "Initial commit in SDK"
cd ..
mkdir ui && cd ui
git init
git -c protocol.file.allow=always submodule add ../sdk
git commit -m "Add SDK as submodule"
git checkout -b feature_foo # in main repo
cd sdk
git checkout -b feature_sdk_foo # in submodule
cd ..
git checkout -b bugfix_bar # still in main repo
echo "Bugfix content" > fix.txt
git add fix.txt
git stash push -m "debugging"
git stash list
After this, the stash message shows:
stash@{0}: On feature_sdk_foo: debugging
Which clearly leaks the submodule’s branch name into the superproject’s stash label.
This is indeed a `git stash` problem
I verified that:
- Branches were unchanged after stashing
- Submodule state remained untouched
- `git status` correctly reported the superproject branch
- Yet the stash commit was labeled with the submodule’s branch name
So the stash mechanism seems to be pulling `HEAD` information from the submodule
context by mistake, even when the stash is purely for the superproject.
Also confirming that this is *not Windows-specific* — I reproduced it on Fedora as well.
The historical detail you shared (that this used to work fine around 2021) is helpful.
I'll dig into the stash code paths to see if I can isolate a regression or misbehavior.
-Jayatheerth
next prev parent reply other threads:[~2025-05-12 16:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 15:19 [BUG] git stash incorrectly showing submodule branch instead of superproject branch Stuart MacDonald
2025-05-12 16:12 ` K Jayatheerth [this message]
2025-05-12 16:26 ` Re " Stuart MacDonald
2025-05-12 16:40 ` [PATCH] stash: fix incorrect branch name in stash message K Jayatheerth
2025-05-12 16:42 ` JAYATHEERTH K
2025-05-12 17:09 ` Stuart MacDonald
2025-05-12 17:49 ` Junio C Hamano
2025-05-12 18:54 ` Eric Sunshine
2025-05-13 1:21 ` JAYATHEERTH K
2025-05-14 13:28 ` Junio C Hamano
2025-06-08 6:35 ` K Jayatheerth
2025-06-08 13:11 ` René Scharfe
2025-06-08 14:45 ` [PATCH v2] " K Jayatheerth
2025-06-08 16:20 ` Junio C Hamano
2025-06-11 1:32 ` JAYATHEERTH K
2025-06-11 1:42 ` [PATCH v3] " K Jayatheerth
2025-06-11 16:00 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250512161253.58427-1-jayatheerthkulkarni2005@gmail.com \
--to=jayatheerthkulkarni2005@gmail.com \
--cc=git@vger.kernel.org \
--cc=smacdonald@kaimaging.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).