{"thread":{"id":"52060","subject":"bug: Directory replaced by submodule -> checkout fails","startedAt":"2019-10-17T23:04:59Z","lastAt":"2019-10-18T16:27:14Z","messageCount":3,"participants":["Christopher Collins","Thomas Braun"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"384303","messageId":"20191017230751.GC4049@pseudoephedrine.nightmare-heaven.no-ip.biz","threadId":"52060","inReplyTo":null,"subject":"bug: Directory replaced by submodule -> checkout fails","fromName":"Christopher Collins","fromEmail":"chris@runtime.io","sentAt":"2019-10-17T23:07:51Z","receivedAt":"2019-10-17T23:04:59Z","isPatch":false,"sender":{"key":"chris@runtime.io","avatar":null},"body":"Hello all,\n\n### Environment:\n\n$ git --version\ngit version 2.21.0\n\n### Reproduce:\n\ngit clone git@github.com:JuulLabs-OSS/mcuboot.git\ncd mcuboot\ngit submodule init\ngit submodule update\ngit checkout ae01f153b11637feaedbc9d9042172fba2e080c0\n\n### Discussion:\n\nIn the above sequence, the last step (checkout) fails with this error:\n\n    error: The following untracked working tree files would be overwritten by checkout:\n            ext/mbedtls/include/mbedtls/asn1.h\n            ext/mbedtls/include/mbedtls/bignum.h\n            ext/mbedtls/include/mbedtls/check_config.h\n            ext/mbedtls/include/mbedtls/config.h\n            ext/mbedtls/include/mbedtls/ecdsa.h\n            ext/mbedtls/include/mbedtls/ecp.h\n            ext/mbedtls/include/mbedtls/md.h\n            ext/mbedtls/include/mbedtls/oid.h\n            ext/mbedtls/include/mbedtls/pk.h\n            ext/mbedtls/include/mbedtls/platform.h\n            ext/mbedtls/include/mbedtls/platform_util.h\n            ext/mbedtls/include/mbedtls/threading.h\n    Please move or remove them before you switch branches.\n    Aborting\n\nIn the mcuboot repo, a regular directory was recently replaced with a\nsubmodule.  This was done with two separate commits:\n\n1. (b748f6) Rename `ext/mbedtls` --> `ext/mbedtls-asn1`\n2. (f984b9) Add submodule `ext/mbedtls`\n\nGit reports an error when you use `git checkout` to \"jump over\" these\ntwo commits.  The sequence above shows what happens when you go from\npost-replace to pre-replace (master to ae01f1).\n\nWhen you do the reverse (pre-replace to post-replace), the checkout\noperation succeeds, but git emits the following warning:\n\n    warning: unable to rmdir 'sim/mcuboot-sys/mbedtls': Directory not empty\n\nThis leaves the repo in a dirty state.\n\nThe problem is easy to work around by hand:\n\n    rm -rf ext/mbedtls sim/mcuboot-sys/mbedtls\n    git checkout ae01f153b11637feaedbc9d9042172fba2e080c0\n\nUnfortunately it is not easy for automated tools to work around the\nissue.\n\nThanks,\nChris\n"},{"id":"384379","messageId":"f66f0587-4d61-71e8-fc87-3278f1023e3d@virtuell-zuhause.de","threadId":"52060","inReplyTo":"20191017230751.GC4049@pseudoephedrine.nightmare-heaven.no-ip.biz","subject":"Re: bug: Directory replaced by submodule -> checkout fails","fromName":"Thomas Braun","fromEmail":"thomas.braun@virtuell-zuhause.de","sentAt":"2019-10-18T12:02:29Z","receivedAt":"2019-10-18T12:46:56Z","isPatch":false,"sender":{"key":"thomas.braun@virtuell-zuhause.de","avatar":"https://avatars.githubusercontent.com/u/1185677?v=4"},"body":"Am 18.10.2019 um 01:07 schrieb Christopher Collins:\n\nHi Christopher,\n\n> ### Reproduce:>\n> \n> git clone git@github.com:JuulLabs-OSS/mcuboot.git\n> cd mcuboot\n> git submodule init\n> git submodule update\n> git checkout ae01f153b11637feaedbc9d9042172fba2e080c0\n> \n> ### Discussion:\n> \n> In the above sequence, the last step (checkout) fails with this error:\n> \n>     error: The following untracked working tree files would be overwritten by checkout:\n>             ext/mbedtls/include/mbedtls/asn1.h\n>             ext/mbedtls/include/mbedtls/bignum.h\n>             ext/mbedtls/include/mbedtls/check_config.h\n>             ext/mbedtls/include/mbedtls/config.h\n>             ext/mbedtls/include/mbedtls/ecdsa.h\n>             ext/mbedtls/include/mbedtls/ecp.h\n>             ext/mbedtls/include/mbedtls/md.h\n>             ext/mbedtls/include/mbedtls/oid.h\n>             ext/mbedtls/include/mbedtls/pk.h\n>             ext/mbedtls/include/mbedtls/platform.h\n>             ext/mbedtls/include/mbedtls/platform_util.h\n>             ext/mbedtls/include/mbedtls/threading.h\n>     Please move or remove them before you switch branches.\n>     Aborting\n> \n\nThis is a known bug unfortunately. See\nhttps://public-inbox.org/git/CAGZ79kYTY6U0eNwvU0PcDyt_QXGyYGm5VkDvWLtuQgQG6BbtFA@mail.gmail.com/\nfor reference.\n\n"},{"id":"384393","messageId":"20191018163011.GF4049@pseudoephedrine.nightmare-heaven.no-ip.biz","threadId":"52060","inReplyTo":"f66f0587-4d61-71e8-fc87-3278f1023e3d@virtuell-zuhause.de","subject":"Re: bug: Directory replaced by submodule -> checkout fails","fromName":"Christopher Collins","fromEmail":"chris@runtime.io","sentAt":"2019-10-18T16:30:11Z","receivedAt":"2019-10-18T16:27:14Z","isPatch":false,"sender":{"key":"chris@runtime.io","avatar":null},"body":"Hi Thomas,\n\nOn Fri, Oct 18, 2019 at 02:02:29PM +0200, Thomas Braun wrote:\n> This is a known bug unfortunately. See\n> https://public-inbox.org/git/CAGZ79kYTY6U0eNwvU0PcDyt_QXGyYGm5VkDvWLtuQgQG6BbtFA@mail.gmail.com/\n> for reference.\n\nGood to know.  Thanks for the reference.\n\nChris\n"}]}