From: Junio C Hamano Date: Wed, 18 Aug 2010 19:14:38 +0000 (-0700) Subject: Merge branch 'ar/string-list-foreach' X-Git-Tag: v1.7.3-rc0~76 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c7e375de4228cdb86e2582e2eda7fa3a6f352fc2;p=git.git Merge branch 'ar/string-list-foreach' * ar/string-list-foreach: Convert the users of for_each_string_list to for_each_string_list_item macro Add a for_each_string_list_item macro --- c7e375de4228cdb86e2582e2eda7fa3a6f352fc2 diff --cc builtin/ls-files.c index cc202c5f6,cf6ab034f..bb4f612b3 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@@ -163,42 -162,34 +163,41 @@@ static void show_ce_entry(const char *t ce_stage(ce)); } write_name(ce->name, ce_namelen(ce)); + if (debug_mode) { + printf(" ctime: %d:%d\n", ce->ce_ctime.sec, ce->ce_ctime.nsec); + printf(" mtime: %d:%d\n", ce->ce_mtime.sec, ce->ce_mtime.nsec); + printf(" dev: %d\tino: %d\n", ce->ce_dev, ce->ce_ino); + printf(" uid: %d\tgid: %d\n", ce->ce_uid, ce->ce_gid); + printf(" size: %d\tflags: %x\n", ce->ce_size, ce->ce_flags); + } } - static int show_one_ru(struct string_list_item *item, void *cbdata) - { - const char *path = item->string; - struct resolve_undo_info *ui = item->util; - int i, len; - - len = strlen(path); - if (len < max_prefix_len) - return 0; /* outside of the prefix */ - if (!match_pathspec(pathspec, path, len, max_prefix_len, ps_matched)) - return 0; /* uninterested */ - for (i = 0; i < 3; i++) { - if (!ui->mode[i]) - continue; - printf("%s%06o %s %d\t", tag_resolve_undo, ui->mode[i], - find_unique_abbrev(ui->sha1[i], abbrev), - i + 1); - write_name(path, len); - } - return 0; - } - static void show_ru_info(void) { + struct string_list_item *item; + if (!the_index.resolve_undo) return; - for_each_string_list(the_index.resolve_undo, show_one_ru, NULL); + + for_each_string_list_item(item, the_index.resolve_undo) { + const char *path = item->string; + struct resolve_undo_info *ui = item->util; + int i, len; + + len = strlen(path); + if (len < max_prefix_len) + continue; /* outside of the prefix */ + if (!match_pathspec(pathspec, path, len, max_prefix_len, ps_matched)) + continue; /* uninterested */ + for (i = 0; i < 3; i++) { + if (!ui->mode[i]) + continue; + printf("%s%06o %s %d\t", tag_resolve_undo, ui->mode[i], + find_unique_abbrev(ui->sha1[i], abbrev), + i + 1); + write_name(path, len); + } + } } static void show_files(struct dir_struct *dir)