{"thread":{"id":"54975","subject":"Fwd: error: 'submodule' does not have a commit checked out","startedAt":"2021-01-11T14:48:35Z","lastAt":"2021-01-11T15:37:09Z","messageCount":2,"participants":["Aleksey Midenkov","Philippe Blain"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"414047","messageId":"CAF8BazDLhgtgt1jCD7B64ytguF-NYL60nDS9F8nxbRhhbfX7Cg@mail.gmail.com","threadId":"54975","inReplyTo":"CAF8BazC1kEV+s7vDSAkqcvjYVTCyDaw8gi0ZHpH7K+3Q4CAczA@mail.gmail.com","subject":"Fwd: error: 'submodule' does not have a commit checked out","fromName":"Aleksey Midenkov","fromEmail":"midenok@gmail.com","sentAt":"2021-01-11T14:44:43Z","receivedAt":"2021-01-11T14:48:35Z","isPatch":false,"sender":{"key":"midenok@gmail.com","avatar":null},"body":"I used to update last commit with new changes:\n\ngit commit --amend .\n\nThe project has several submodules:\n\n e116c89a58af750421d82ece13f80516d2bde02e extra/wolfssl/wolfssl\n(v4.3.0-stable-596-ge116c89a5)\na746c3af449a8754e78ad7971e59e79af7957cdb libmariadb (v3.1.3-121-ga746c3a)\nb6b02ed516f92055127d416370799d91a82754ea\nstorage/columnstore/columnstore (columnstore-1.5.3-1-14-gb6b02ed5)\n-d172e86c16224b4e0229ca6f102e662a2315aeff storage/maria/libmarias3\n-bba5e7bc21093d7cfa765e1280a7c4fdcd284288 storage/rocksdb/rocksdb\n-ae4e58ba031587039c8830f2f8ca51fa9fb7d6eb wsrep-lib\n\nNow it fails with this message:\n\ngit commit --amend .\nerror: 'storage/maria/libmarias3' does not have a commit checked out\nfatal: updating files failed\n\nHow to use amend without specifying explicit paths without\ninitializing submodules? I don't need to amend submodules and would\nprefer them ignored in my commits.\n\ngit --version\ngit version 2.27.0\n\nWorks as expected in 2.19.1\n\n--\nAll the best,\n\nAleksey Midenkov\n@midenok\n"},{"id":"414055","messageId":"f8443c4c-2a1a-0f58-1086-9d19ae447074@gmail.com","threadId":"54975","inReplyTo":"CAF8BazDLhgtgt1jCD7B64ytguF-NYL60nDS9F8nxbRhhbfX7Cg@mail.gmail.com","subject":"Re: Fwd: error: 'submodule' does not have a commit checked out","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2021-01-11T15:36:23Z","receivedAt":"2021-01-11T15:37:09Z","isPatch":false,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Aleksey,\n\nLe 2021-01-11 à 09:44, Aleksey Midenkov a écrit :\n> I used to update last commit with new changes:\n> \n> git commit --amend .\n> \n> The project has several submodules:\n> \n>   e116c89a58af750421d82ece13f80516d2bde02e extra/wolfssl/wolfssl\n> (v4.3.0-stable-596-ge116c89a5)\n> a746c3af449a8754e78ad7971e59e79af7957cdb libmariadb (v3.1.3-121-ga746c3a)\n> b6b02ed516f92055127d416370799d91a82754ea\n> storage/columnstore/columnstore (columnstore-1.5.3-1-14-gb6b02ed5)\n> -d172e86c16224b4e0229ca6f102e662a2315aeff storage/maria/libmarias3\n> -bba5e7bc21093d7cfa765e1280a7c4fdcd284288 storage/rocksdb/rocksdb\n> -ae4e58ba031587039c8830f2f8ca51fa9fb7d6eb wsrep-lib\n> \n> Now it fails with this message:\n> \n> git commit --amend .\n> error: 'storage/maria/libmarias3' does not have a commit checked out\n> fatal: updating files failed\n> \n> How to use amend without specifying explicit paths without\n> initializing submodules? I don't need to amend submodules and would\n> prefer them ignored in my commits.\n> \n> git --version\n> git version 2.27.0\n> \n> Works as expected in 2.19.1\n\n\nI can reproduce the behaviour. It was introduced in f937bc2f86\n(add: error appropriately on repository with no commits, 2019-04-09),\nin Git 2.22. I think that commit and the rest of that topic,\n4ab701b2ee (Merge branch 'km/empty-repo-is-still-a-repo', 2019-05-09),\nare sound.\n\nFor your use case, if you want to amend the latest commit and include\nchanges from all tracked files, you can simply do\n\n     git commit --amend --all\n\nor shorter:\n\n     git commit --amend -a\n\nThe only difference with what I think you wanted to achieve is that\nany *new* files will not be added by '-a', only changes to already tracked\nfiles are included. If you have new files that you also want included, then\nyou would need to 'git add' them separately.\n\nReading the doc for 'git commit' [1], it appears that\n\n     git commit --amend --only\n\nwould also work if you want to only include changes to files that were\nalready modified in the commit you are amending. I haven't testes that\nthough.\n\nHope that helps,\n\nPhilippe.\n\n\n[1] https://git-scm.com/docs/git-commit\n"}]}