diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-01-20 14:44:31 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-01-20 14:46:35 -0800 |
commit | 6751e0471df1bdc4a1d5e5a3929a531c74e95aeb (patch) | |
tree | 4f25445b5ceb6f83473f60a36c7d09d2e1f0378e /builtin-ls-files.c | |
parent | 030b1a77f72a7e3307c7d7881ae570ca1c8ed877 (diff) | |
parent | dea4562bf5d1c27cd6c01b9cb65c3a8b8ee99a69 (diff) | |
download | git-6751e0471df1bdc4a1d5e5a3929a531c74e95aeb.tar.gz |
Merge branch 'jc/cache-unmerge'
* jc/cache-unmerge:
rerere forget path: forget recorded resolution
rerere: refactor rerere logic to make it independent from I/O
rerere: remove silly 1024-byte line limit
resolve-undo: teach "update-index --unresolve" to use resolve-undo info
resolve-undo: "checkout -m path" uses resolve-undo information
resolve-undo: allow plumbing to clear the information
resolve-undo: basic tests
resolve-undo: record resolved conflicts in a new index extension section
builtin-merge.c: use standard active_cache macros
Conflicts:
builtin-ls-files.c
builtin-merge.c
builtin-rerere.c
Diffstat (limited to 'builtin-ls-files.c')
-rw-r--r-- | builtin-ls-files.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/builtin-ls-files.c b/builtin-ls-files.c index 738215768e..b065061392 100644 --- a/builtin-ls-files.c +++ b/builtin-ls-files.c @@ -11,6 +11,8 @@ #include "builtin.h" #include "tree.h" #include "parse-options.h" +#include "resolve-undo.h" +#include "string-list.h" static int abbrev; static int show_deleted; @@ -18,6 +20,7 @@ static int show_cached; static int show_others; static int show_stage; static int show_unmerged; +static int show_resolve_undo; static int show_modified; static int show_killed; static int show_valid_bit; @@ -38,6 +41,7 @@ static const char *tag_other = ""; static const char *tag_killed = ""; static const char *tag_modified = ""; static const char *tag_skip_worktree = ""; +static const char *tag_resolve_undo = ""; static void show_dir_entry(const char *tag, struct dir_entry *ent) { @@ -156,6 +160,38 @@ static void show_ce_entry(const char *tag, struct cache_entry *ce) write_name_quoted(ce->name + offset, stdout, line_terminator); } +static int show_one_ru(struct string_list_item *item, void *cbdata) +{ + int offset = prefix_offset; + const char *path = item->string; + struct resolve_undo_info *ui = item->util; + int i, len; + + len = strlen(path); + if (len < prefix_len) + return 0; /* outside of the prefix */ + if (!match_pathspec(pathspec, path, len, 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], + abbrev + ? find_unique_abbrev(ui->sha1[i], abbrev) + : sha1_to_hex(ui->sha1[i]), + i + 1); + write_name_quoted(path + offset, stdout, line_terminator); + } + return 0; +} + +static void show_ru_info(const char *prefix) +{ + if (!the_index.resolve_undo) + return; + for_each_string_list(show_one_ru, the_index.resolve_undo, NULL); +} + static void show_files(struct dir_struct *dir, const char *prefix) { int i; @@ -458,6 +494,8 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix) DIR_HIDE_EMPTY_DIRECTORIES), OPT_BOOLEAN('u', "unmerged", &show_unmerged, "show unmerged files in the output"), + OPT_BOOLEAN(0, "resolve-undo", &show_resolve_undo, + "show resolve-undo information"), { OPTION_CALLBACK, 'x', "exclude", &dir.exclude_list[EXC_CMDL], "pattern", "skip files matching pattern", 0, option_parse_exclude }, @@ -498,6 +536,7 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix) tag_other = "? "; tag_killed = "K "; tag_skip_worktree = "S "; + tag_resolve_undo = "U "; } if (show_modified || show_others || show_deleted || (dir.flags & DIR_SHOW_IGNORED) || show_killed) require_work_tree = 1; @@ -536,7 +575,7 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix) /* With no flags, we default to showing the cached files */ if (!(show_stage | show_deleted | show_others | show_unmerged | - show_killed | show_modified)) + show_killed | show_modified | show_resolve_undo)) show_cached = 1; if (prefix) @@ -551,6 +590,8 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix) overlay_tree_on_cache(with_tree, prefix); } show_files(&dir, prefix); + if (show_resolve_undo) + show_ru_info(prefix); if (ps_matched) { int bad; |