{"thread":{"id":"64152","subject":"[QUESTION] how to find options set by scalar?","startedAt":"2025-09-16T06:21:25Z","lastAt":"2025-10-19T17:43:42Z","messageCount":8,"participants":["Matthew Hughes","Patrick Steinhardt","Junio C Hamano","Derrick Stolee"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"526420","messageId":"vppjutjcdglp44qvsk4qozphycyg663yrq5775zztim2oe7ty5@uttjrshb52bd","threadId":"64152","inReplyTo":null,"subject":"[QUESTION] how to find options set by scalar?","fromName":"Matthew Hughes","fromEmail":"matthewhughes934@gmail.com","sentAt":"2025-09-16T06:21:21Z","receivedAt":"2025-09-16T06:21:25Z","isPatch":false,"sender":{"key":"matthewhughes934@gmail.com","avatar":"https://avatars.githubusercontent.com/u/34972397?v=4"},"body":"Hi,\n\nI'm wondering about making the config options set by `scalar register` a bit\nmore discoverable.\n\nBackground: I was recently working in a large repo that recommended I run\n`scalar register` to help make git run a bit more smoothly, and I did (and\ndidn't think much of it and forgot about it). It was a couple of weeks later I\nwas again working in this repo and wanted to update my config, but was a bit\nconfused when I saw a bunch of things set that I didn't remember setting, e.g.\n'status.aheadBehind false'. It took me remembering that I had run `scalar\nregister` and some poking around the code to discover where these options had\ncome from.\n\nI'm not sure if this is something best addressed by documentation, or maybe by\n`scalar register` adding comments to the config lines it changes?\n\nThanks,\nMatt\n"},{"id":"526426","messageId":"aMkVqNbdgxqBJ9K4@pks.im","threadId":"64152","inReplyTo":"vppjutjcdglp44qvsk4qozphycyg663yrq5775zztim2oe7ty5@uttjrshb52bd","subject":"Re: [QUESTION] how to find options set by scalar?","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-09-16T07:45:44Z","receivedAt":"2025-09-16T07:45:55Z","isPatch":false,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Tue, Sep 16, 2025 at 07:21:21AM +0100, Matthew Hughes wrote:\n> Hi,\n> \n> I'm wondering about making the config options set by `scalar register` a bit\n> more discoverable.\n> \n> Background: I was recently working in a large repo that recommended I run\n> `scalar register` to help make git run a bit more smoothly, and I did (and\n> didn't think much of it and forgot about it). It was a couple of weeks later I\n> was again working in this repo and wanted to update my config, but was a bit\n> confused when I saw a bunch of things set that I didn't remember setting, e.g.\n> 'status.aheadBehind false'. It took me remembering that I had run `scalar\n> register` and some poking around the code to discover where these options had\n> come from.\n> \n> I'm not sure if this is something best addressed by documentation, or maybe by\n> `scalar register` adding comments to the config lines it changes?\n\nI think documentation wouldn't help much -- the config entries we set\nmay change over time, so at the point in time where the user reads the\ndocumentation it may already list entries that we either don't set at\nall anymore or that we started setting now. So these config entries that\nscalar(1) did set and the config entries that its man page claims to set\nwill diverge over time.\n\nBut doing this via comments may be viable indeed. A start for such a\nchange could be the following patch, which causes us to write a comment\n\"# set by scalar\" after every config that we set in the repository:\n\ndiff --git a/scalar.c b/scalar.c\nindex 4a373c133d..c69ec57374 100644\n--- a/scalar.c\n+++ b/scalar.c\n@@ -8,6 +8,7 @@\n #include \"abspath.h\"\n #include \"gettext.h\"\n #include \"parse-options.h\"\n+#include \"path.h\"\n #include \"config.h\"\n #include \"run-command.h\"\n #include \"simple-ipc.h\"\n@@ -102,8 +103,11 @@ static int set_scalar_config(const struct scalar_config *config, int reconfigure\n \n \tif ((reconfigure && config->overwrite_on_reconfigure) ||\n \t    repo_config_get_string(the_repository, config->key, &value)) {\n+\t\tchar *file = repo_git_path(the_repository, \"config\");\n \t\ttrace2_data_string(\"scalar\", the_repository, config->key, \"created\");\n-\t\tres = repo_config_set_gently(the_repository, config->key, config->value);\n+\t\tres = repo_config_set_multivar_in_file_gently(the_repository, file, config->key,\n+\t\t\t\t\t\t\t      config->value, NULL, \" # set by scalar\", 0);\n+\t\tfree(file);\n \t} else {\n \t\ttrace2_data_string(\"scalar\", the_repository, config->key, \"exists\");\n \t\tres = 0;\n\nWith that change in place, a (subset of) \".git/config\" file would look\nlike this:\n\n    [extensions]\n        refstorage = reftable\n    [core]\n        repositoryformatversion = 1\n        filemode = true\n        bare = false\n        logallrefupdates = true\n        FSCache = true # set by scalar\n        multiPackIndex = true # set by scalar\n        preloadIndex = true # set by scalar\n        untrackedCache = true # set by scalar\n        autoCRLF = false # set by scalar\n        safeCRLF = false # set by scalar\n    [am]\n        keepCR = true # set by scalar\n\nWhich I think is quite helpful overall. This cannot grow stale over time\nand it's immediately obvious which entries have been set up by scalar in\ncase the user wants to drop them again.\n\nCc'ing Stolee, the primary author of scalar(1).\n\nPatrick\n"},{"id":"526719","messageId":"evxbvwwyo4p4iboc4k6r2cd2cvlnm2upgxumqopdijwmvhxhxs@7xvg42heibp3","threadId":"64152","inReplyTo":"aMkVqNbdgxqBJ9K4@pks.im","subject":"Re: [QUESTION] how to find options set by scalar?","fromName":"Matthew Hughes","fromEmail":"matthewhughes934@gmail.com","sentAt":"2025-09-18T19:32:37Z","receivedAt":"2025-09-18T19:32:42Z","isPatch":false,"sender":{"key":"matthewhughes934@gmail.com","avatar":"https://avatars.githubusercontent.com/u/34972397?v=4"},"body":"> But doing this via comments may be viable indeed. A start for such a\n> change could be the following patch, which causes us to write a comment\n> \"# set by scalar\" after every config that we set in the repository:\n\nAgreed, I think this would be very helpful to have! I'd be happy to submit a\npatch.\n\nI was also looking through the list of config options (within\n`set_recommended_config`) and thought it might also be useful to comment why\neach those settings are recommended in the context of working within a large\nrepository. These comments would just be in-line in the code for those curious\nenough (I think it would be a bit noisy for general use as comments within the\nconfig itself) I might dig a bit into the history here, from what I understand\nit started as a separated project[1] before being added to `git-for-windows`[2]\nbefore being merged into `git/git`, are there any other bits I missed?\n\nI see there may be some relics from the history that may not be generally\napplicable, e.g. setting `credential.https://dev.azure.com.useHttpPath`.\n\nLink: https://github.com/microsoft/scalar [1]\nLink: https://github.com/git-for-windows/git [2]\n"},{"id":"526724","messageId":"xmqqikhf7bdf.fsf@gitster.g","threadId":"64152","inReplyTo":"evxbvwwyo4p4iboc4k6r2cd2cvlnm2upgxumqopdijwmvhxhxs@7xvg42heibp3","subject":"Re: [QUESTION] how to find options set by scalar?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-09-18T20:29:32Z","receivedAt":"2025-09-18T20:29:34Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthew Hughes <matthewhughes934@gmail.com> writes:\n\n> I was also looking through the list of config options (within\n> `set_recommended_config`) and thought it might also be useful to comment why\n> each those settings are recommended in the context of working within a large\n> repository.\n\nThat would be ultra useful.\n"},{"id":"526786","messageId":"08deb8a8-6c34-4f11-a36b-93d151a56f9b@gmail.com","threadId":"64152","inReplyTo":"xmqqikhf7bdf.fsf@gitster.g","subject":"Re: [QUESTION] how to find options set by scalar?","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2025-09-19T15:38:50Z","receivedAt":"2025-09-19T15:38:52Z","isPatch":false,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 9/18/2025 4:29 PM, Junio C Hamano wrote:\n> Matthew Hughes <matthewhughes934@gmail.com> writes:\n> \n>> I was also looking through the list of config options (within\n>> `set_recommended_config`) and thought it might also be useful to comment why\n>> each those settings are recommended in the context of working within a large\n>> repository.\n> \n> That would be ultra useful.\n\nI think all of these ideas are good ones. Adding the comment as Patrick\ndescribed is good, for sure.\n\nInstead of commenting the _reason_ in code or in the config, it would be\ngood to list the reasons for each recommended config in the Scalar docs\nso they would be visible in web docs [1] for easy discovery.\n\n[1] https://git-scm.com/docs/scalar\n\nIt seems like Patrick is already 80% of the way to a patch for the\ncomment in the config. I'll see if I can carve out some time next week\nfor the commentary on the config options in the Documentation.\n\nThanks,\n-Stolee\n\n"},{"id":"526913","messageId":"aNDqnMTJIoHi7Ifc@pks.im","threadId":"64152","inReplyTo":"08deb8a8-6c34-4f11-a36b-93d151a56f9b@gmail.com","subject":"Re: [QUESTION] how to find options set by scalar?","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-09-22T06:20:12Z","receivedAt":"2025-09-22T06:20:26Z","isPatch":false,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Fri, Sep 19, 2025 at 11:38:50AM -0400, Derrick Stolee wrote:\n> On 9/18/2025 4:29 PM, Junio C Hamano wrote:\n> > Matthew Hughes <matthewhughes934@gmail.com> writes:\n> > \n> >> I was also looking through the list of config options (within\n> >> `set_recommended_config`) and thought it might also be useful to comment why\n> >> each those settings are recommended in the context of working within a large\n> >> repository.\n> > \n> > That would be ultra useful.\n> \n> I think all of these ideas are good ones. Adding the comment as Patrick\n> described is good, for sure.\n> \n> Instead of commenting the _reason_ in code or in the config, it would be\n> good to list the reasons for each recommended config in the Scalar docs\n> so they would be visible in web docs [1] for easy discovery.\n> \n> [1] https://git-scm.com/docs/scalar\n> \n> It seems like Patrick is already 80% of the way to a patch for the\n> comment in the config. I'll see if I can carve out some time next week\n> for the commentary on the config options in the Documentation.\n\nAgreed, that seems like a good compromise: we note in the config the\nvalues that were set by scalar(1), but the more verbose justification\nwould be part of the docs.\n\nI'm a bit stretched right now, so if you want to work on this please\nfeel free to just pick my patch and iterate on it.\n\nThanks!\n\nPatrick\n"},{"id":"526936","messageId":"ffa61066-7004-48dd-9096-85b305373bc7@gmail.com","threadId":"64152","inReplyTo":"aNDqnMTJIoHi7Ifc@pks.im","subject":"Re: [QUESTION] how to find options set by scalar?","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2025-09-22T13:36:00Z","receivedAt":"2025-09-22T13:36:02Z","isPatch":false,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 9/22/2025 2:20 AM, Patrick Steinhardt wrote:\n> On Fri, Sep 19, 2025 at 11:38:50AM -0400, Derrick Stolee wrote:\n>> On 9/18/2025 4:29 PM, Junio C Hamano wrote:\n>>> Matthew Hughes <matthewhughes934@gmail.com> writes:\n>>>\n>>>> I was also looking through the list of config options (within\n>>>> `set_recommended_config`) and thought it might also be useful to comment why\n>>>> each those settings are recommended in the context of working within a large\n>>>> repository.\n>>>\n>>> That would be ultra useful.\n>>\n>> I think all of these ideas are good ones. Adding the comment as Patrick\n>> described is good, for sure.\n>>\n>> Instead of commenting the _reason_ in code or in the config, it would be\n>> good to list the reasons for each recommended config in the Scalar docs\n>> so they would be visible in web docs [1] for easy discovery.\n>>\n>> [1] https://git-scm.com/docs/scalar\n>>\n>> It seems like Patrick is already 80% of the way to a patch for the\n>> comment in the config. I'll see if I can carve out some time next week\n>> for the commentary on the config options in the Documentation.\n> \n> Agreed, that seems like a good compromise: we note in the config the\n> values that were set by scalar(1), but the more verbose justification\n> would be part of the docs.\n> \n> I'm a bit stretched right now, so if you want to work on this please\n> feel free to just pick my patch and iterate on it.\n\nMakes sense. I'll pick up your patch into my series as I prepare it.\n\nThanks,\n-Stolee\n\n"},{"id":"529152","messageId":"wn3jjekjibcxbuiieji5umijvx5gaesg7wpwnivc5ng66sqpa7@cybj6wtz2eq5","threadId":"64152","inReplyTo":"ffa61066-7004-48dd-9096-85b305373bc7@gmail.com","subject":"Re: [QUESTION] how to find options set by scalar?","fromName":"Matthew Hughes","fromEmail":"matthewhughes934@gmail.com","sentAt":"2025-10-19T17:43:38Z","receivedAt":"2025-10-19T17:43:42Z","isPatch":false,"sender":{"key":"matthewhughes934@gmail.com","avatar":"https://avatars.githubusercontent.com/u/34972397?v=4"},"body":"On Mon, Sep 22, 2025 at 09:36:00AM -0400, Derrick Stolee wrote:\n> Makes sense. I'll pick up your patch into my series as I prepare it.\n\nI'm not sure if you had a chance to start working on this (I didn't see any\nother activity around this on the mailing list, but shout-out if I missed\nsomething!). But I got curious and started looking into some of the options and\nhad some questions (I haven't do much archaeology on the original Scalar\nrepo[1], so if I should just go dig around there for more answers let me know).\n\nFirstly, there are a couple of options specific to things outside this repo:\n\n* core.FSCache: specific for git-for-windows[2]\n* credential.validate: specific to Git-Credential-Manager-for-Windows[3]\n\nCould these possibly be removed from here (I understand scalar started as an\nexternal project, so these are perhaps a relic of that)?\n\nSecondly, I was curious around some of the CRLF options, in particular, setting:\n\n* am.keepCR=true\n* core.autoCRLF=false\n* core.safeCRLF=false\n\nIs there a non-trival cost to doing conversions over a large enough number of\nfiles?\n\nGC bits: I there is some GC automation disabled:\n\n* gc.auto=0\n* gui.GCWwarning=false\n* receive.autoGC=false\n\nWhat's the reason for this? Is garbage collection expected to be unreasonably\nslow in a large repo? Is it worth the GC still being run at least occasionally\nin a large repo?\n\nIndex bits: scalar will set index.threads=true, index.version=4: I assume these\nare expected to just speed up most read operations on in the index in general?\nIt also disable index.skipHash: the docs tells me this speeds up commands\nthat manipulate the index, but I was wondering if having this trailing hash can\nmake future _reads_ more efficient?\n\nAnd more generally, I'm not sure I understand the reasons for the following\nsettings in the context of a large repo:\n\n* pack.useBitmaps=false\n* fetch.writeCommitGraph=false\n* status.aheadBehind=false\n* merge.stat=false\n* commitGraph.generationVersion=false \n* fetch.showForcedUpdates=false\n\nLink: https://github.com/microsoft/scalar [1]\nLink: https://github.com/git-for-windows [2]\nLink: https://github.com/microsoft/Git-Credential-Manager-for-Windows [3]\n\nThanks,\nMatt\n"}]}