]>
git.ipfire.org Git - thirdparty/git.git/blob - var.c
2 * GIT - The information manager from hell
4 * Copyright (C) Eric Biederman, 2005
11 static const char var_usage
[] = "git-var [-l | <variable>]";
15 const char *(*read
)(void);
17 static struct git_var git_vars
[] = {
18 { "GIT_COMMITTER_IDENT", git_committer_info
},
19 { "GIT_AUTHOR_IDENT", git_author_info
},
23 static void list_vars(void)
26 for(ptr
= git_vars
; ptr
->read
; ptr
++) {
27 printf("%s=%s\n", ptr
->name
, ptr
->read());
31 static const char *read_var(const char *var
)
36 for(ptr
= git_vars
; ptr
->read
; ptr
++) {
37 if (strcmp(var
, ptr
->name
) == 0) {
45 static int show_config(const char *var
, const char *value
)
48 printf("%s=%s\n", var
, value
);
51 return git_default_config(var
, value
);
54 int main(int argc
, char **argv
)
61 setup_git_directory();
65 if (strcmp(argv
[1], "-l") == 0) {
66 git_config(show_config
);
70 git_config(git_default_config
);
71 val
= read_var(argv
[1]);