| 917 | } |
| 918 | |
| 919 | static 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 | |
| 952 | static int cmd_help(int argc, const char **argv) |
| 953 | { |
nothing calls this directly
no test coverage detected