{"thread":{"id":"61082","subject":"\"git maintenance start\" adds entry to the main config file, not to already existing maintenance section in included file","startedAt":"2024-03-10T13:12:19Z","lastAt":"2024-04-02T15:27:15Z","messageCount":2,"participants":["Jan Katins","Phillip Wood"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"490321","messageId":"CAP+2wOWvb8Xy5Q_u26FhZrVHazBG0ZCoKnzR8LUKo51f-NXndA@mail.gmail.com","threadId":"61082","inReplyTo":null,"subject":"\"git maintenance start\" adds entry to the main config file, not to already existing maintenance section in included file","fromName":"Jan Katins","fromEmail":"jasc@gmx.net","sentAt":"2024-03-10T13:12:05Z","receivedAt":"2024-03-10T13:12:19Z","isPatch":false,"sender":{"key":"jasc@gmx.net","avatar":null},"body":"Hello!\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\nI've a git config (in ~/.config/git/config) which reads:\n\n```ini\n...\n[include]\n    path = git_config_local_maintenance\n....\n```\n\nIn ~/.config/git/git_config_local_maintenance I have:\n\n```ini\n[maintenance]\n    repo =/User/jankatins/projects/whatever\n```\n\nran `git maintenance start` in a new repo.\n\nWhat did you expect to happen? (Expected behavior)\n\nThat the new repo gets appended in\n~/.config/git/git_config_local_maintenance to the already existing\nmaintenance section.\n\nWhat happened instead? (Actual behavior)\n\nAn additional maintenance section was added in the main config file\nwith the repo key added there.\n\nWhat's different between what you expected and what actually happened?\n\nThe additional maintenance section in the main config file instead of\nappending the repo in the already existing section in the included\nfile.\n\nThis is \"undesired\", as I have my main git config file in a dotfile\nmanager, but don't want to have the (much more frequently changing and\nlaptop specific) maintenance entries in the dotfile repo.\n\n```\n[System Info]\ngit version: git version 2.44.0\ncpu: x86_64\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Darwin 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:31\nPST 2024; root:xnu-10063.101.15~2/RELEASE_X86_64 x86_64\ncompiler info: clang: 15.0.0 (clang-1500.1.0.2.5)\nlibc info: no libc information available\n$SHELL (typically, interactive shell): /usr/local/bin/zsh\n```\n\nKind regards\n\nJan\n--\njasc@gmx.net\n"},{"id":"492062","messageId":"460e41d1-0680-4e23-93a7-5134b48eedd0@gmail.com","threadId":"61082","inReplyTo":"CAP+2wOWvb8Xy5Q_u26FhZrVHazBG0ZCoKnzR8LUKo51f-NXndA@mail.gmail.com","subject":"Re: \"git maintenance start\" adds entry to the main config file, not to already existing maintenance section in included file","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2024-04-02T15:27:11Z","receivedAt":"2024-04-02T15:27:15Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Jan\n\nSorry for the slow response, unfortunately the main contributor to \"git \nmaintenance\" changed jobs last year.\n\nOn 10/03/2024 13:12, Jan Katins wrote:\n> Hello!\n> \n> What did you do before the bug happened? (Steps to reproduce your issue)\n> \n> I've a git config (in ~/.config/git/config) which reads:\n> \n> ```ini\n> ...\n> [include]\n>      path = git_config_local_maintenance\n> ....\n> ```\n> \n> In ~/.config/git/git_config_local_maintenance I have:\n> \n> ```ini\n> [maintenance]\n>      repo =/User/jankatins/projects/whatever\n> ```\n> \n> ran `git maintenance start` in a new repo.\n> \n> What did you expect to happen? (Expected behavior)\n> \n> That the new repo gets appended in\n> ~/.config/git/git_config_local_maintenance to the already existing\n> maintenance section.\n> \n> What happened instead? (Actual behavior)\n> \n> An additional maintenance section was added in the main config file\n> with the repo key added there.\n\n\"git maintenance start\" always uses the user's global config file, \"git \nmaintenance register\" has a \"--config-file\" option which would allow you \nto use a separate file which we should add to \"git maintenance start\". \n\"git maintenance\" is a bit of a special case as it must use the global \nconfig file so that \"git maintenance run\" can find the list of \nrepositories no matter which directory it is started in. Having said \nthat I'm not sure what guarantees the config system normally makes when \nadding a new key to a existing config section.\n\nI can see this frustrating, I'd recommend using \"git maintenance \nregister --config-file\" when adding new repositories - you only need to \nrun \"git maintenance start\" once to enable maintenance, not for each new \nrepository.\n\nBest Wishes\n\nPhillip\n\n> What's different between what you expected and what actually happened?\n> \n> The additional maintenance section in the main config file instead of\n> appending the repo in the already existing section in the included\n> file.\n> \n> This is \"undesired\", as I have my main git config file in a dotfile\n> manager, but don't want to have the (much more frequently changing and\n> laptop specific) maintenance entries in the dotfile repo.\n> \n> ```\n> [System Info]\n> git version: git version 2.44.0\n> cpu: x86_64\n> sizeof-long: 8\n> sizeof-size_t: 8\n> shell-path: /bin/sh\n> feature: fsmonitor--daemon\n> uname: Darwin 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:31\n> PST 2024; root:xnu-10063.101.15~2/RELEASE_X86_64 x86_64\n> compiler info: clang: 15.0.0 (clang-1500.1.0.2.5)\n> libc info: no libc information available\n> $SHELL (typically, interactive shell): /usr/local/bin/zsh\n> ```\n> \n> Kind regards\n> \n> Jan\n> --\n> jasc@gmx.net\n> \n"}]}