Skip to content

Commit 53a1116

Browse files
René Scharfegitster
authored andcommitted
update-server-info: make builtin, use parseopt
Convert git update-server-info to a built-in command and use parseopt. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d17982f commit 53a1116

File tree

5 files changed

+28
-29
lines changed

5 files changed

+28
-29
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ PROGRAMS += git-patch-id$X
357357
PROGRAMS += git-shell$X
358358
PROGRAMS += git-show-index$X
359359
PROGRAMS += git-unpack-file$X
360-
PROGRAMS += git-update-server-info$X
361360
PROGRAMS += git-upload-pack$X
362361
PROGRAMS += git-var$X
363362

@@ -636,6 +635,7 @@ BUILTIN_OBJS += builtin-tar-tree.o
636635
BUILTIN_OBJS += builtin-unpack-objects.o
637636
BUILTIN_OBJS += builtin-update-index.o
638637
BUILTIN_OBJS += builtin-update-ref.o
638+
BUILTIN_OBJS += builtin-update-server-info.o
639639
BUILTIN_OBJS += builtin-upload-archive.o
640640
BUILTIN_OBJS += builtin-verify-pack.o
641641
BUILTIN_OBJS += builtin-verify-tag.o

builtin-update-server-info.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include "cache.h"
2+
#include "builtin.h"
3+
#include "parse-options.h"
4+
5+
static const char * const update_server_info_usage[] = {
6+
"git update-server-info [--force]",
7+
NULL
8+
};
9+
10+
int cmd_update_server_info(int argc, const char **argv, const char *prefix)
11+
{
12+
int force = 0;
13+
struct option options[] = {
14+
OPT_BOOLEAN('f', "force", &force,
15+
"update the info files from scratch"),
16+
OPT_END()
17+
};
18+
19+
argc = parse_options(argc, argv, prefix, options,
20+
update_server_info_usage, 0);
21+
if (argc > 0)
22+
usage_with_options(update_server_info_usage, options);
23+
24+
return !!update_server_info(force);
25+
}

builtin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ extern int cmd_tar_tree(int argc, const char **argv, const char *prefix);
102102
extern int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
103103
extern int cmd_update_index(int argc, const char **argv, const char *prefix);
104104
extern int cmd_update_ref(int argc, const char **argv, const char *prefix);
105+
extern int cmd_update_server_info(int argc, const char **argv, const char *prefix);
105106
extern int cmd_upload_archive(int argc, const char **argv, const char *prefix);
106107
extern int cmd_upload_tar(int argc, const char **argv, const char *prefix);
107108
extern int cmd_verify_tag(int argc, const char **argv, const char *prefix);

git.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ static void handle_internal_command(int argc, const char **argv)
359359
{ "unpack-objects", cmd_unpack_objects, RUN_SETUP },
360360
{ "update-index", cmd_update_index, RUN_SETUP },
361361
{ "update-ref", cmd_update_ref, RUN_SETUP },
362+
{ "update-server-info", cmd_update_server_info, RUN_SETUP },
362363
{ "upload-archive", cmd_upload_archive },
363364
{ "verify-tag", cmd_verify_tag, RUN_SETUP },
364365
{ "version", cmd_version },

update-server-info.c

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)