Browse Source
Convert git update-server-info to a built-in command and use parseopt. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint


5 changed files with 28 additions and 29 deletions
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
#include "cache.h" |
||||
#include "builtin.h" |
||||
#include "parse-options.h" |
||||
|
||||
static const char * const update_server_info_usage[] = { |
||||
"git update-server-info [--force]", |
||||
NULL |
||||
}; |
||||
|
||||
int cmd_update_server_info(int argc, const char **argv, const char *prefix) |
||||
{ |
||||
int force = 0; |
||||
struct option options[] = { |
||||
OPT_BOOLEAN('f', "force", &force, |
||||
"update the info files from scratch"), |
||||
OPT_END() |
||||
}; |
||||
|
||||
argc = parse_options(argc, argv, prefix, options, |
||||
update_server_info_usage, 0); |
||||
if (argc > 0) |
||||
usage_with_options(update_server_info_usage, options); |
||||
|
||||
return !!update_server_info(force); |
||||
} |
@ -1,28 +0,0 @@
@@ -1,28 +0,0 @@
|
||||
#include "cache.h" |
||||
#include "exec_cmd.h" |
||||
|
||||
static const char update_server_info_usage[] = |
||||
"git update-server-info [--force]"; |
||||
|
||||
int main(int ac, char **av) |
||||
{ |
||||
int i; |
||||
int force = 0; |
||||
for (i = 1; i < ac; i++) { |
||||
if (av[i][0] == '-') { |
||||
if (!strcmp("--force", av[i]) || |
||||
!strcmp("-f", av[i])) |
||||
force = 1; |
||||
else |
||||
usage(update_server_info_usage); |
||||
} |
||||
} |
||||
if (i != ac) |
||||
usage(update_server_info_usage); |
||||
|
||||
git_extract_argv0_path(av[0]); |
||||
|
||||
setup_git_directory(); |
||||
|
||||
return !!update_server_info(force); |
||||
} |
Loading…
Reference in new issue