2009-12-25 16:30:51 +08:00
|
|
|
#ifndef RESOLVE_UNDO_H
|
|
|
|
#define RESOLVE_UNDO_H
|
|
|
|
|
2018-08-16 01:54:05 +08:00
|
|
|
#include "cache.h"
|
|
|
|
|
2009-12-25 16:30:51 +08:00
|
|
|
struct resolve_undo_info {
|
|
|
|
unsigned int mode[3];
|
2018-03-12 10:27:25 +08:00
|
|
|
struct object_id oid[3];
|
2009-12-25 16:30:51 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern void record_resolve_undo(struct index_state *, struct cache_entry *);
|
|
|
|
extern void resolve_undo_write(struct strbuf *, struct string_list *);
|
2010-02-02 14:04:03 +08:00
|
|
|
extern struct string_list *resolve_undo_read(const char *, unsigned long);
|
2009-12-25 16:30:51 +08:00
|
|
|
extern void resolve_undo_clear_index(struct index_state *);
|
2009-12-26 03:57:11 +08:00
|
|
|
extern int unmerge_index_entry_at(struct index_state *, int);
|
2013-07-14 16:35:51 +08:00
|
|
|
extern void unmerge_index(struct index_state *, const struct pathspec *);
|
checkout: avoid unnecessary match_pathspec calls
In checkout_paths() we do this
- for all updated items, call match_pathspec
- for all items, call match_pathspec (inside unmerge_cache)
- for all items, call match_pathspec (for showing "path .. is unmerged)
- for updated items, call match_pathspec and update paths
That's a lot of duplicate match_pathspec(s) and the function is not
exactly cheap to be called so many times, especially on large indexes.
This patch makes it call match_pathspec once per updated index entry,
save the result in ce_flags and reuse the results in the following
loops.
The changes in 0a1283b (checkout $tree $path: do not clobber local
changes in $path not in $tree - 2011-09-30) limit the affected paths
to ones we read from $tree. We do not do anything to other modified
entries in this case, so the "for all items" above could be modified
to "for all updated items". But..
The command's behavior now is modified slightly: unmerged entries that
match $path, but not updated by $tree, are now NOT touched. Although
this should be considered a bug fix, not a regression. A new test is
added for this change.
And while at there, free ps_matched after use.
The following command is tested on webkit, 215k entries. The pattern
is chosen mainly to make match_pathspec sweat:
git checkout -- "*[a-zA-Z]*[a-zA-Z]*[a-zA-Z]*"
before after
real 0m3.493s 0m2.737s
user 0m2.239s 0m1.586s
sys 0m1.252s 0m1.151s
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-27 13:58:21 +08:00
|
|
|
extern void unmerge_marked_index(struct index_state *);
|
2009-12-25 16:30:51 +08:00
|
|
|
|
|
|
|
#endif
|