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

Function cmd_delete

scalar.c:919–950  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

917}
918
919static int cmd_delete(int argc, const char **argv)
920{
921 char *cwd = xgetcwd();
922 struct option options[] = {
923 OPT_END(),
924 };
925 const char * const usage[] = {
926 N_("scalar delete <enlistment>"),
927 NULL
928 };
929 struct strbuf enlistment = STRBUF_INIT;
930 int res = 0;
931
932 argc = parse_options(argc, argv, NULL, options,
933 usage, 0);
934
935 if (argc != 1)
936 usage_with_options(usage, options);
937
938 setup_enlistment_directory(argc, argv, usage, options, &enlistment);
939
940 if (dir_inside_of(cwd, enlistment.buf) >= 0)
941 res = error(_("refusing to delete current working directory"));
942 else {
943 odb_close(the_repository->objects);
944 res = delete_enlistment(&enlistment);
945 }
946 strbuf_release(&enlistment);
947 free(cwd);
948
949 return res;
950}
951
952static int cmd_help(int argc, const char **argv)
953{

Callers

nothing calls this directly

Calls 9

xgetcwdFunction · 0.85
parse_optionsFunction · 0.85
usage_with_optionsFunction · 0.85
dir_inside_ofFunction · 0.85
errorFunction · 0.85
odb_closeFunction · 0.85
delete_enlistmentFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected