MCPcopy Create free account
hub / github.com/git/git / cmd_read_tree

Function cmd_read_tree

builtin/read-tree.c:111–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111int cmd_read_tree(int argc,
112 const char **argv,
113 const char *cmd_prefix,
114 struct repository *repo UNUSED)
115{
116 int i, stage = 0;
117 struct object_id oid;
118 struct tree_desc t[MAX_UNPACK_TREES];
119 struct unpack_trees_options opts;
120 int prefix_set = 0;
121 struct lock_file lock_file = LOCK_INIT;
122 const struct option read_tree_options[] = {
123 OPT__SUPER_PREFIX(&opts.super_prefix),
124 OPT_CALLBACK_F(0, "index-output", NULL, N_("file"),
125 N_("write resulting index to <file>"),
126 PARSE_OPT_NONEG, index_output_cb),
127 OPT_BOOL(0, "empty", &read_empty,
128 N_("only empty the index")),
129 OPT__VERBOSE(&opts.verbose_update, N_("be verbose")),
130 OPT_GROUP(N_("Merging")),
131 OPT_BOOL('m', NULL, &opts.merge,
132 N_("perform a merge in addition to a read")),
133 OPT_BOOL(0, "trivial", &opts.trivial_merges_only,
134 N_("3-way merge if no file level merging required")),
135 OPT_BOOL(0, "aggressive", &opts.aggressive,
136 N_("3-way merge in presence of adds and removes")),
137 OPT_BOOL(0, "reset", &opts.reset,
138 N_("same as -m, but discard unmerged entries")),
139 {
140 .type = OPTION_STRING,
141 .long_name = "prefix",
142 .value = &opts.prefix,
143 .argh = N_("<subdirectory>/"),
144 .help = N_("read the tree into the index under <subdirectory>/"),
145 .flags = PARSE_OPT_NONEG,
146 },
147 OPT_BOOL('u', NULL, &opts.update,
148 N_("update working tree with merge result")),
149 OPT_CALLBACK_F(0, "exclude-per-directory", &opts,
150 N_("gitignore"),
151 N_("allow explicitly ignored files to be overwritten"),
152 PARSE_OPT_NONEG, exclude_per_directory_cb),
153 OPT_BOOL('i', NULL, &opts.index_only,
154 N_("don't check the working tree after merging")),
155 OPT__DRY_RUN(&opts.dry_run, N_("don't update the index or the work tree")),
156 OPT_BOOL(0, "no-sparse-checkout", &opts.skip_sparse_checkout,
157 N_("skip applying sparse checkout filter")),
158 OPT_BOOL(0, "debug-unpack", &opts.internal.debug_unpack,
159 N_("debug unpack-trees")),
160 OPT_CALLBACK_F(0, "recurse-submodules", NULL,
161 "checkout", "control recursive updating of submodules",
162 PARSE_OPT_OPTARG, option_parse_recurse_submodules_worktree_updater),
163 OPT__QUIET(&opts.quiet, N_("suppress feedback messages")),
164 OPT_END()
165 };
166
167 memset(&opts, 0, sizeof(opts));
168 opts.head_idx = -1;

Callers

nothing calls this directly

Calls 15

parse_optionsFunction · 0.85
prepare_repo_settingsFunction · 0.85
repo_hold_locked_indexFunction · 0.85
repo_read_index_unmergedFunction · 0.85
resolve_undo_clear_indexFunction · 0.85
repo_get_oidFunction · 0.85
list_treeFunction · 0.85
warningFunction · 0.85
setup_work_treeFunction · 0.85
ensure_full_indexFunction · 0.85
is_index_unbornFunction · 0.85
cache_tree_freeFunction · 0.85

Tested by

no test coverage detected