* Bug Report: "git submodule deinit" fails right after a clone
@ 2016-08-30 11:45 Thomas Bétous
2016-09-14 20:29 ` Heiko Voigt
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Bétous @ 2016-08-30 11:45 UTC (permalink / raw)
To: git
Hello,
I found a curious bug in git version 2.9.0.windows.1 (run on Windows 7
via git bash).
If I clone a repository containing submodules and run a "git submodule
deinit" on any of the submodules of this repository without executing
another git command, this command fails.
For instance:
(let's say the repo MyProject contains 2 submodules: Submodule1 and Submodule2)
$ git clone ssh://****/MyProject
[ ... "git clone" output ... ]
$ cd MyProject
$ git submodule deinit Submodule1
fatal: Please stage your changes to .gitmodules or stash them to proceed
Submodule work tree 'Submodule1' contains local modifications; use
'-f' to discard them
$ git submodule deinit Submodule2
fatal: Please stage your changes to .gitmodules or stash them to proceed
Submodule work tree 'Submodule2' contains local modifications; use
'-f' to discard them
First the error message is strange.
Then what is even stranger is that the error disappears if a "git
status" is run before the submodule deinit...
$ git clone ssh://****/MyProject
[ ... "git clone" output ... ]
$ cd MyProject
$ git submodule deinit Submodule1
fatal: Please stage your changes to .gitmodules or stash them to proceed
Submodule work tree 'Submodule1' contains local modifications; use
'-f' to discard them
$ git status
[ ... "git status" output ...]
$ git submodule deinit Submodule1
Cleared directory 'Submodule1'
I have been able to reproduce this error at least 10 times and with
different repositories so I do not think it comes from the state of my
repositories.
Moreover, the use of "--recursive" argument to the "git clone" command
did not change anything.
Are you able to reproduce this problem?
Thank you in advance.
Best regards,
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug Report: "git submodule deinit" fails right after a clone
2016-08-30 11:45 Bug Report: "git submodule deinit" fails right after a clone Thomas Bétous
@ 2016-09-14 20:29 ` Heiko Voigt
2016-10-04 15:46 ` Thomas Bétous
0 siblings, 1 reply; 6+ messages in thread
From: Heiko Voigt @ 2016-09-14 20:29 UTC (permalink / raw)
To: Thomas Bétous; +Cc: git
On Tue, Aug 30, 2016 at 01:45:56PM +0200, Thomas Bétous wrote:
> Are you able to reproduce this problem?
No. I just did a clone and an immediate deinit afterwards and no error.
Maybe you can provide a script to reproduce? Which System was this on?
Cheers Heiko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug Report: "git submodule deinit" fails right after a clone
2016-09-14 20:29 ` Heiko Voigt
@ 2016-10-04 15:46 ` Thomas Bétous
2016-10-05 13:36 ` Heiko Voigt
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Bétous @ 2016-10-04 15:46 UTC (permalink / raw)
To: Heiko Voigt; +Cc: git
Thank you for your answer and sorry for the delay (I was on vacation...).
I am using git 2.9.0.windows.1 (run on Windows 7 via git bash).
I tested it on this repo:
https://github.com/githubtraining/example-dependency.git
The same problem occurs.
Here a small script to reproduce the error on my PC:
#!/bin/bash
git clone https://github.com/githubtraining/example-dependency.git
cd example-dependency
git submodule deinit js
It ends with this error:
fatal: Please stage your changes to .gitmodules or stash them to proceed
Submodule work tree 'js' contains local modifications; use '-f' to discard them
Is the script working on your PC?
Thank you in advance.
Thomas
On Wed, Sep 14, 2016 at 10:29 PM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
> On Tue, Aug 30, 2016 at 01:45:56PM +0200, Thomas Bétous wrote:
>> Are you able to reproduce this problem?
>
> No. I just did a clone and an immediate deinit afterwards and no error.
> Maybe you can provide a script to reproduce? Which System was this on?
>
> Cheers Heiko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug Report: "git submodule deinit" fails right after a clone
2016-10-04 15:46 ` Thomas Bétous
@ 2016-10-05 13:36 ` Heiko Voigt
[not found] ` <CAPOqYV+SR8=E24HR18ygJ-J-rV7=FedU+gGpq9mp+a7Mfk2LiQ@mail.gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Heiko Voigt @ 2016-10-05 13:36 UTC (permalink / raw)
To: Thomas Bétous; +Cc: git
Hi,
please do not top-post the conversation will otherwise get hard to
follow. Thank you.
On Tue, Oct 04, 2016 at 05:46:45PM +0200, Thomas Bétous wrote:
> Thank you for your answer and sorry for the delay (I was on vacation...).
>
> I am using git 2.9.0.windows.1 (run on Windows 7 via git bash).
My initial reaction is that this might be a problem with line endings. Did you
check whether you get any diff when you do a 'git diff' after the clone?
Maybe the variable 'core.autocrlf' is set to 'input' ? Have a look at 'git help
config'
> I tested it on this repo:
> https://github.com/githubtraining/example-dependency.git
> The same problem occurs.
> Here a small script to reproduce the error on my PC:
> #!/bin/bash
> git clone https://github.com/githubtraining/example-dependency.git
> cd example-dependency
> git submodule deinit js
>
> It ends with this error:
> fatal: Please stage your changes to .gitmodules or stash them to proceed
> Submodule work tree 'js' contains local modifications; use '-f' to discard them
Here I get
$ git submodule deinit js
Cleared directory 'js'
So all seems fine.
> Is the script working on your PC?
Yes. I am on Mac OS X though.
Cheers Heiko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug Report: "git submodule deinit" fails right after a clone
[not found] ` <CAPOqYV+SR8=E24HR18ygJ-J-rV7=FedU+gGpq9mp+a7Mfk2LiQ@mail.gmail.com>
@ 2016-10-06 9:20 ` Heiko Voigt
2016-10-06 16:10 ` Thomas Bétous
0 siblings, 1 reply; 6+ messages in thread
From: Heiko Voigt @ 2016-10-06 9:20 UTC (permalink / raw)
To: Thomas Bétous; +Cc: git, msysGit Mailinglist
Hi,
please also keep the mailinglist in the CC so everyone can read this.
On Thu, Oct 06, 2016 at 09:11:05AM +0200, Thomas Bétous wrote:
> On Wed, Oct 5, 2016 at 3:36 PM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
>
> >
> > My initial reaction is that this might be a problem with line endings. Did
> > you
> > check whether you get any diff when you do a 'git diff' after the clone?
> >
> > Maybe the variable 'core.autocrlf' is set to 'input' ? Have a look at 'git
> > help
> > config'
>
>
> When I do a 'git diff' right after the clone, nothing appears.
> Moreover my global setting for core.autocrlf is true. (This was configured
> on purpose as I work on Windows whereas the repositories are hosted on an
> UNIX server.)
So I guess the same applies to 'git status'?
> Nevertheless when I change core.autocrlf to 'input', the error disappears
> and I got the expected behavior for git submodule deinit...
> So I guess it is just a configuration problem but I do not understand why
> core.autocrlf should be set to 'input' to remove this error. Do you have
> any idea?
This is indeed strange. That's why I asked whether 'git diff' shows
anything. I was suspecting that the .gitmodules is somehow checked out
in UNIX format. And the fact that setting core.autocrlf to
'input' seems to fix it supports that.
I currently do not have access to a windows machine as the moment to
test this. Copying the windows mailing list maybe someone over there
can reproduce and help with the issue[1].
Cheers Heiko
[1] http://public-inbox.org/git/%3CCAPOqYV+xsrLk7y1hJYHZFY8OfkxVRwPcZBdqhdgrhThqdZysQA@mail.gmail.com%3E/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug Report: "git submodule deinit" fails right after a clone
2016-10-06 9:20 ` Heiko Voigt
@ 2016-10-06 16:10 ` Thomas Bétous
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Bétous @ 2016-10-06 16:10 UTC (permalink / raw)
To: Heiko Voigt; +Cc: git, msysGit Mailinglist
Hello,
Sorry again for the mailing list...
On Thu, Oct 6, 2016 at 11:20 AM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
> So I guess the same applies to 'git status'?
No, it is the strange thing.
As told in my very first message here what happens after git diff and
git status:
$ git clone https://github.com/githubtraining/example-dependency.git
Cloning into 'example-dependency'...
remote: Counting objects: 35, done.
remote: Total 35 (delta 0), reused 0 (delta 0), pack-reused 35
Unpacking objects: 100% (35/35), done.
Checking connectivity... done.
$ cd example-dependency
$ git submodule deinit js
fatal: Please stage your changes to .gitmodules or stash them to proceed
Submodule work tree 'js' contains local modifications; use '-f' to discard them
$ git diff
[no output]
$ git submodule deinit js
fatal: Please stage your changes to .gitmodules or stash them to proceed
Submodule work tree 'js' contains local modifications; use '-f' to discard them
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
$ git submodule deinit js
Cleared directory 'js'
So as you can see, the 'git status' makes the problem magically disappear.
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-10-06 16:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-30 11:45 Bug Report: "git submodule deinit" fails right after a clone Thomas Bétous
2016-09-14 20:29 ` Heiko Voigt
2016-10-04 15:46 ` Thomas Bétous
2016-10-05 13:36 ` Heiko Voigt
[not found] ` <CAPOqYV+SR8=E24HR18ygJ-J-rV7=FedU+gGpq9mp+a7Mfk2LiQ@mail.gmail.com>
2016-10-06 9:20 ` Heiko Voigt
2016-10-06 16:10 ` Thomas Bétous
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.