Message ID | pull.1101.v6.git.1644269583.gitgitgadget@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | Sparse checkout: fix bug with worktree of bare repo | expand |
On Mon, Feb 7, 2022 at 1:33 PM Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com> wrote: > > This series is now based on v2.35.0 since that contains all of the necessary > topics. > > This patch series includes a fix to the bug reported by Sean Allred [1] and > diagnosed by Eric Sunshine [2]. > > The root cause is that 'git sparse-checkout init' writes to the worktree > config without checking that core.bare or core.worktree are set in the > common config file. This series fixes this, but also puts in place some > helpers to prevent this from happening in the future. > > ATTENTION: I have significantly redesigned the series since previous > versions, so most of this cover letter is new. > > * Patch 1 updates documentation around extensions.worktreeConfig in a few > places to improve discoverability. Several cross links are added to make > it easy to find the related areas. (The documentation for the changes to > 'git sparse-checkout' are delayed to patch 4.) > > * Patch 2 introduces the init_worktree_config() helper which follows the > documented instructions to enable extensions.worktreeConfig as well as > move the core.bare and core.worktree config values. This update does not > modify core.repositoryFormatVersion, since this is not needed > specifically for extensions.worktreeConfig. > > * Patch 3 adds a new repo_config_set_worktree_gently() helper method so we > can internally adjust a config value within a worktree, at least if > extensions.worktreeConfig is enabled. (It will write to the common config > file if the extension is not enabled.) > > * Patch 4 modifies the sparse-checkout builtin to use > init_worktree_config() and repo_config_set_worktree_gently() in ways that > fix the reported bug. The behavior change here is that it will no longer > upgrade the repository format version, since that is not needed for > extensions.worktreeConfig. > > * Patch 5 updates 'git worktree add' to copy the worktree config from the > current worktree to the new one (while unsetting core.bare=true and > core.worktree=*) along with copying the sparse-checkout patterns file. > > [1] > https://lore.kernel.org/git/CABceR4bZmtC4rCwgxZ1BBYZP69VOUca1f_moJoP989vTUZWu9Q@mail.gmail.com/ > [2] > https://lore.kernel.org/git/CAPig+cQ6U_yFw-X2OWrizB1rbCvc4bNxuSzKFzmoLNnm0GH8Eg@mail.gmail.com/ > > > Updates in v6 > ============= > > * Updated documentation to use "working tree" over "worktree" and "" over > "" Not sure what "" over "" means. > * Delay some allocations to avoid leaking memory in error conditions. > * Use "main worktree" over "base worktree" in comments. > * Was the empty bullet point meant to cover the new patch 6? Anyway, comments on the cover letter aside, the patches themselves are: Reviewed-by: Elijah Newren <newren@gmail.com>
On Mon, Feb 7, 2022 at 11:14 PM Elijah Newren <newren@gmail.com> wrote: > On Mon, Feb 7, 2022 at 1:33 PM Derrick Stolee via GitGitGadget > <gitgitgadget@gmail.com> wrote: > > Updates in v6 > > * Updated documentation to use "working tree" over "worktree" and "" over > > "" > > Not sure what "" over "" means. Probably related to my review comment[1] about spelling it "$GIT_DIR/worktrees/<id>/" rather than "$GIT_DIR/worktrees/<worktree-name>/". > > * Delay some allocations to avoid leaking memory in error conditions. > > * Use "main worktree" over "base worktree" in comments. > > * > > Was the empty bullet point meant to cover the new patch 6? The "Updates in v6" section was botched a bit. If you look closely, the remaining bullet points actually ended up in the "Updates in v5" section. The complete "Updates in v6" section should have been (approximately): * Updated documentation to use "working tree" over "worktree" and "<id>" over "<worktree-name>" * Delay some allocations to avoid leaking memory in error conditions. * Use "main worktree" over "base worktree" in comments. * Removed use of git_configset_get_string_tmp() and added a patch that removes its public declaration. * Fragile variables are replaced with better ones. * Variable names and code style improved. * Several test cleanups in patch 5. [1]: https://lore.kernel.org/git/pull.1101.v4.git.1643136134.gitgitgadget@gmail.com/T/#m4926177771017bbea82c33e9e03e6a9a004ebf24
On Mon, Feb 7, 2022 at 9:03 PM Eric Sunshine <sunshine@sunshineco.com> wrote: > > On Mon, Feb 7, 2022 at 11:14 PM Elijah Newren <newren@gmail.com> wrote: > > On Mon, Feb 7, 2022 at 1:33 PM Derrick Stolee via GitGitGadget > > <gitgitgadget@gmail.com> wrote: > > > Updates in v6 > > > * Updated documentation to use "working tree" over "worktree" and "" over > > > "" > > > > Not sure what "" over "" means. > > Probably related to my review comment[1] about spelling it > "$GIT_DIR/worktrees/<id>/" rather than > "$GIT_DIR/worktrees/<worktree-name>/". > > > > * Delay some allocations to avoid leaking memory in error conditions. > > > * Use "main worktree" over "base worktree" in comments. > > > * > > > > Was the empty bullet point meant to cover the new patch 6? > > The "Updates in v6" section was botched a bit. If you look closely, > the remaining bullet points actually ended up in the "Updates in v5" > section. The complete "Updates in v6" section should have been > (approximately): > > * Updated documentation to use "working tree" over "worktree" and > "<id>" over "<worktree-name>" > * Delay some allocations to avoid leaking memory in error conditions. > * Use "main worktree" over "base worktree" in comments. > * Removed use of git_configset_get_string_tmp() and added a patch that > removes its public declaration. > * Fragile variables are replaced with better ones. > * Variable names and code style improved. > * Several test cleanups in patch 5. > > [1]: https://lore.kernel.org/git/pull.1101.v4.git.1643136134.gitgitgadget@gmail.com/T/#m4926177771017bbea82c33e9e03e6a9a004ebf24 So, you clearly also read the patches in this round. Do they also look good to you? :-)
On Tue, Feb 8, 2022 at 12:18 AM Elijah Newren <newren@gmail.com> wrote: > On Mon, Feb 7, 2022 at 9:03 PM Eric Sunshine <sunshine@sunshineco.com> wrote: > > On Mon, Feb 7, 2022 at 11:14 PM Elijah Newren <newren@gmail.com> wrote: > > > Was the empty bullet point meant to cover the new patch 6? > > > > The "Updates in v6" section was botched a bit. If you look closely, > > the remaining bullet points actually ended up in the "Updates in v5" > > section. The complete "Updates in v6" section should have been > > (approximately): > > > > * Updated documentation to use "working tree" over "worktree" and > > "<id>" over "<worktree-name>" > > * Delay some allocations to avoid leaking memory in error conditions. > > * Use "main worktree" over "base worktree" in comments. > > * Removed use of git_configset_get_string_tmp() and added a patch that > > removes its public declaration. > > * Fragile variables are replaced with better ones. > > * Variable names and code style improved. > > * Several test cleanups in patch 5. > > So, you clearly also read the patches in this round. Do they also > look good to you? :-) I have not yet looked at either the patches or the range-diff, and I only scanned my eye quickly over the cover letter, but the empty bullet point made me stop and look a bit more carefully at that part (and only that part) of the cover letter. Not sure yet when I'll have time to carefully read this round.
On 2/8/2022 12:02 AM, Eric Sunshine wrote: > On Mon, Feb 7, 2022 at 11:14 PM Elijah Newren <newren@gmail.com> wrote: >> On Mon, Feb 7, 2022 at 1:33 PM Derrick Stolee via GitGitGadget >> <gitgitgadget@gmail.com> wrote: >>> Updates in v6 >>> * Updated documentation to use "working tree" over "worktree" and "" over >>> "" >> >> Not sure what "" over "" means. > > Probably related to my review comment[1] about spelling it > "$GIT_DIR/worktrees/<id>/" rather than > "$GIT_DIR/worktrees/<worktree-name>/". > >>> * Delay some allocations to avoid leaking memory in error conditions. >>> * Use "main worktree" over "base worktree" in comments. >>> * >> >> Was the empty bullet point meant to cover the new patch 6? > > The "Updates in v6" section was botched a bit. If you look closely, > the remaining bullet points actually ended up in the "Updates in v5" > section. The complete "Updates in v6" section should have been > (approximately): Whoops on mixing them up. Sorry about that. > * Updated documentation to use "working tree" over "worktree" and > "<id>" over "<worktree-name>" this is the issue for the empty quotes. GGG thought these were HTML tags, so made them disappear. I should have used `<id>` and `<worktree-name>`. > * Delay some allocations to avoid leaking memory in error conditions. > * Use "main worktree" over "base worktree" in comments. > * Removed use of git_configset_get_string_tmp() and added a patch that > removes its public declaration. > * Fragile variables are replaced with better ones. > * Variable names and code style improved. > * Several test cleanups in patch 5. > > [1]: https://lore.kernel.org/git/pull.1101.v4.git.1643136134.gitgitgadget@gmail.com/T/#m4926177771017bbea82c33e9e03e6a9a004ebf24 Thanks for cleaning up my cover letter! -Stolee
On Tue, Feb 8, 2022 at 12:42 AM Eric Sunshine <sunshine@sunshineco.com> wrote: > On Tue, Feb 8, 2022 at 12:18 AM Elijah Newren <newren@gmail.com> wrote: > > So, you clearly also read the patches in this round. Do they also > > look good to you? :-) > > I have not yet looked at either the patches or the range-diff, and I > only scanned my eye quickly over the cover letter, but the empty > bullet point made me stop and look a bit more carefully at that part > (and only that part) of the cover letter. Not sure yet when I'll have > time to carefully read this round. I've now read through the series and, I think, left only one or two minor not-actionable comments.