blob: cfbd5c36c7640bc841a68bb5a524f025c43212fd [file] [log] [blame]
Stephen Boydc2e86ad2011-03-22 00:51:05 -07001#include "builtin.h"
Elijah Newren8e712ef2019-04-25 07:58:54 -07002#include "config.h"
Pierre Habouzitb2565ae2007-10-15 23:06:02 +02003#include "parse-options.h"
Michael Haggerty32d462c2013-04-22 21:52:32 +02004#include "refs.h"
Stefan Beller23a3f0c2018-04-11 17:21:09 -07005#include "repository.h"
Linus Torvalds99b5a792007-05-26 09:25:31 -07006
Pierre Habouzitb2565ae2007-10-15 23:06:02 +02007static char const * const pack_refs_usage[] = {
Alex Henrie9c9b4f22015-01-13 00:44:47 -07008 N_("git pack-refs [<options>]"),
Pierre Habouzitb2565ae2007-10-15 23:06:02 +02009 NULL
10};
11
Linus Torvalds99b5a792007-05-26 09:25:31 -070012int cmd_pack_refs(int argc, const char **argv, const char *prefix)
13{
Pierre Habouzit68dce6e2007-11-07 11:20:30 +010014 unsigned int flags = PACK_REFS_PRUNE;
Pierre Habouzitb2565ae2007-10-15 23:06:02 +020015 struct option opts[] = {
Nguyễn Thái Ngọc Duye08b7352012-08-20 19:32:30 +070016 OPT_BIT(0, "all", &flags, N_("pack everything"), PACK_REFS_ALL),
17 OPT_BIT(0, "prune", &flags, N_("prune loose refs (default)"), PACK_REFS_PRUNE),
Pierre Habouzitb2565ae2007-10-15 23:06:02 +020018 OPT_END(),
19 };
Elijah Newren8e712ef2019-04-25 07:58:54 -070020 git_config(git_default_config, NULL);
Stephen Boyd37782922009-05-23 11:53:12 -070021 if (parse_options(argc, argv, prefix, opts, pack_refs_usage, 0))
Pierre Habouzitb2565ae2007-10-15 23:06:02 +020022 usage_with_options(pack_refs_usage, opts);
Stefan Beller23a3f0c2018-04-11 17:21:09 -070023 return refs_pack_refs(get_main_ref_store(the_repository), flags);
Linus Torvalds99b5a792007-05-26 09:25:31 -070024}