Commit graph

4 commits

Author SHA1 Message Date
Johannes Schindelin 3dd94e3b2e git-config-set: Properly terminate strings with '\0'
When a lowercase version of the key was generated, it was not
terminated. Strangely enough, it worked on Linux and macosx anyway.
Just cygwin barfed.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 14:04:22 -08:00
Johannes Schindelin f98d863d21 git-config-set: support selecting values by non-matching regex
Extend the regex syntax of value_regex so that prepending an exclamation
mark means non-match:

	[core]
		quetzal = "Dodo" for Brainf*ck
		quetzal = "T. Rex" for Malbolge
		quetzal = "cat"

You can match the third line with

	git-config-set --get quetzal '! for '

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-20 10:53:06 -08:00
Johannes Schindelin 4ddba79db7 git-config-set: add more options
... namely

--replace-all, to replace any amount of matching lines, not just 0 or 1,
--get, to get the value of one key,
--get-all, the multivar version of --get, and
--unset-all, which deletes all matching lines from .git/config

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-19 23:15:07 -08:00
Johannes Schindelin 1b1e59c508 Add git-config-set, a simple helper for scripts to set config variables
This is meant for the end user, who cannot be expected to edit
.git/config by hand.

Example:

	git-config-set core.filemode true

will set filemode in the section [core] to true,

	git-config-set --unset core.filemode

will remove the entry (failing if it is not there), and

	git-config-set --unset diff.twohead ^recar

will remove the unique entry whose value matches the regex "^recar"
(failing if there is no unique such entry).

It is just a light wrapper around git_config_set() and
git_config_set_multivar().

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-19 20:47:29 -08:00