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

Function submodule_reset_index

submodule.c:2097–2119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2095}
2096
2097static void submodule_reset_index(const char *path, const char *super_prefix)
2098{
2099 struct child_process cp = CHILD_PROCESS_INIT;
2100
2101 if (validate_submodule_path(path) < 0)
2102 exit(128);
2103
2104 prepare_submodule_repo_env(&cp.env);
2105
2106 cp.git_cmd = 1;
2107 cp.no_stdin = 1;
2108 cp.dir = path;
2109
2110 /* TODO: determine if this might overwright untracked files */
2111 strvec_pushl(&cp.args, "read-tree", "-u", "--reset", NULL);
2112 strvec_pushf(&cp.args, "--super-prefix=%s%s/",
2113 (super_prefix ? super_prefix : ""), path);
2114
2115 strvec_push(&cp.args, empty_tree_oid_hex(the_repository->hash_algo));
2116
2117 if (run_command(&cp))
2118 die(_("could not reset submodule index"));
2119}
2120
2121/**
2122 * Moves a submodule at a given path from a given head to another new head.

Callers 1

submodule_move_headFunction · 0.85

Calls 8

validate_submodule_pathFunction · 0.85
strvec_pushlFunction · 0.85
strvec_pushfFunction · 0.85
strvec_pushFunction · 0.85
empty_tree_oid_hexFunction · 0.85
run_commandFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected