Stephen Boyd | c2e86ad | 2011-03-22 00:51:05 -0700 | [diff] [blame] | 1 | #include "builtin.h" |
Elijah Newren | 8e712ef | 2019-04-25 07:58:54 -0700 | [diff] [blame] | 2 | #include "config.h" |
Pierre Habouzit | b2565ae | 2007-10-15 23:06:02 +0200 | [diff] [blame] | 3 | #include "parse-options.h" |
Michael Haggerty | 32d462c | 2013-04-22 21:52:32 +0200 | [diff] [blame] | 4 | #include "refs.h" |
Stefan Beller | 23a3f0c | 2018-04-11 17:21:09 -0700 | [diff] [blame] | 5 | #include "repository.h" |
Linus Torvalds | 99b5a79 | 2007-05-26 09:25:31 -0700 | [diff] [blame] | 6 | |
Pierre Habouzit | b2565ae | 2007-10-15 23:06:02 +0200 | [diff] [blame] | 7 | static char const * const pack_refs_usage[] = { |
Alex Henrie | 9c9b4f2 | 2015-01-13 00:44:47 -0700 | [diff] [blame] | 8 | N_("git pack-refs [<options>]"), |
Pierre Habouzit | b2565ae | 2007-10-15 23:06:02 +0200 | [diff] [blame] | 9 | NULL |
| 10 | }; |
| 11 | |
Linus Torvalds | 99b5a79 | 2007-05-26 09:25:31 -0700 | [diff] [blame] | 12 | int cmd_pack_refs(int argc, const char **argv, const char *prefix) |
| 13 | { |
Pierre Habouzit | 68dce6e | 2007-11-07 11:20:30 +0100 | [diff] [blame] | 14 | unsigned int flags = PACK_REFS_PRUNE; |
Pierre Habouzit | b2565ae | 2007-10-15 23:06:02 +0200 | [diff] [blame] | 15 | struct option opts[] = { |
Nguyễn Thái Ngọc Duy | e08b735 | 2012-08-20 19:32:30 +0700 | [diff] [blame] | 16 | 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 Habouzit | b2565ae | 2007-10-15 23:06:02 +0200 | [diff] [blame] | 18 | OPT_END(), |
| 19 | }; |
Elijah Newren | 8e712ef | 2019-04-25 07:58:54 -0700 | [diff] [blame] | 20 | git_config(git_default_config, NULL); |
Stephen Boyd | 3778292 | 2009-05-23 11:53:12 -0700 | [diff] [blame] | 21 | if (parse_options(argc, argv, prefix, opts, pack_refs_usage, 0)) |
Pierre Habouzit | b2565ae | 2007-10-15 23:06:02 +0200 | [diff] [blame] | 22 | usage_with_options(pack_refs_usage, opts); |
Stefan Beller | 23a3f0c | 2018-04-11 17:21:09 -0700 | [diff] [blame] | 23 | return refs_pack_refs(get_main_ref_store(the_repository), flags); |
Linus Torvalds | 99b5a79 | 2007-05-26 09:25:31 -0700 | [diff] [blame] | 24 | } |