On Tue, May 15, 2018 at 6:56 PM, brian m. carlson
<sand...@crustytoothpaste.net> wrote:
> Strip out the index lines in the diff before comparing them, as these
> will differ between hash algorithms.  This leads to a smaller, simpler
> change than editing the index line.
>
> Signed-off-by: brian m. carlson <sand...@crustytoothpaste.net>
> ---
>  t/t3702-add-edit.sh | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/t/t3702-add-edit.sh b/t/t3702-add-edit.sh
> index 3cb74ca296..1be5cd5756 100755
> --- a/t/t3702-add-edit.sh
> +++ b/t/t3702-add-edit.sh
> @@ -40,7 +40,6 @@ test_expect_success 'setup' '
>
>  cat > expected-patch << EOF
>  diff --git a/file b/file
> -index b9834b5..9020acb 100644
>  --- a/file
>  +++ b/file
>  @@ -1,11 +1,6 @@
> @@ -80,7 +79,6 @@ EOF
>
>  cat > expected << EOF
>  diff --git a/file b/file
> -index b9834b5..ef6e94c 100644
>  --- a/file
>  +++ b/file
>  @@ -1,10 +1,12 @@
> @@ -100,7 +98,7 @@ EOF
>
>  echo "#!$SHELL_PATH" >fake-editor.sh
>  cat >> fake-editor.sh <<\EOF
> -mv -f "$1" orig-patch &&
> +egrep -v '^index' "$1" >orig-patch &&

This reminds me of the way we test alot of the patch format already.
But there we use standard grep as opposed to egrep.

git grep egrep doesn't show a lot of hits, but all commits
that mention egrep found via 'git log --grep egrep' mention
that there is some sort of portability issue for using egrep
specifically.

Is the ^index a problem for standard grep, i.e. do we need to fix
other places?

$ git grep -- "-v index"
t4061-diff-indent.sh:318:       grep -v index out-diff-files-raw
>out-diff-files-compacted &&
t4061-diff-indent.sh:327:       grep -v index out-diff-files-raw2
>out-diff-files-compacted2 &&
t4061-diff-indent.sh:336:       grep -v index out-diff-files-raw
>out-diff-files &&
t4061-diff-indent.sh:345:       grep -v index out-diff-files-raw2
>out-diff-files &&
t4061-diff-indent.sh:354:       grep -v index out-diff-files-raw3
>out-diff-files-compacted &&
t4061-diff-indent.sh:363:       grep -v index out-diff-files-raw4
>out-diff-files &&

The commit message seems to be the same at most of the patches
in this series, which makes sense, but a mention regarding the choice of
grep would be appreciated!

Thanks,
Stefan

Reply via email to