mirror of
https://github.com/git/git.git
synced 2024-11-17 22:44:49 +01:00
Merge branch 'pb/config' into next
* pb/config: Deprecate usage of git-var -l for getting config vars list git-repo-config --list support
This commit is contained in:
commit
4c2608923f
4 changed files with 23 additions and 6 deletions
|
@ -15,6 +15,7 @@ SYNOPSIS
|
|||
'git-repo-config' [type] --get-all name [value_regex]
|
||||
'git-repo-config' [type] --unset name [value_regex]
|
||||
'git-repo-config' [type] --unset-all name [value_regex]
|
||||
'git-repo-config' -l | --list
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
@ -64,6 +65,9 @@ OPTIONS
|
|||
--unset-all::
|
||||
Remove all matching lines from .git/config.
|
||||
|
||||
-l, --list::
|
||||
List all variables set in .git/config.
|
||||
|
||||
|
||||
EXAMPLE
|
||||
-------
|
||||
|
|
|
@ -19,7 +19,8 @@ OPTIONS
|
|||
-l::
|
||||
Cause the logical variables to be listed. In addition, all the
|
||||
variables of the git configuration file .git/config are listed
|
||||
as well.
|
||||
as well. (However, the configuration variables listing functionality
|
||||
is deprecated in favor of `git-repo-config -l`.)
|
||||
|
||||
EXAMPLE
|
||||
--------
|
||||
|
|
|
@ -171,11 +171,11 @@ sub req_Root
|
|||
return 0;
|
||||
}
|
||||
|
||||
my @gitvars = `git-var -l`;
|
||||
my @gitvars = `git-repo-config -l`;
|
||||
if ($?) {
|
||||
print "E problems executing git-var on the server -- this is not a git repository or the PATH is not set correcly.\n";
|
||||
print "E problems executing git-repo-config on the server -- this is not a git repository or the PATH is not set correcly.\n";
|
||||
print "E \n";
|
||||
print "error 1 - problem executing git-var\n";
|
||||
print "error 1 - problem executing git-repo-config\n";
|
||||
return 0;
|
||||
}
|
||||
foreach my $line ( @gitvars )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <regex.h>
|
||||
|
||||
static const char git_config_set_usage[] =
|
||||
"git-repo-config [ --bool | --int ] [--get | --get-all | --replace-all | --unset | --unset-all] name [value [value_regex]]";
|
||||
"git-repo-config [ --bool | --int ] [--get | --get-all | --replace-all | --unset | --unset-all] name [value [value_regex]] | --list";
|
||||
|
||||
static char* key = NULL;
|
||||
static char* value = NULL;
|
||||
|
@ -12,6 +12,15 @@ static int do_not_match = 0;
|
|||
static int seen = 0;
|
||||
static enum { T_RAW, T_INT, T_BOOL } type = T_RAW;
|
||||
|
||||
static int show_all_config(const char *key_, const char *value_)
|
||||
{
|
||||
if (value_)
|
||||
printf("%s=%s\n", key_, value_);
|
||||
else
|
||||
printf("%s\n", key_);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int show_config(const char* key_, const char* value_)
|
||||
{
|
||||
if (value_ == NULL)
|
||||
|
@ -67,7 +76,7 @@ static int get_value(const char* key_, const char* regex_)
|
|||
}
|
||||
}
|
||||
|
||||
i = git_config(show_config);
|
||||
git_config(show_config);
|
||||
if (value) {
|
||||
printf("%s\n", value);
|
||||
free(value);
|
||||
|
@ -99,6 +108,9 @@ int main(int argc, const char **argv)
|
|||
argv++;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l"))
|
||||
return git_config(show_all_config);
|
||||
|
||||
switch (argc) {
|
||||
case 2:
|
||||
return get_value(argv[1], NULL);
|
||||
|
|
Loading…
Reference in a new issue