From: Junio C Hamano Date: Wed, 18 Nov 2020 21:32:53 +0000 (-0800) Subject: Merge branch 'pb/blame-funcname-range-userdiff' X-Git-Tag: v2.30.0-rc0~76 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fgit.git;a=commitdiff_plain;h=3f6dc9c36693c2ba6dd5fb61fbad6b72cc08e3d1;hp=-c Merge branch 'pb/blame-funcname-range-userdiff' "git blame -L :funcname -- path" did not work well for a path for which a userdiff driver is defined. * pb/blame-funcname-range-userdiff: blame: simplify 'setup_blame_bloom_data' interface blame: simplify 'setup_scoreboard' interface blame: enable funcname blaming with userdiff driver line-log: mention both modes in 'blame' and 'log' short help doc: add more pointers to gitattributes(5) for userdiff blame-options.txt: also mention 'funcname' in '-L' description doc: line-range: improve formatting doc: log, gitk: move '-L' description to 'line-range-options.txt' --- 3f6dc9c36693c2ba6dd5fb61fbad6b72cc08e3d1 diff --combined Documentation/diff-options.txt index 2e7a93894c,72b558ce21..746b144c76 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@@ -36,9 -36,9 +36,9 @@@ endif::git-format-patch[ -U:: --unified=:: Generate diffs with lines of context instead of - the usual three. Implies `--patch`. + the usual three. ifndef::git-format-patch[] - Implies `-p`. + Implies `--patch`. endif::git-format-patch[] --output=:: @@@ -441,16 -441,12 +441,16 @@@ endif::git-format-patch[ --binary:: In addition to `--full-index`, output a binary diff that - can be applied with `git-apply`. Implies `--patch`. + can be applied with `git-apply`. +ifndef::git-format-patch[] + Implies `--patch`. +endif::git-format-patch[] --abbrev[=]:: Instead of showing the full 40-byte hexadecimal object name in diff-raw format output and diff-tree header - lines, show only a partial prefix. + lines, show the shortest prefix that is at least '' + hexdigits long that uniquely refers the object. In diff-patch output format, `--full-index` takes higher precedence, i.e. if `--full-index` is specified, full blob names will be shown regardless of `--abbrev`. @@@ -691,11 -687,6 +691,11 @@@ endif::git-format-patch[ --ignore-blank-lines:: Ignore changes whose lines are all blank. +-I:: +--ignore-matching-lines=:: + Ignore changes whose all lines match . This option may + be specified more than once. + --inter-hunk-context=:: Show the context between diff hunks, up to the specified number of lines, thereby fusing hunks that are close to each other. @@@ -704,7 -695,10 +704,10 @@@ -W:: --function-context:: - Show whole surrounding functions of changes. + Show whole function as context lines for each change. + The function names are determined in the same way as + `git diff` works out patch hunk headers (see 'Defining a + custom hunk-header' in linkgit:gitattributes[5]). ifndef::git-format-patch[] ifndef::git-log[] diff --combined builtin/log.c index 6619e10abc,c87ce09325..49eb8f6431 --- a/builtin/log.c +++ b/builtin/log.c @@@ -183,8 -183,8 +183,8 @@@ static void cmd_log_init_finish(int arg N_("pattern"), N_("do not decorate refs that match ")), OPT_CALLBACK_F(0, "decorate", NULL, NULL, N_("decorate options"), PARSE_OPT_OPTARG, decorate_callback), - OPT_CALLBACK('L', NULL, &line_cb, "n,m:file", - N_("Process line range n,m in file, counting from 1"), + OPT_CALLBACK('L', NULL, &line_cb, "range:file", + N_("Trace the evolution of line range , or function : in "), log_line_range_callback), OPT_END() }; @@@ -206,9 -206,6 +206,9 @@@ if (argc > 1) die(_("unrecognized argument: %s"), argv[1]); + if (rev->line_level_traverse && rev->prune_data.nr) + die(_("-L: cannot be used with pathspec")); + memset(&w, 0, sizeof(w)); userformat_find_requirements(NULL, &w); @@@ -1156,7 -1153,7 +1156,7 @@@ static void get_notes_args(struct strve } } -static void make_cover_letter(struct rev_info *rev, int use_stdout, +static void make_cover_letter(struct rev_info *rev, int use_separate_file, struct commit *origin, int nr, struct commit **list, const char *branch_name, @@@ -1176,7 -1173,7 +1176,7 @@@ committer = git_committer_info(0); - if (!use_stdout && + if (use_separate_file && open_next_file(NULL, rev->numbered_files ? NULL : "cover-letter", rev, quiet)) die(_("failed to create cover-letter file")); @@@ -1741,7 -1738,7 +1741,7 @@@ int cmd_format_patch(int argc, const ch OPT_CALLBACK_F('N', "no-numbered", &numbered, NULL, N_("use [PATCH] even with multiple patches"), PARSE_OPT_NOARG | PARSE_OPT_NONEG, no_numbered_callback), - OPT_BOOL('s', "signoff", &do_signoff, N_("add Signed-off-by:")), + OPT_BOOL('s', "signoff", &do_signoff, N_("add a Signed-off-by trailer")), OPT_BOOL(0, "stdout", &use_stdout, N_("print patches to standard out")), OPT_BOOL(0, "cover-letter", &cover_letter, @@@ -1945,27 -1942,20 +1945,27 @@@ if (rev.show_notes) load_display_notes(&rev.notes_opt); - if (!output_directory && !use_stdout) - output_directory = config_output_directory; + if (use_stdout + rev.diffopt.close_file + !!output_directory > 1) + die(_("--stdout, --output, and --output-directory are mutually exclusive")); - if (!use_stdout) - output_directory = set_outdir(prefix, output_directory); - else + if (use_stdout) { setup_pager(); - - if (output_directory) { + } else if (rev.diffopt.close_file) { + /* + * The diff code parsed --output; it has already opened the + * file, but but we must instruct it not to close after each + * diff. + */ + rev.diffopt.close_file = 0; + } else { int saved; + + if (!output_directory) + output_directory = config_output_directory; + output_directory = set_outdir(prefix, output_directory); + if (rev.diffopt.use_color != GIT_COLOR_ALWAYS) rev.diffopt.use_color = GIT_COLOR_NEVER; - if (use_stdout) - die(_("standard output, or directory, which one?")); /* * We consider as 'outside of gitdir', therefore avoid * applying adjust_shared_perm in s-c-l-d. @@@ -2127,7 -2117,7 +2127,7 @@@ if (cover_letter) { if (thread) gen_message_id(&rev, "cover"); - make_cover_letter(&rev, use_stdout, + make_cover_letter(&rev, !!output_directory, origin, nr, list, branch_name, quiet); print_bases(&bases, rev.diffopt.file); print_signature(rev.diffopt.file); @@@ -2182,7 -2172,7 +2182,7 @@@ gen_message_id(&rev, oid_to_hex(&commit->object.oid)); } - if (!use_stdout && + if (output_directory && open_next_file(rev.numbered_files ? NULL : commit, NULL, &rev, quiet)) die(_("failed to create output files")); shown = log_tree_commit(&rev, commit); @@@ -2195,7 -2185,7 +2195,7 @@@ * the log; when using one file per patch, we do * not want the extra blank line. */ - if (!use_stdout) + if (output_directory) rev.shown_one = 0; if (shown) { print_bases(&bases, rev.diffopt.file); @@@ -2206,7 -2196,7 +2206,7 @@@ else print_signature(rev.diffopt.file); } - if (!use_stdout) + if (output_directory) fclose(rev.diffopt.file); } stop_progress(&progress);