From: Rose Kunkel <hidden> Date: 2021-06-16 00:16:20
# What did you do before the bug happened? (Steps to reproduce your issue)
1. Clone a git repository that sets `update = none` in .gitmodules:
$ git clone --recurse-submodules https://github.com/ubolonton/tree-sitter-langs
2. Perform a hard reset:
$ cd tree-sitter-langs
$ git reset --hard
# What did you expect to happen? (Expected behavior)
The reset should succeed and do nothing.
# What happened instead? (Actual behavior)
The reset command fails with
From: brian m. carlson <hidden> Date: 2021-06-16 00:52:16
On 2021-06-16 at 00:16:06, Rose Kunkel wrote:
# What did you do before the bug happened? (Steps to reproduce your issue)
1. Clone a git repository that sets `update = none` in .gitmodules:
$ git clone --recurse-submodules https://github.com/ubolonton/tree-sitter-langs
2. Perform a hard reset:
$ cd tree-sitter-langs
$ git reset --hard
# What did you expect to happen? (Expected behavior)
The reset should succeed and do nothing.
I think we're in agreement on this. This should be a fresh clone and so
a hard reset should change nothing.
# What happened instead? (Actual behavior)
The reset command fails with
Hmmm, I can't reproduce this behavior. What I see is this:
$ git reset --hard
HEAD is now at 5d362ce Release 0.10.0
I'm running git version 2.32.0.272.g935e593368 on Debian sid (with the
experimental packages).
Can you try the clone and run a "git status" command in the repository
to see if anything is modified after your clone? Are the submodules
checked out when you perform the clone? In my case, I see lines like
this:
Skipping submodule 'repos/agda'
If you're seeing something different, then that might contribute to the
different behavior we're seeing.
--
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Cloninginto'tree-sitter-langs'...remote:Enumeratingobjects:609,done.remote:Countingobjects:100%(83/83),done.remote:Compressingobjects:100%(52/52),done.remote:Total609(delta40),reused58(delta24),pack-reused526Receivingobjects:100%(609/609),117.17KiB|1.05MiB/s,done.Resolvingdeltas:100%(322/322),done.Submodule'repos/agda'(https://github.com/tree-sitter/tree-sitter-agda) registered for path'repos/agda'Submodule'repos/bash'(https://github.com/tree-sitter/tree-sitter-bash) registered for path'repos/bash'Submodule'repos/c'(https://github.com/tree-sitter/tree-sitter-c)registeredforpath'repos/c'Submodule'repos/c-sharp'(https://github.com/tree-sitter/tree-sitter-c-sharp) registered forpath'repos/c-sharp'Submodule'repos/cpp'(https://github.com/tree-sitter/tree-sitter-cpp)registeredforpath'repos/cpp'Submodule'repos/css'(https://github.com/tree-sitter/tree-sitter-css)registeredforpath'repos/css'Submodule'repos/elm'(https://github.com/razzeee/tree-sitter-elm)registeredforpath'repos/elm'Submodule'repos/fluent'(https://github.com/tree-sitter/tree-sitter-fluent) registered forpath'repos/fluent'Submodule'repos/go'(https://github.com/tree-sitter/tree-sitter-go)registeredforpath'repos/go'Submodule'repos/html'(https://github.com/tree-sitter/tree-sitter-html) registered for path'repos/html'Submodule'repos/janet-simple'(https://codeberg.org/sogaiu/tree-sitter-janet-simple) registered forpath'repos/janet-simple'Submodule'repos/java'(https://github.com/tree-sitter/tree-sitter-java) registered for path'repos/java'Submodule'repos/javascript'(https://github.com/tree-sitter/tree-sitter-javascript) registered forpath'repos/javascript'Submodule'repos/jsdoc'(https://github.com/tree-sitter/tree-sitter-jsdoc) registered for path'repos/jsdoc'Submodule'repos/json'(https://github.com/tree-sitter/tree-sitter-json) registered for path'repos/json'Submodule'repos/julia'(https://github.com/tree-sitter/tree-sitter-julia) registered for path'repos/julia'Submodule'repos/ocaml'(https://github.com/tree-sitter/tree-sitter-ocaml) registered for path'repos/ocaml'Submodule'repos/php'(https://github.com/tree-sitter/tree-sitter-php)registeredforpath'repos/php'Submodule'repos/python'(https://github.com/tree-sitter/tree-sitter-python) registered forpath'repos/python'Submodule'repos/ruby'(https://github.com/tree-sitter/tree-sitter-ruby) registered for path'repos/ruby'Submodule'repos/rust'(https://github.com/tree-sitter/tree-sitter-rust) registered for path'repos/rust'Submodule'repos/scala'(https://github.com/tree-sitter/tree-sitter-scala) registered for path'repos/scala'Submodule'repos/swift'(https://github.com/tree-sitter/tree-sitter-swift) registered for path'repos/swift'Submodule'repos/typescript'(https://github.com/tree-sitter/tree-sitter-typescript) registered forpath'repos/typescript'Skippingsubmodule'repos/agda'Skippingsubmodule'repos/bash'Skippingsubmodule'repos/c'Skippingsubmodule'repos/c-sharp'Skippingsubmodule'repos/cpp'Skippingsubmodule'repos/css'Skippingsubmodule'repos/elm'Skippingsubmodule'repos/fluent'Skippingsubmodule'repos/go'Skippingsubmodule'repos/html'Skippingsubmodule'repos/janet-simple'Skippingsubmodule'repos/java'Skippingsubmodule'repos/javascript'Skippingsubmodule'repos/jsdoc'Skippingsubmodule'repos/json'Skippingsubmodule'repos/julia'Skippingsubmodule'repos/ocaml'Skippingsubmodule'repos/php'Skippingsubmodule'repos/python'Skippingsubmodule'repos/ruby'Skippingsubmodule'repos/rust'Skippingsubmodule'repos/scala'Skippingsubmodule'repos/swift'Skippingsubmodule'repos/typescript'
On Tue, Jun 15, 2021 at 5:51 PM brian m. carlson
[off-list ref] wrote:
On 2021-06-16 at 00:16:06, Rose Kunkel wrote:
quoted
# What did you do before the bug happened? (Steps to reproduce your issue)
1. Clone a git repository that sets `update = none` in .gitmodules:
$ git clone --recurse-submodules https://github.com/ubolonton/tree-sitter-langs
2. Perform a hard reset:
$ cd tree-sitter-langs
$ git reset --hard
# What did you expect to happen? (Expected behavior)
The reset should succeed and do nothing.
I think we're in agreement on this. This should be a fresh clone and so
a hard reset should change nothing.
quoted
# What happened instead? (Actual behavior)
The reset command fails with
Hmmm, I can't reproduce this behavior. What I see is this:
$ git reset --hard
HEAD is now at 5d362ce Release 0.10.0
I'm running git version 2.32.0.272.g935e593368 on Debian sid (with the
experimental packages).
Can you try the clone and run a "git status" command in the repository
to see if anything is modified after your clone? Are the submodules
checked out when you perform the clone? In my case, I see lines like
this:
Skipping submodule 'repos/agda'
If you're seeing something different, then that might contribute to the
different behavior we're seeing.
--
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Cloninginto'tree-sitter-langs'...remote:Enumeratingobjects:609,done.remote:Countingobjects:100%(83/83),done.remote:Compressingobjects:100%(52/52),done.remote:Total609(delta40),reused58(delta24),pack-reused526Receivingobjects:100%(609/609),117.17KiB|1.05MiB/s,done.Resolvingdeltas:100%(322/322),done.Submodule'repos/agda'(https://github.com/tree-sitter/tree-sitter-agda) registered for path'repos/agda'Submodule'repos/bash'(https://github.com/tree-sitter/tree-sitter-bash) registered for path'repos/bash'Submodule'repos/c'(https://github.com/tree-sitter/tree-sitter-c)registeredforpath'repos/c'Submodule'repos/c-sharp'(https://github.com/tree-sitter/tree-sitter-c-sharp) registered forpath'repos/c-sharp'Submodule'repos/cpp'(https://github.com/tree-sitter/tree-sitter-cpp)registeredforpath'repos/cpp'Submodule'repos/css'(https://github.com/tree-sitter/tree-sitter-css)registeredforpath'repos/css'Submodule'repos/elm'(https://github.com/razzeee/tree-sitter-elm)registeredforpath'repos/elm'Submodule'repos/fluent'(https://github.com/tree-sitter/tree-sitter-fluent) registered forpath'repos/fluent'Submodule'repos/go'(https://github.com/tree-sitter/tree-sitter-go)registeredforpath'repos/go'Submodule'repos/html'(https://github.com/tree-sitter/tree-sitter-html) registered for path'repos/html'Submodule'repos/janet-simple'(https://codeberg.org/sogaiu/tree-sitter-janet-simple) registered forpath'repos/janet-simple'Submodule'repos/java'(https://github.com/tree-sitter/tree-sitter-java) registered for path'repos/java'Submodule'repos/javascript'(https://github.com/tree-sitter/tree-sitter-javascript) registered forpath'repos/javascript'Submodule'repos/jsdoc'(https://github.com/tree-sitter/tree-sitter-jsdoc) registered for path'repos/jsdoc'Submodule'repos/json'(https://github.com/tree-sitter/tree-sitter-json) registered for path'repos/json'Submodule'repos/julia'(https://github.com/tree-sitter/tree-sitter-julia) registered for path'repos/julia'Submodule'repos/ocaml'(https://github.com/tree-sitter/tree-sitter-ocaml) registered for path'repos/ocaml'Submodule'repos/php'(https://github.com/tree-sitter/tree-sitter-php)registeredforpath'repos/php'Submodule'repos/python'(https://github.com/tree-sitter/tree-sitter-python) registered forpath'repos/python'Submodule'repos/ruby'(https://github.com/tree-sitter/tree-sitter-ruby) registered for path'repos/ruby'Submodule'repos/rust'(https://github.com/tree-sitter/tree-sitter-rust) registered for path'repos/rust'Submodule'repos/scala'(https://github.com/tree-sitter/tree-sitter-scala) registered for path'repos/scala'Submodule'repos/swift'(https://github.com/tree-sitter/tree-sitter-swift) registered for path'repos/swift'Submodule'repos/typescript'(https://github.com/tree-sitter/tree-sitter-typescript) registered forpath'repos/typescript'Skippingsubmodule'repos/agda'Skippingsubmodule'repos/bash'Skippingsubmodule'repos/c'Skippingsubmodule'repos/c-sharp'Skippingsubmodule'repos/cpp'Skippingsubmodule'repos/css'Skippingsubmodule'repos/elm'Skippingsubmodule'repos/fluent'Skippingsubmodule'repos/go'Skippingsubmodule'repos/html'Skippingsubmodule'repos/janet-simple'Skippingsubmodule'repos/java'Skippingsubmodule'repos/javascript'Skippingsubmodule'repos/jsdoc'Skippingsubmodule'repos/json'Skippingsubmodule'repos/julia'Skippingsubmodule'repos/ocaml'Skippingsubmodule'repos/php'Skippingsubmodule'repos/python'Skippingsubmodule'repos/ruby'Skippingsubmodule'repos/rust'Skippingsubmodule'repos/scala'Skippingsubmodule'repos/swift'Skippingsubmodule'repos/typescript'
On Tue, Jun 15, 2021 at 5:51 PM brian m. carlson
[off-list ref] wrote:
quoted
On 2021-06-16 at 00:16:06, Rose Kunkel wrote:
quoted
# What did you do before the bug happened? (Steps to reproduce your issue)
1. Clone a git repository that sets `update = none` in .gitmodules:
$ git clone --recurse-submodules https://github.com/ubolonton/tree-sitter-langs
2. Perform a hard reset:
$ cd tree-sitter-langs
$ git reset --hard
# What did you expect to happen? (Expected behavior)
The reset should succeed and do nothing.
I think we're in agreement on this. This should be a fresh clone and so
a hard reset should change nothing.
quoted
# What happened instead? (Actual behavior)
The reset command fails with
Hmmm, I can't reproduce this behavior. What I see is this:
$ git reset --hard
HEAD is now at 5d362ce Release 0.10.0
I'm running git version 2.32.0.272.g935e593368 on Debian sid (with the
experimental packages).
Can you try the clone and run a "git status" command in the repository
to see if anything is modified after your clone? Are the submodules
checked out when you perform the clone? In my case, I see lines like
this:
Skipping submodule 'repos/agda'
If you're seeing something different, then that might contribute to the
different behavior we're seeing.
--
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
From: Rose Kunkel <hidden> Date: 2021-06-16 01:15:57
If I set `submodule.recurse = false` in .git/config, I get the
behavior you're seeing.
On Tue, Jun 15, 2021 at 6:03 PM Rose Kunkel [off-list ref] wrote:
Cloninginto'tree-sitter-langs'...remote:Enumeratingobjects:609,done.remote:Countingobjects:100%(83/83),done.remote:Compressingobjects:100%(52/52),done.remote:Total609(delta40),reused58(delta24),pack-reused526Receivingobjects:100%(609/609),117.17KiB|1.05MiB/s,done.Resolvingdeltas:100%(322/322),done.Submodule'repos/agda'(https://github.com/tree-sitter/tree-sitter-agda) registered for path'repos/agda'Submodule'repos/bash'(https://github.com/tree-sitter/tree-sitter-bash) registered for path'repos/bash'Submodule'repos/c'(https://github.com/tree-sitter/tree-sitter-c)registeredforpath'repos/c'Submodule'repos/c-sharp'(https://github.com/tree-sitter/tree-sitter-c-sharp) registered forpath'repos/c-sharp'Submodule'repos/cpp'(https://github.com/tree-sitter/tree-sitter-cpp)registeredforpath'repos/cpp'Submodule'repos/css'(https://github.com/tree-sitter/tree-sitter-css)registeredforpath'repos/css'Submodule'repos/elm'(https://github.com/razzeee/tree-sitter-elm)registeredforpath'repos/elm'Submodule'repos/fluent'(https://github.com/tree-sitter/tree-sitter-fluent) registered forpath'repos/fluent'Submodule'repos/go'(https://github.com/tree-sitter/tree-sitter-go)registeredforpath'repos/go'Submodule'repos/html'(https://github.com/tree-sitter/tree-sitter-html) registered for path'repos/html'Submodule'repos/janet-simple'(https://codeberg.org/sogaiu/tree-sitter-janet-simple) registered forpath'repos/janet-simple'Submodule'repos/java'(https://github.com/tree-sitter/tree-sitter-java) registered for path'repos/java'Submodule'repos/javascript'(https://github.com/tree-sitter/tree-sitter-javascript) registered forpath'repos/javascript'Submodule'repos/jsdoc'(https://github.com/tree-sitter/tree-sitter-jsdoc) registered for path'repos/jsdoc'Submodule'repos/json'(https://github.com/tree-sitter/tree-sitter-json) registered for path'repos/json'Submodule'repos/julia'(https://github.com/tree-sitter/tree-sitter-julia) registered for path'repos/julia'Submodule'repos/ocaml'(https://github.com/tree-sitter/tree-sitter-ocaml) registered for path'repos/ocaml'Submodule'repos/php'(https://github.com/tree-sitter/tree-sitter-php)registeredforpath'repos/php'Submodule'repos/python'(https://github.com/tree-sitter/tree-sitter-python) registered forpath'repos/python'Submodule'repos/ruby'(https://github.com/tree-sitter/tree-sitter-ruby) registered for path'repos/ruby'Submodule'repos/rust'(https://github.com/tree-sitter/tree-sitter-rust) registered for path'repos/rust'Submodule'repos/scala'(https://github.com/tree-sitter/tree-sitter-scala) registered for path'repos/scala'Submodule'repos/swift'(https://github.com/tree-sitter/tree-sitter-swift) registered for path'repos/swift'Submodule'repos/typescript'(https://github.com/tree-sitter/tree-sitter-typescript) registered forpath'repos/typescript'Skippingsubmodule'repos/agda'Skippingsubmodule'repos/bash'Skippingsubmodule'repos/c'Skippingsubmodule'repos/c-sharp'Skippingsubmodule'repos/cpp'Skippingsubmodule'repos/css'Skippingsubmodule'repos/elm'Skippingsubmodule'repos/fluent'Skippingsubmodule'repos/go'Skippingsubmodule'repos/html'Skippingsubmodule'repos/janet-simple'Skippingsubmodule'repos/java'Skippingsubmodule'repos/javascript'Skippingsubmodule'repos/jsdoc'Skippingsubmodule'repos/json'Skippingsubmodule'repos/julia'Skippingsubmodule'repos/ocaml'Skippingsubmodule'repos/php'Skippingsubmodule'repos/python'Skippingsubmodule'repos/ruby'Skippingsubmodule'repos/rust'Skippingsubmodule'repos/scala'Skippingsubmodule'repos/swift'Skippingsubmodule'repos/typescript'
On Tue, Jun 15, 2021 at 5:51 PM brian m. carlson
[off-list ref] wrote:
quoted
On 2021-06-16 at 00:16:06, Rose Kunkel wrote:
quoted
# What did you do before the bug happened? (Steps to reproduce your issue)
1. Clone a git repository that sets `update = none` in .gitmodules:
$ git clone --recurse-submodules https://github.com/ubolonton/tree-sitter-langs
2. Perform a hard reset:
$ cd tree-sitter-langs
$ git reset --hard
# What did you expect to happen? (Expected behavior)
The reset should succeed and do nothing.
I think we're in agreement on this. This should be a fresh clone and so
a hard reset should change nothing.
quoted
# What happened instead? (Actual behavior)
The reset command fails with
Hmmm, I can't reproduce this behavior. What I see is this:
$ git reset --hard
HEAD is now at 5d362ce Release 0.10.0
I'm running git version 2.32.0.272.g935e593368 on Debian sid (with the
experimental packages).
Can you try the clone and run a "git status" command in the repository
to see if anything is modified after your clone? Are the submodules
checked out when you perform the clone? In my case, I see lines like
this:
Skipping submodule 'repos/agda'
If you're seeing something different, then that might contribute to the
different behavior we're seeing.
--
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Thanks for this additional information. This line is the critical
piece. Now I get this:
$ git reset --hard
fatal: not a git repository: ../../.git/modules/repos/agda
fatal: could not reset submodule index
Predictably, "git -c submodules.recurse=true reset --hard" also results
in the same thing.
The --recurse-submodules option for git reset says this (emphasis mine):
When the working tree is updated, using --recurse-submodules will also
recursively reset the working tree of all *active* submodules
according to the commit recorded in the superproject, also setting the
submodules' HEAD to be detached at that commit.
On my system, .git/config has this:
[submodule]
active = .
So these submodules are active, but they probably should not be, since
we haven't checked anything out (or, for that matter, cloned any data)
and it wouldn't make sense to try to operate on them automatically with
submodules.recurse or --recurse-submodules.
My gut tells me that we should probably mark submodules with update=none
set on a clone as inactive. Of course, this is a tricky area that I'm
not super familiar with, so opinions or thoughts are welcome.
If folks think this is a good way forward, I'll look into writing a
patch, probably tomorrow evening since it's starting to get late here.
--
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
From: Rose Kunkel <hidden> Date: 2021-06-16 01:40:08
That sounds reasonable to me.
I do think it's pretty unintuitive that `update = none` means that
submodules never get initialized, even with an explicit `git submodule
init` command. If this is intended behavior, it should be better
documented. If not, fixing that would also fix this bug.
On Tue, Jun 15, 2021 at 6:25 PM brian m. carlson
[off-list ref] wrote:
Thanks for this additional information. This line is the critical
piece. Now I get this:
$ git reset --hard
fatal: not a git repository: ../../.git/modules/repos/agda
fatal: could not reset submodule index
Predictably, "git -c submodules.recurse=true reset --hard" also results
in the same thing.
The --recurse-submodules option for git reset says this (emphasis mine):
When the working tree is updated, using --recurse-submodules will also
recursively reset the working tree of all *active* submodules
according to the commit recorded in the superproject, also setting the
submodules' HEAD to be detached at that commit.
On my system, .git/config has this:
[submodule]
active = .
So these submodules are active, but they probably should not be, since
we haven't checked anything out (or, for that matter, cloned any data)
and it wouldn't make sense to try to operate on them automatically with
submodules.recurse or --recurse-submodules.
My gut tells me that we should probably mark submodules with update=none
set on a clone as inactive. Of course, this is a tricky area that I'm
not super familiar with, so opinions or thoughts are welcome.
If folks think this is a good way forward, I'll look into writing a
patch, probably tomorrow evening since it's starting to get late here.
--
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
From: Rose Kunkel <hidden> Date: 2021-06-16 01:46:37
Actually, nevermind that last comment. I misunderstood what `git
submodule init` does. I thought it cloned missing submodules, but
apparently that's done by `git submodule update`, so the behavior does
make sense.
On Tue, Jun 15, 2021 at 6:39 PM Rose Kunkel [off-list ref] wrote:
That sounds reasonable to me.
I do think it's pretty unintuitive that `update = none` means that
submodules never get initialized, even with an explicit `git submodule
init` command. If this is intended behavior, it should be better
documented. If not, fixing that would also fix this bug.
On Tue, Jun 15, 2021 at 6:25 PM brian m. carlson
[off-list ref] wrote:
Thanks for this additional information. This line is the critical
piece. Now I get this:
$ git reset --hard
fatal: not a git repository: ../../.git/modules/repos/agda
fatal: could not reset submodule index
Predictably, "git -c submodules.recurse=true reset --hard" also results
in the same thing.
The --recurse-submodules option for git reset says this (emphasis mine):
When the working tree is updated, using --recurse-submodules will also
recursively reset the working tree of all *active* submodules
according to the commit recorded in the superproject, also setting the
submodules' HEAD to be detached at that commit.
On my system, .git/config has this:
[submodule]
active = .
So these submodules are active, but they probably should not be, since
we haven't checked anything out (or, for that matter, cloned any data)
and it wouldn't make sense to try to operate on them automatically with
submodules.recurse or --recurse-submodules.
My gut tells me that we should probably mark submodules with update=none
set on a clone as inactive. Of course, this is a tricky area that I'm
not super familiar with, so opinions or thoughts are welcome.
If folks think this is a good way forward, I'll look into writing a
patch, probably tomorrow evening since it's starting to get late here.
--
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA