Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/pack-refs.c # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / pack-refs.c` 56 lines ยท 1818 bytes Raw Blame History 1 #include "builtin.h" 2 #include "config.h" 3 #include "environment.h" 4 #include "pack-refs.h" 5 #include "parse-options.h" 6 #include "refs.h" 7 #include "revision.h" 8 9 int pack_refs_core(int argc, 10 const char **argv, 11 const char *prefix, 12 struct repository *repo, 13 const char * const *usage_opts) 14 { 15 struct ref_exclusions excludes = REF_EXCLUSIONS_INIT; 16 struct string_list included_refs = STRING_LIST_INIT_NODUP; 17 struct refs_optimize_opts optimize_opts = { 18 .exclusions = &excludes, 19 .includes = &included_refs, 20 .flags = REFS_OPTIMIZE_PRUNE, 21 }; 22 struct string_list option_excluded_refs = STRING_LIST_INIT_NODUP; 23 struct string_list_item *item; 24 int pack_all = 0; 25 int ret; 26 27 struct option opts[] = { 28 OPT_BOOL(0, "all", &pack_all, N_("pack everything")), 29 OPT_BIT(0, "prune", &optimize_opts.flags, N_("prune loose refs (default)"), REFS_OPTIMIZE_PRUNE), 30 OPT_BIT(0, "auto", &optimize_opts.flags, N_("auto-pack refs as needed"), REFS_OPTIMIZE_AUTO), 31 OPT_STRING_LIST(0, "include", optimize_opts.includes, N_("pattern"), 32 N_("references to include")), 33 OPT_STRING_LIST(0, "exclude", &option_excluded_refs, N_("pattern"), 34 N_("references to exclude")), 35 OPT_END(), 36 }; 37 repo_config(repo, git_default_config, NULL); 38 if (parse_options(argc, argv, prefix, opts, usage_opts, 0)) 39 usage_with_options(usage_opts, opts); 40 41 for_each_string_list_item(item, &option_excluded_refs) 42 add_ref_exclusion(optimize_opts.exclusions, item->string); 43 44 if (pack_all) 45 string_list_append(optimize_opts.includes, "*"); 46 47 if (!optimize_opts.includes->nr) 48 string_list_append(optimize_opts.includes, "refs/tags/*"); 49 50 ret = refs_optimize(get_main_ref_store(repo), &optimize_opts); 51 52 clear_ref_exclusions(&excludes); 53 string_list_clear(&included_refs, 0); 54 string_list_clear(&option_excluded_refs, 0); 55 return ret; 56 }