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

Function ask_each_cmd

builtin/clean.c:776–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

774}
775
776static int ask_each_cmd(void)
777{
778 struct strbuf confirm = STRBUF_INIT;
779 struct strbuf buf = STRBUF_INIT;
780 struct string_list_item *item;
781 const char *qname;
782 int changed = 0, eof = 0;
783
784 for_each_string_list_item(item, &del_list) {
785 /* Ctrl-D should stop removing files */
786 if (!eof) {
787 qname = quote_path(item->string, NULL, &buf, 0);
788 /* TRANSLATORS: Make sure to keep [y/N] as is */
789 printf(_("Remove %s [y/N]? "), qname);
790 if (git_read_line_interactively(&confirm) == EOF) {
791 putchar('\n');
792 eof = 1;
793 }
794 }
795 if (!confirm.len || strncasecmp(confirm.buf, "yes", confirm.len)) {
796 *item->string = '\0';
797 changed++;
798 }
799 }
800
801 if (changed)
802 string_list_remove_empty_items(&del_list, 0);
803
804 strbuf_release(&buf);
805 strbuf_release(&confirm);
806 return MENU_RETURN_NO_LOOP;
807}
808
809static int quit_cmd(void)
810{

Callers

nothing calls this directly

Calls 4

quote_pathFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected