2 * GIT - The information manager from hell
4 * Copyright (C) Eric Biederman, 2005
8 static const char var_usage
[] = "git-var [-l | <variable>]";
12 const char *(*read
)(int);
14 static struct git_var git_vars
[] = {
15 { "GIT_COMMITTER_IDENT", git_committer_info
},
16 { "GIT_AUTHOR_IDENT", git_author_info
},
20 static void list_vars(void)
23 for(ptr
= git_vars
; ptr
->read
; ptr
++) {
24 printf("%s=%s\n", ptr
->name
, ptr
->read(0));
28 static const char *read_var(const char *var
)
33 for(ptr
= git_vars
; ptr
->read
; ptr
++) {
34 if (strcmp(var
, ptr
->name
) == 0) {
42 static int show_config(const char *var
, const char *value
)
45 printf("%s=%s\n", var
, value
);
48 return git_default_config(var
, value
);
51 int cmd_var(int argc
, char **argv
, const char *prefix
)
60 if (strcmp(argv
[1], "-l") == 0) {
61 git_config(show_config
);
65 git_config(git_default_config
);
66 val
= read_var(argv
[1]);