Add blob find pickaxe option
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest1 patch 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | diffcore: add a pickaxe option to find a specific blobDocumentation/ diff.c diff.h +3 more | +115 | 2 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/1] Add blob find pickaxe option
This is a resend for sb/diff-blobfind, but now the option --find-object is a native of the pickaxe family.
Stefan Beller (1):
diffcore: add a pickaxe option to find a specific blob
Documentation/diff-options.txt | 10 +++++++ diff.c | 21 ++++++++++++- diff.h | 3 ++ diffcore-pickaxe.c | 14 +++++++-- revision.c | 3 ++ t/t4064-diff-oidfind.sh | 68 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 115 insertions(+), 4 deletions(-) create mode 100755 t/t4064-diff-oidfind.sh
Signature · 1 line
2.15.1.620.gb9897f4670-goog
Documentation/diff-options.txt +9 -5
@@ -492,6 +492,15 @@ occurrences of that string did not change). See the 'pickaxe' entry in linkgit:gitdiffcore[7] for more information. +--find-object=<object-id>:: + Look for differences that change the number of occurrences of + the specified object. Similar to `-S`, just the argument is different + in that it doesn't search for a specific string but for a specific + object id. ++ +The object can be a blob or a submodule commit. It implies the `-t` option in +`git-log` to also find trees. + --pickaxe-all:: When `-S` or `-G` finds a change, show all the changes in that changeset, not just the files that contain the change
@@ -501,11 +510,6 @@ information. Treat the <string> given to `-S` as an extended POSIX regular expression to match. ---find-object=<object-id>:: - Restrict the output such that one side of the diff - matches the given object id. The object can be a blob, - gitlink entry or tree (when `-t` is given). - endif::git-format-patch[] -O<orderfile>::
Makefile +0 -1
@@ -775,7 +775,6 @@ LIB_OBJS += date.o LIB_OBJS += decorate.o LIB_OBJS += diffcore-break.o LIB_OBJS += diffcore-delta.o -LIB_OBJS += diffcore-objfind.o LIB_OBJS += diffcore-order.o LIB_OBJS += diffcore-pickaxe.o LIB_OBJS += diffcore-rename.o
builtin/log.c +1 -1
@@ -181,7 +181,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,init_display_notes (&rev->notes_opt);if (rev->diffopt.pickaxe || rev->diffopt.filter || - rev->diffopt.flags.follow_renames || rev->diffopt.objfind) + rev->diffopt.flags.follow_renames) rev->always_show_header =0 ;if (source)
diff.c +4 -3
@@ -4497,6 +4497,10 @@ static int parse_objfind_opt(struct diff_options *opt, const char *arg)if (!opt->objfind) opt->objfind =xcalloc (1 ,sizeof (*opt->objfind)); + + opt->pickaxe ="" ;/* trigger pickaxe */ + opt->flags.recursive =1 ; + opt->flags.tree_in_recursive =1 ;oidset_insert (opt->objfind, &oid);return 1 ; }
@@ -5785,9 +5789,6 @@ void diffcore_std(struct diff_options *options)diffcore_skip_stat_unmatch (options);if (!options->found_follow) {/* See try_to_follow_renames() in tree-diff.c */ - -if (options->objfind) -diffcore_objfind (options);if (options->break_opt !=-1 )diffcore_break (options->break_opt);if (options->detect_rename)
diffcore-objfind.c deleted +0 -42
42 lines not on this page · raw message
diffcore-pickaxe.c +11 -3
@@ -124,13 +124,21 @@ static int pickaxe_match(struct diff_filepair *p, struct diff_options *o,mmfile_t mf1, mf2;int ret; -if (!o->pickaxe[0 ]) -return 0 ; -/* ignore unmerged */ if (!DIFF_FILE_VALID (p->one) && !DIFF_FILE_VALID (p->two))return 0 ; +if (o->objfind) { +if ((DIFF_FILE_VALID (p->one) && +oidset_contains (o->objfind, &p->one->oid)) || + (DIFF_FILE_VALID (p->two) && +oidset_contains (o->objfind, &p->two->oid))) +return 1 ; + } + +if (!o->pickaxe[0 ]) +return 0 ; +if (o->flags.allow_textconv) { textconv_one =get_textconv (p->one); textconv_two =get_textconv (p->two);
diffcore.h +0 -1
@@ -107,7 +107,6 @@ extern struct diff_filepair *diff_queue(struct diff_queue_struct *, struct diff_filespec *);extern void diff_q (struct diff_queue_struct *,struct diff_filepair *); -extern void diffcore_objfind (struct diff_options *);extern void diffcore_break (int );extern void diffcore_rename (struct diff_options *);extern void diffcore_merge_broken (void );
revision.c +4 -4
@@ -2409,10 +2409,12 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s/* Pickaxe, diff-filter and rename following need diffs */ if (revs->diffopt.pickaxe || revs->diffopt.filter || - revs->diffopt.flags.follow_renames || - revs->diffopt.objfind) + revs->diffopt.flags.follow_renames) revs->diff =1 ; +if (revs->diffopt.objfind) + revs->simplify_history =0 ; +if (revs->topo_order) revs->limited =1 ;
@@ -2884,8 +2886,6 @@ int prepare_revision_walk(struct rev_info *revs)simplify_merges (revs);if (revs->children.name)set_children (revs); -if (revs->diffopt.objfind) - revs->simplify_history =0 ;return 0 ; }
t/helper/test-lazy-init-name-hash.c +1 -1
@@ -112,7 +112,7 @@ static void analyze_run(void) {uint64_t t1s, t1m, t2s, t2m;int cache_nr_limit; -int nr_threads_used; +int nr_threads_used =0 ;int i;int nr;