git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Possible bug with checkout and submodules
@ 2021-10-16 18:44 Adam Hutchings
  2021-10-16 18:52 ` brian m. carlson
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Hutchings @ 2021-10-16 18:44 UTC (permalink / raw)
  To: git

Hi,

I may have found a bug in Git but I'm not sure if it's intentional or not. I

checked out to a new branch to test a PR on my repo, and the PR added a

submodule. I init'ed and updated the submodule, and when I was done testing, I

went back to my main branch. However, it did not remove the submodule, and

produced this message:


```

$ git checkout main

warning: unable to rmdir 'glfw': Directory not empty

Switched to branch 'main'

$

```


A friend of mine has managed to reproduce this behavior. We believe the expected

outcome is to remove the submodule folder, but this does not seem to happen. Is

this intentional?


Best,



Adam Hutchings

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

* Re: Possible bug with checkout and submodules
  2021-10-16 18:44 Possible bug with checkout and submodules Adam Hutchings
@ 2021-10-16 18:52 ` brian m. carlson
  2021-10-16 20:32   ` Adam Hutchings
  2021-10-17  0:30   ` Philippe Blain
  0 siblings, 2 replies; 4+ messages in thread
From: brian m. carlson @ 2021-10-16 18:52 UTC (permalink / raw)
  To: Adam Hutchings; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]

On 2021-10-16 at 18:44:04, Adam Hutchings wrote:
> Hi,
> 
> I may have found a bug in Git but I'm not sure if it's intentional or not. I
> 
> checked out to a new branch to test a PR on my repo, and the PR added a
> 
> submodule. I init'ed and updated the submodule, and when I was done testing, I
> 
> went back to my main branch. However, it did not remove the submodule, and
> 
> produced this message:
> 
> 
> ```
> 
> $ git checkout main
> 
> warning: unable to rmdir 'glfw': Directory not empty
> 
> Switched to branch 'main'
> 
> $
> 
> ```
> 
> 
> A friend of mine has managed to reproduce this behavior. We believe the expected
> 
> outcome is to remove the submodule folder, but this does not seem to happen. Is
> 
> this intentional?

This is intentional.  It may be that the submodule has data that's
ignored, it could have local changes, or it could have additional
unpushed history, any of which would probably be data users might not
want to lose.  As a result, we don't remove the directory unless the
user has run "git submodule deinit".
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

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

* Re: Possible bug with checkout and submodules
  2021-10-16 18:52 ` brian m. carlson
@ 2021-10-16 20:32   ` Adam Hutchings
  2021-10-17  0:30   ` Philippe Blain
  1 sibling, 0 replies; 4+ messages in thread
From: Adam Hutchings @ 2021-10-16 20:32 UTC (permalink / raw)
  To: brian m. carlson, Adam Hutchings, git

OK, thank you!

On Sat, Oct 16, 2021 at 11:52 AM brian m. carlson
<sandals@crustytoothpaste.net> wrote:
>
> On 2021-10-16 at 18:44:04, Adam Hutchings wrote:
> > Hi,
> >
> > I may have found a bug in Git but I'm not sure if it's intentional or not. I
> >
> > checked out to a new branch to test a PR on my repo, and the PR added a
> >
> > submodule. I init'ed and updated the submodule, and when I was done testing, I
> >
> > went back to my main branch. However, it did not remove the submodule, and
> >
> > produced this message:
> >
> >
> > ```
> >
> > $ git checkout main
> >
> > warning: unable to rmdir 'glfw': Directory not empty
> >
> > Switched to branch 'main'
> >
> > $
> >
> > ```
> >
> >
> > A friend of mine has managed to reproduce this behavior. We believe the expected
> >
> > outcome is to remove the submodule folder, but this does not seem to happen. Is
> >
> > this intentional?
>
> This is intentional.  It may be that the submodule has data that's
> ignored, it could have local changes, or it could have additional
> unpushed history, any of which would probably be data users might not
> want to lose.  As a result, we don't remove the directory unless the
> user has run "git submodule deinit".
> --
> brian m. carlson (he/him or they/them)
> Toronto, Ontario, CA

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

* Re: Possible bug with checkout and submodules
  2021-10-16 18:52 ` brian m. carlson
  2021-10-16 20:32   ` Adam Hutchings
@ 2021-10-17  0:30   ` Philippe Blain
  1 sibling, 0 replies; 4+ messages in thread
From: Philippe Blain @ 2021-10-17  0:30 UTC (permalink / raw)
  To: brian m. carlson, Adam Hutchings, git

Hi Adam,

Le 2021-10-16 à 14:52, brian m. carlson a écrit :
> On 2021-10-16 at 18:44:04, Adam Hutchings wrote:
>> Hi,
>>
>> I may have found a bug in Git but I'm not sure if it's intentional or not. I
>>
>> checked out to a new branch to test a PR on my repo, and the PR added a
>>
>> submodule. I init'ed and updated the submodule, and when I was done testing, I
>>
>> went back to my main branch. However, it did not remove the submodule, and
>>
>> produced this message:
>>
>>
>> ```
>>
>> $ git checkout main
>>
>> warning: unable to rmdir 'glfw': Directory not empty
>>
>> Switched to branch 'main'
>>
>> $
>>
>> ```
>>
>>
>> A friend of mine has managed to reproduce this behavior. We believe the expected
>>
>> outcome is to remove the submodule folder, but this does not seem to happen. Is
>>
>> this intentional?
> 
> This is intentional.  It may be that the submodule has data that's
> ignored, it could have local changes, or it could have additional
> unpushed history, any of which would probably be data users might not
> want to lose.  As a result, we don't remove the directory unless the
> user has run "git submodule deinit".
> 

... or unless you run 'git checkout --recurse-submodules', or just
'git checkout' and you have 'submodule.recurse' set to true in your configuration.

Cheers,
Philippe.

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

end of thread, other threads:[~2021-10-17  0:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-16 18:44 Possible bug with checkout and submodules Adam Hutchings
2021-10-16 18:52 ` brian m. carlson
2021-10-16 20:32   ` Adam Hutchings
2021-10-17  0:30   ` Philippe Blain

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