From: Thomas Braun <thomas.braun@virtuell-zuhause.de>
To: git@vger.kernel.org
Subject: Branch switching with submodules where the submodule replaces a folder aborts unexpectedly
Date: Mon, 9 Oct 2017 23:29:01 +0200 (CEST) [thread overview]
Message-ID: <788230417.115707.1507584541605@ox.hosteurope.de> (raw)
Hi,
I'm currently in the progress of pulling some subprojects in a git repository of mine into their own repositories and adding these subprojects back as submodules.
While doing this I enountered a potential bug as checkout complains on branch switching that a file already exists.
I've reproduced it on debian stretch with the following git versions:
master:
git version 2.15.0.rc0.39.g2f0e14e649
pu:
git version 2.15.0.rc0.245.g6d586db062
A script to trigger it is
mkdir -p test/subproject
cd test
git init
touch subproject/1
git add subproject
git commit -m "blah"
cd ..
mkdir subproject
cd subproject
git init
touch 1
git add 1
git commit -m "blubb"
cd ../test
git branch old
git rm -rf subproject
git commit -m "remove blah"
git submodule add ../subproject
git add -A
git commit -m "added subproject"
git branch new
git checkout old
and this fails with
$LANG=C ./run.sh
Initialized empty Git repository in /home/XXX/devel/test/.git/
[master (root-commit) 33e6607] blah
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 subproject/1
Initialized empty Git repository in /home/XXX/devel/subproject/.git/
[master (root-commit) e817644] blubb
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 1
rm 'subproject/1'
[master 9cbfd57] remove blah
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 subproject/1
Cloning into '/home/XXX/devel/test/subproject'...
done.
[master 1c67e23] added subproject
2 files changed, 4 insertions(+)
create mode 100644 .gitmodules
create mode 160000 subproject
error: The following untracked working tree files would be overwritten by checkout:
subproject/1
Please move or remove them before you switch branches.
Aborting
If I'm misusing git here I'm glad for any advice.
Thanks,
Thomas
next reply other threads:[~2017-10-09 21:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 21:29 Thomas Braun [this message]
2017-10-09 21:59 ` Branch switching with submodules where the submodule replaces a folder aborts unexpectedly Stefan Beller
2017-10-12 11:48 ` Thomas Braun
-- strict thread matches above, loose matches on Subject: below --
2018-06-19 16:03 Sam Kuper
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=788230417.115707.1507584541605@ox.hosteurope.de \
--to=thomas.braun@virtuell-zuhause.de \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).