{"thread":{"id":"2579","subject":"Add git-config-set, a simple helper for scripts to set config variables","startedAt":"2005-11-17T21:44:55Z","lastAt":"2005-11-17T23:24:57Z","messageCount":3,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"12146","messageId":"Pine.LNX.4.63.0511172244230.18285@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2579","inReplyTo":null,"subject":"Add git-config-set, a simple helper for scripts to set config variables","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-17T21:44:55Z","receivedAt":"2005-11-17T21:44:55Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThis is meant for the end user, who cannot be expected to edit\n.git/config by hand.\n\nExample:\n\n\tgit-config-set core.filemode true\n\nwill set filemode in the section [core] to true,\n\n\tgit-config-set --unset core.filemode\n\nwill remove the entry (failing if it is not there), and\n\n\tgit-config-set --unset diff.twohead ^recar\n\nwill remove the unique entry whose value matches the regex \"^recar\"\n(failing if there is no unique such entry).\n\nIt is just a light wrapper around git_config_set() and\ngit_config_set_multivar().\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\n---\n\n .gitignore   |    1 +\n Makefile     |    3 ++-\n config-set.c |   26 ++++++++++++++++++++++++++\n 3 files changed, 29 insertions(+), 1 deletions(-)\n create mode 100644 config-set.c\n\napplies-to: 8ff699dffc817e92fb2101f538f84c38d5ed0a0f\nacf7869a158171bf4552d0b0da64b20d48e4bf27\ndiff --git a/.gitignore b/.gitignore\nindex 0dd7b9c..d17a8b5 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -17,6 +17,7 @@ git-clone\n git-clone-pack\n git-commit\n git-commit-tree\n+git-config-set\n git-convert-objects\n git-count-objects\n git-cvsexportcommit\ndiff --git a/Makefile b/Makefile\nindex ebff990..8e84e28 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -125,7 +125,8 @@ PROGRAMS = \\\n \tgit-unpack-objects$X git-update-index$X git-update-server-info$X \\\n \tgit-upload-pack$X git-verify-pack$X git-write-tree$X \\\n \tgit-update-ref$X git-symbolic-ref$X git-check-ref-format$X \\\n-\tgit-name-rev$X git-pack-redundant$X git-var$X $(SIMPLE_PROGRAMS)\n+\tgit-name-rev$X git-pack-redundant$X git-config-set$X git-var$X \\\n+\t$(SIMPLE_PROGRAMS)\n \n # Backward compatibility -- to be removed after 1.0\n PROGRAMS += git-ssh-pull$X git-ssh-push$X\ndiff --git a/config-set.c b/config-set.c\nnew file mode 100644\nindex 0000000..1b1547b\n--- /dev/null\n+++ b/config-set.c\n@@ -0,0 +1,26 @@\n+#include \"cache.h\"\n+\n+static const char git_config_set_usage[] =\n+\"git-config-set name [value [value_regex]] | --unset name [value_regex]\";\n+\n+int main(int argc, const char **argv)\n+{\n+\tsetup_git_directory();\n+\tswitch (argc) {\n+\tcase 2:\n+\t\treturn git_config_set(argv[1], NULL);\n+\tcase 3:\n+\t\tif (!strcmp(argv[1], \"--unset\"))\n+\t\t\treturn git_config_set(argv[2], NULL);\n+\t\telse\n+\t\t\treturn git_config_set(argv[1], argv[2]);\n+\tcase 4:\n+\t\tif (!strcmp(argv[1], \"--unset\"))\n+\t\t\treturn git_config_set_multivar(argv[2], NULL, argv[3]);\n+\t\telse\n+\t\t\treturn git_config_set_multivar(argv[1], argv[2], argv[3]);\n+\tdefault:\n+\t\tusage(git_config_set_usage);\n+\t}\n+\treturn 0;\n+}\n---\n0.99.9.GIT\n"},{"id":"12157","messageId":"7vveyqswzx.fsf@assigned-by-dhcp.cox.net","threadId":"2579","inReplyTo":"Pine.LNX.4.63.0511172244230.18285@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Add git-config-set, a simple helper for scripts to set config variables","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-17T22:57:54Z","receivedAt":"2005-11-17T22:57:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> This is meant for the end user, who cannot be expected to edit\n> .git/config by hand.\n>\n> Example:\n>\n> \tgit-config-set core.filemode true\n>\n> will set filemode in the section [core] to true,\n>\n> \tgit-config-set --unset core.filemode\n>\n> will remove the entry (failing if it is not there), and\n>\n> \tgit-config-set --unset diff.twohead ^recar\n>\n> will remove the unique entry whose value matches the regex \"^recar\"\n> (failing if there is no unique such entry).\n\nIt's kinda funny that your users cannot edit a plain text file\nwith an editor, but know how to do regex ;-).\n\nI think the true value of this is that Porcelain scripts can\nmuck with configuration files.\n"},{"id":"12163","messageId":"Pine.LNX.4.63.0511180024130.18775@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2579","inReplyTo":"7vveyqswzx.fsf@assigned-by-dhcp.cox.net","subject":"Re: Add git-config-set, a simple helper for scripts to set config variables","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-17T23:24:57Z","receivedAt":"2005-11-17T23:24:57Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 17 Nov 2005, Junio C Hamano wrote:\n\n> It's kinda funny that your users cannot edit a plain text file\n> with an editor, but know how to do regex ;-).\n\nNo, they can't. But they deem it a cool feature... FDM...\n\nCiao,\nDscho\n"}]}