git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* bug: Directory replaced by submodule -> checkout fails
@ 2019-10-17 23:07 Christopher Collins
  2019-10-18 12:02 ` Thomas Braun
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Collins @ 2019-10-17 23:07 UTC (permalink / raw)
  To: git

Hello all,

### Environment:

$ git --version
git version 2.21.0

### Reproduce:

git clone git@github.com:JuulLabs-OSS/mcuboot.git
cd mcuboot
git submodule init
git submodule update
git checkout ae01f153b11637feaedbc9d9042172fba2e080c0

### Discussion:

In the above sequence, the last step (checkout) fails with this error:

    error: The following untracked working tree files would be overwritten by checkout:
            ext/mbedtls/include/mbedtls/asn1.h
            ext/mbedtls/include/mbedtls/bignum.h
            ext/mbedtls/include/mbedtls/check_config.h
            ext/mbedtls/include/mbedtls/config.h
            ext/mbedtls/include/mbedtls/ecdsa.h
            ext/mbedtls/include/mbedtls/ecp.h
            ext/mbedtls/include/mbedtls/md.h
            ext/mbedtls/include/mbedtls/oid.h
            ext/mbedtls/include/mbedtls/pk.h
            ext/mbedtls/include/mbedtls/platform.h
            ext/mbedtls/include/mbedtls/platform_util.h
            ext/mbedtls/include/mbedtls/threading.h
    Please move or remove them before you switch branches.
    Aborting

In the mcuboot repo, a regular directory was recently replaced with a
submodule.  This was done with two separate commits:

1. (b748f6) Rename `ext/mbedtls` --> `ext/mbedtls-asn1`
2. (f984b9) Add submodule `ext/mbedtls`

Git reports an error when you use `git checkout` to "jump over" these
two commits.  The sequence above shows what happens when you go from
post-replace to pre-replace (master to ae01f1).

When you do the reverse (pre-replace to post-replace), the checkout
operation succeeds, but git emits the following warning:

    warning: unable to rmdir 'sim/mcuboot-sys/mbedtls': Directory not empty

This leaves the repo in a dirty state.

The problem is easy to work around by hand:

    rm -rf ext/mbedtls sim/mcuboot-sys/mbedtls
    git checkout ae01f153b11637feaedbc9d9042172fba2e080c0

Unfortunately it is not easy for automated tools to work around the
issue.

Thanks,
Chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug: Directory replaced by submodule -> checkout fails
  2019-10-17 23:07 bug: Directory replaced by submodule -> checkout fails Christopher Collins
@ 2019-10-18 12:02 ` Thomas Braun
  2019-10-18 16:30   ` Christopher Collins
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Braun @ 2019-10-18 12:02 UTC (permalink / raw)
  To: Christopher Collins, git

Am 18.10.2019 um 01:07 schrieb Christopher Collins:

Hi Christopher,

> ### Reproduce:>
> 
> git clone git@github.com:JuulLabs-OSS/mcuboot.git
> cd mcuboot
> git submodule init
> git submodule update
> git checkout ae01f153b11637feaedbc9d9042172fba2e080c0
> 
> ### Discussion:
> 
> In the above sequence, the last step (checkout) fails with this error:
> 
>     error: The following untracked working tree files would be overwritten by checkout:
>             ext/mbedtls/include/mbedtls/asn1.h
>             ext/mbedtls/include/mbedtls/bignum.h
>             ext/mbedtls/include/mbedtls/check_config.h
>             ext/mbedtls/include/mbedtls/config.h
>             ext/mbedtls/include/mbedtls/ecdsa.h
>             ext/mbedtls/include/mbedtls/ecp.h
>             ext/mbedtls/include/mbedtls/md.h
>             ext/mbedtls/include/mbedtls/oid.h
>             ext/mbedtls/include/mbedtls/pk.h
>             ext/mbedtls/include/mbedtls/platform.h
>             ext/mbedtls/include/mbedtls/platform_util.h
>             ext/mbedtls/include/mbedtls/threading.h
>     Please move or remove them before you switch branches.
>     Aborting
> 

This is a known bug unfortunately. See
https://public-inbox.org/git/CAGZ79kYTY6U0eNwvU0PcDyt_QXGyYGm5VkDvWLtuQgQG6BbtFA@mail.gmail.com/
for reference.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug: Directory replaced by submodule -> checkout fails
  2019-10-18 12:02 ` Thomas Braun
@ 2019-10-18 16:30   ` Christopher Collins
  0 siblings, 0 replies; 3+ messages in thread
From: Christopher Collins @ 2019-10-18 16:30 UTC (permalink / raw)
  To: Thomas Braun; +Cc: git

Hi Thomas,

On Fri, Oct 18, 2019 at 02:02:29PM +0200, Thomas Braun wrote:
> This is a known bug unfortunately. See
> https://public-inbox.org/git/CAGZ79kYTY6U0eNwvU0PcDyt_QXGyYGm5VkDvWLtuQgQG6BbtFA@mail.gmail.com/
> for reference.

Good to know.  Thanks for the reference.

Chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-18 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-17 23:07 bug: Directory replaced by submodule -> checkout fails Christopher Collins
2019-10-18 12:02 ` Thomas Braun
2019-10-18 16:30   ` Christopher Collins

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).