Skip to content

blame: make diff algorithm configurable

Antonin Delpeuch via GitGitGadget git 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest2 patches 2 repliesIn review
  2. v52 patches 4 repliesSuperseded
  3. v42 patches 4 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v31 patch4 repliesSuperseded
v21 patch2 repliesSuperseded
v11 patch4 repliesSuperseded

Changes in v6 from the cover letter

* add back /* clear out previous settings */ comments
* remove whitespace in bash output redirection

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASKdiff.c merge-ort.c xdiff/xdiff.h+1 -30 replies
2/2blame: make diff algorithm configurableDocumentation/diff-algorithm-option.adoc Documentation/diff-options.adoc Documentation/git-blame.adoc +3 more+278 -210 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH v6 0/2] blame: make diff algorithm configurable

Changes since v5:

* add back /* clear out previous settings */ comments
* remove whitespace in bash output redirection

Antonin Delpeuch (2):
xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASK
blame: make diff algorithm configurable

 Documentation/diff-algorithm-option.adoc |  20 +++
 Documentation/diff-options.adoc          |  21 +--
 Documentation/git-blame.adoc             |   2 +
 builtin/blame.c                          |  52 +++++-
 diff.c                                   |   1 -
 merge-ort.c                              |   1 -
 t/meson.build                            |   1 +
 t/t8015-blame-diff-algorithm.sh          | 203 +++++++++++++++++++++++
 xdiff/xdiff.h                            |   2 +-
 9 files changed, 279 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/diff-algorithm-option.adoc
 create mode 100755 t/t8015-blame-diff-algorithm.sh

base-commit: 4253630c6f07a4bdcc9aa62a50e26a4d466219d1
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2075%2Fwetneb%2Fblame_respects_diff_algorithm-v6
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2075/wetneb/blame_respects_diff_algorithm-v6
Pull-Request: https://github.com/git/git/pull/2075

Range-diff vs v5:

1: e81a5d2bd2 ! 1: 4846715436 xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASK

     @@ Commit message
      
       ## diff.c ##
      @@ diff.c: static int set_diff_algorithm(struct diff_options *opts,
     - 	if (value < 0)
       		return -1;
       
     --	/* clear out previous settings */
     + 	/* clear out previous settings */
      -	DIFF_XDL_CLR(opts, NEED_MINIMAL);
       	opts->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
       	opts->xdl_opts |= value;
     @@ diff.c: static int set_diff_algorithm(struct diff_options *opts,
      
       ## merge-ort.c ##
      @@ merge-ort.c: int parse_merge_opt(struct merge_options *opt, const char *s)
     - 		long value = parse_algorithm_value(arg);
       		if (value < 0)
       			return -1;
     --		/* clear out previous settings */
     + 		/* clear out previous settings */
      -		DIFF_XDL_CLR(opt, NEED_MINIMAL);
       		opt->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
       		opt->xdl_opts |= value;
 2:  60015bbada ! 2:  c477b87cc6 blame: make diff algorithm configurable
     @@ t/t8015-blame-diff-algorithm.sh (new)
      +	Commit_1 }
      +	EOF
      +
     -+	git blame file.c > output &&
     -+	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" output > without_varying_parts &&
     -+	sed -e "s/ *$//g" without_varying_parts > actual &&
     ++	git blame file.c >output &&
     ++	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" output >without_varying_parts &&
     ++	sed -e "s/ *$//g" without_varying_parts >actual &&
      +	test_cmp expected actual
      +'
      +
     @@ t/t8015-blame-diff-algorithm.sh (new)
      +	Commit_2 }
      +	EOF
      +
     -+	git blame file.c --diff-algorithm histogram > output &&
     -+	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" output > without_varying_parts &&
     -+	sed -e "s/ *$//g" without_varying_parts > actual &&
     ++	git blame file.c --diff-algorithm histogram >output &&
     ++	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" output >without_varying_parts &&
     ++	sed -e "s/ *$//g" without_varying_parts >actual &&
      +	test_cmp expected actual
      +'
      +
     @@ t/t8015-blame-diff-algorithm.sh (new)
      +	Commit_2 }
      +	EOF
      +
     -+	git -c diff.algorithm=histogram blame file.c > output &&
     ++	git -c diff.algorithm=histogram blame file.c >output &&
      +	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" \
     -+	    -e "s/ *$//g" output > actual &&
     ++	    -e "s/ *$//g" output >actual &&
      +	test_cmp expected actual
      +'
      +
     @@ t/t8015-blame-diff-algorithm.sh (new)
      +	Commit_2 }
      +	EOF
      +
     -+	git -c diff.algorithm=myers blame file.c --diff-algorithm histogram > output &&
     ++	git -c diff.algorithm=myers blame file.c --diff-algorithm histogram >output &&
      +	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" \
     -+	    -e "s/ *$//g" output > actual &&
     ++	    -e "s/ *$//g" output >actual &&
      +	test_cmp expected actual
      +'
      +
     @@ t/t8015-blame-diff-algorithm.sh (new)
      +	Commit_2 G
      +	EOF
      +
     -+	git blame file.txt --minimal > output &&
     -+	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" output > actual &&
     ++	git blame file.txt --minimal >output &&
     ++	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" output >actual &&
      +	test_cmp expected actual
      +'
      +
     @@ t/t8015-blame-diff-algorithm.sh (new)
      +	Commit_2 G
      +	EOF
      +
     -+	git blame file.txt --minimal --diff-algorithm myers > output &&
     -+	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" output > actual &&
     ++	git blame file.txt --minimal --diff-algorithm myers >output &&
     ++	sed -e "s/^[^ ]* (\([^ ]*\) [^)]*)/\1/g" output >actual &&
      +	test_cmp expected actual
      +'
      +
Signature · 1 line
gitgitgadget