MCPcopy Index your code
hub / github.com/git/git / write_archive

Function write_archive

archive.c:752–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

750}
751
752int write_archive(int argc, const char **argv, const char *prefix,
753 struct repository *repo,
754 const char *name_hint, int remote)
755{
756 const struct archiver *ar = NULL;
757 struct pretty_print_describe_status describe_status = {0};
758 struct pretty_print_context ctx = {0};
759 struct archiver_args args;
760 const char **argv_copy;
761 int rc;
762
763 repo_config_get_bool(the_repository, "uploadarchive.allowunreachable", &remote_allow_unreachable);
764 repo_config(the_repository, git_default_config, NULL);
765
766 describe_status.max_invocations = 1;
767 ctx.date_mode.type = DATE_NORMAL;
768 ctx.abbrev = DEFAULT_ABBREV;
769 ctx.describe_status = &describe_status;
770 args.pretty_ctx = &ctx;
771 args.repo = repo;
772 args.prefix = prefix;
773 string_list_init_dup(&args.extra_files);
774
775 /*
776 * `parse_archive_args()` modifies contents of `argv`, which is what we
777 * want. Our callers may not want it though, so we create a copy here.
778 */
779 DUP_ARRAY(argv_copy, argv, argc);
780 argv = argv_copy;
781
782 argc = parse_archive_args(argc, argv, &ar, &args, name_hint, remote);
783 if (!startup_info->have_repository) {
784 /*
785 * We know this will die() with an error, so we could just
786 * die ourselves; but its error message will be more specific
787 * than what we could write here.
788 */
789 setup_git_directory(the_repository);
790 }
791
792 parse_treeish_arg(argv, &args, remote);
793 parse_pathspec_arg(argv + 1, &args);
794
795 rc = ar->write_archive(ar, &args);
796
797 string_list_clear_func(&args.extra_files, extra_file_info_clear);
798 free(args.refname);
799 clear_pathspec(&args.pathspec);
800 free(argv_copy);
801
802 return rc;
803}
804
805static int match_extension(const char *filename, const char *ext)
806{

Callers 3

cmd_archiveFunction · 0.85

Calls 9

repo_config_get_boolFunction · 0.85
string_list_init_dupFunction · 0.85
parse_archive_argsFunction · 0.85
setup_git_directoryFunction · 0.85
parse_treeish_argFunction · 0.85
parse_pathspec_argFunction · 0.85
string_list_clear_funcFunction · 0.85
clear_pathspecFunction · 0.85
repo_configFunction · 0.70

Tested by

no test coverage detected