Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package dyff for openSUSE:Factory checked in at 2024-02-07 18:49:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dyff (Old) and /work/SRC/openSUSE:Factory/.dyff.new.1815 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dyff" Wed Feb 7 18:49:43 2024 rev:5 rq:1144799 version:1.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/dyff/dyff.changes 2023-10-19 22:51:47.592167608 +0200 +++ /work/SRC/openSUSE:Factory/.dyff.new.1815/dyff.changes 2024-02-07 18:51:52.550219898 +0100 @@ -1,0 +2,22 @@ +Tue Feb 06 20:00:53 UTC 2024 - opensuse_buildserv...@ojkastl.de + +- Update to version 1.7.0: + * Use Ginkgo version from modules + * fix incorrect newline handling + * adapt testcases + * fix diff issue with latest version of go-diff lib + * improve multiline string diff handling + * Bump github.com/onsi/gomega from 1.31.0 to 1.31.1 + * Bump github.com/onsi/ginkgo/v2 from 2.14.0 to 2.15.0 + * Bump github.com/onsi/gomega from 1.30.0 to 1.31.0 + * Handle comparisons of boolean values correctly + * Bump github.com/onsi/ginkgo/v2 from 2.13.2 to 2.14.0 + * Bump github.com/onsi/ginkgo/v2 from 2.13.1 to 2.13.2 + * Bump github.com/onsi/ginkgo/v2 from 2.13.0 to 2.13.1 + * Bump github.com/onsi/gomega from 1.29.0 to 1.30.0 + * Bump github.com/spf13/cobra from 1.7.0 to 1.8.0 + * Bump github.com/onsi/gomega from 1.28.1 to 1.29.0 + * Bump github.com/onsi/gomega from 1.28.0 to 1.28.1 + * Remove usage of deprecated `wrap.Error` function + +------------------------------------------------------------------- Old: ---- dyff-1.6.0.obscpio New: ---- dyff-1.7.0.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dyff.spec ++++++ --- /var/tmp/diff_new_pack.lgcrUR/_old 2024-02-07 18:51:53.142241197 +0100 +++ /var/tmp/diff_new_pack.lgcrUR/_new 2024-02-07 18:51:53.142241197 +0100 @@ -1,7 +1,7 @@ # # spec file for package dyff # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define __arch_install_post export NO_BRP_STRIP_DEBUG=true Name: dyff -Version: 1.6.0 +Version: 1.7.0 Release: 0 Summary: Diff tool for YAML files, and sometimes JSON License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.lgcrUR/_old 2024-02-07 18:51:53.174242348 +0100 +++ /var/tmp/diff_new_pack.lgcrUR/_new 2024-02-07 18:51:53.174242348 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/homeport/dyff</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v1.6.0</param> + <param name="revision">v1.7.0</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.lgcrUR/_old 2024-02-07 18:51:53.194243067 +0100 +++ /var/tmp/diff_new_pack.lgcrUR/_new 2024-02-07 18:51:53.198243211 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/homeport/dyff</param> - <param name="changesrevision">bdf15b93b8edf0adb6a01cf9ca8ede59f57a7e5a</param></service></servicedata> + <param name="changesrevision">a0a00d72a7cd74b5485085d2c1acb4b1be11b17c</param></service></servicedata> (No newline at EOF) ++++++ dyff-1.6.0.obscpio -> dyff-1.7.0.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/Makefile new/dyff-1.7.0/Makefile --- old/dyff-1.6.0/Makefile 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/Makefile 2024-02-06 20:50:33.000000000 +0100 @@ -30,7 +30,7 @@ .PHONY: test test: - @ginkgo run \ + @go run -mod=mod github.com/onsi/ginkgo/v2/ginkgo run \ --coverprofile=unit.coverprofile \ --randomize-all \ --randomize-suites \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/assets/issues/issue-225/expected-dyff-spruce.human new/dyff-1.7.0/assets/issues/issue-225/expected-dyff-spruce.human --- old/dyff-1.6.0/assets/issues/issue-225/expected-dyff-spruce.human 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/assets/issues/issue-225/expected-dyff-spruce.human 2024-02-06 20:50:33.000000000 +0100 @@ -1,10 +1,9 @@ [1mdata[0m - [38;2;199;196;63m± value change in multiline text (one insert)[0m - [38;2;105;105;105mstring foo = "bar";[0m - [38;2;88;191;56mstring x_forwarded_host = 53;[0m - [38;2;88;191;56mstring worker_status = 54;[0m - [38;2;88;191;56muint64 worker_cpu_time_micro = 55;[0m - + [38;2;199;196;63m± value change in multiline text (one insert, no deletions)[0m + [38;2;105;105;105m string foo = "bar";[0m + [38;2;88;191;56m + string x_forwarded_host = 53;[0m + [38;2;88;191;56m + string worker_status = 54;[0m + [38;2;88;191;56m + uint64 worker_cpu_time_micro = 55;[0m diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/assets/kubernetes/configmaps/expected-dyff-spruce.human new/dyff-1.7.0/assets/kubernetes/configmaps/expected-dyff-spruce.human --- old/dyff-1.6.0/assets/kubernetes/configmaps/expected-dyff-spruce.human 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/assets/kubernetes/configmaps/expected-dyff-spruce.human 2024-02-06 20:50:33.000000000 +0100 @@ -1,29 +1,28 @@ [1mdata[0m.[1mpinniped.yaml[0m - [38;2;199;196;63m± value change in multiline text (one insert, one deletion)[0m - [38;2;105;105;105mdiscovery:[0m - [38;2;105;105;105m url: null[0m - [38;2;105;105;105mapi:[0m - [38;2;105;105;105m servingCertificate:[0m - [38;2;105;105;105m durationSeconds: 2592000[0m - [38;2;105;105;105m renewBeforeSeconds: [0m[38;2;88;191;56m1[0m[38;2;105;105;105m2160000[0m - [38;2;105;105;105mapiGroupSuffix: pinniped.dev[0m - [38;2;105;105;105m# aggregatedAPIServerPort may be set here, although other YAML references to the default port (10250) may also need to be updated[0m - [38;2;105;105;105m# impersonationProxyServerPort may be set here, although other YAML references to the default port (8444) may also need to be updated[0m - [38;2;105;105;105mnames:[0m - [38;2;105;105;105m servingCertificateSecret: pinniped-concierge-api-tls-serving-certificate[0m - [38;2;105;105;105m credentialIssuer: pinniped-concierge-config[0m - [38;2;105;105;105m apiService: pinniped-concierge-api[0m - [38;2;105;105;105m impersonationLoadBalancerService: pinniped-concierge-impersonation-proxy-load-balancer[0m - [38;2;105;105;105m impersonationClusterIPService: pinniped-concierge-impersonation-proxy-cluster-ip[0m - [38;2;105;105;105m impersonationTLSCertificateSecret: pinniped-concierge-impersonation-proxy-tls-serving-certificate[0m - [38;2;105;105;105m impersonationCACertificateSecret: pinniped-concierge-impersonation-proxy-ca-certificate[0m - [38;2;105;105;105m impersonationSignerSecret: pinniped-concierge-impersonation-proxy-signer-ca-certificate[0m - [38;2;105;105;105m agentServiceAccount: pinniped-concierge-kube-cert-agent[0m - [38;2;185;49;27mlabels: {"app": "pinniped-concierge"}[0m - [38;2;105;105;105mkubeCertAgent:[0m - [38;2;105;105;105m namePrefix: pinniped-concierge-kube-cert-agent-[0m - [38;2;105;105;105m image: projects.registry.vmware.com/pinniped/pinniped-server:latest[0m - + [38;2;199;196;63m± value change in multiline text (one insert, two deletions)[0m + [38;2;105;105;105m discovery:[0m + [38;2;105;105;105m url: null[0m + [38;2;105;105;105m api:[0m + [38;2;105;105;105m servingCertificate:[0m + [38;2;105;105;105m durationSeconds: 2592000[0m + [38;2;185;49;27m - renewBeforeSeconds: 2160000[0m + [38;2;88;191;56m + renewBeforeSeconds: 12160000[0m + [38;2;105;105;105m apiGroupSuffix: pinniped.dev[0m + [38;2;105;105;105m # aggregatedAPIServerPort may be set here, although other YAML references to the default port (10250) may also need to be updated[0m + [38;2;105;105;105m # impersonationProxyServerPort may be set here, although other YAML references to the default port (8444) may also need to be updated[0m + [38;2;105;105;105m names:[0m + [38;2;105;105;105m [0m + [38;2;105;105;105m [five lines unchanged)][0m + [38;2;105;105;105m [0m + [38;2;105;105;105m impersonationTLSCertificateSecret: pinniped-concierge-impersonation-proxy-tls-serving-certificate[0m + [38;2;105;105;105m impersonationCACertificateSecret: pinniped-concierge-impersonation-proxy-ca-certificate[0m + [38;2;105;105;105m impersonationSignerSecret: pinniped-concierge-impersonation-proxy-signer-ca-certificate[0m + [38;2;105;105;105m agentServiceAccount: pinniped-concierge-kube-cert-agent[0m + [38;2;185;49;27m - labels: {"app": "pinniped-concierge"}[0m + [38;2;105;105;105m kubeCertAgent:[0m + [38;2;105;105;105m namePrefix: pinniped-concierge-kube-cert-agent-[0m + [38;2;105;105;105m image: projects.registry.vmware.com/pinniped/pinniped-server:latest[0m + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/assets/multiline/expected-dyff-spruce.human new/dyff-1.7.0/assets/multiline/expected-dyff-spruce.human --- old/dyff-1.6.0/assets/multiline/expected-dyff-spruce.human 1970-01-01 01:00:00.000000000 +0100 +++ new/dyff-1.7.0/assets/multiline/expected-dyff-spruce.human 2024-02-06 20:50:33.000000000 +0100 @@ -0,0 +1,97 @@ + +[1mfiles[0m.[1;3msimple[0m.[1mcontent[0m + [38;2;199;196;63m± value change in multiline text (three inserts, three deletions)[0m + [38;2;105;105;105m UnChanged line[0m + [38;2;185;49;27m - This line will change 1[0m + [38;2;88;191;56m + This line changed 1[0m + [38;2;105;105;105m UnChanged line[0m + [38;2;185;49;27m - This line will change 2[0m + [38;2;88;191;56m + This line changed 2[0m + [38;2;105;105;105m UnChanged line[0m + [38;2;185;49;27m - This line will change 3[0m + [38;2;88;191;56m + This line changed 3[0m + + +[1mfiles[0m.[1;3mnewline[0m.[1mcontent[0m + [38;2;199;196;63m± value change in multiline text (four inserts, four deletions)[0m + [38;2;105;105;105m [0m + [38;2;185;49;27m - [0m + [38;2;185;49;27m - This line will change 1[0m + [38;2;88;191;56m + This line changed 1[0m + [38;2;105;105;105m UnChanged line[0m + [38;2;105;105;105m [0m + [38;2;185;49;27m - This line will change 2[0m + [38;2;88;191;56m + This line changed 2[0m + [38;2;105;105;105m UnChanged line[0m + [38;2;105;105;105m [0m + [38;2;105;105;105m [0m + [38;2;185;49;27m - [0m + [38;2;105;105;105m Moved line[0m + [38;2;88;191;56m + [0m + [38;2;105;105;105m [0m + [38;2;105;105;105m [0m + [38;2;105;105;105m UnChanged line[0m + [38;2;185;49;27m - This line will change 3[0m + [38;2;88;191;56m + This line changed 3[0m + [38;2;88;191;56m + [0m + [38;2;105;105;105m [0m + [38;2;105;105;105m [0m + + +[1mfiles[0m.[1;3mcomplex[0m.[1mcontent[0m + [38;2;199;196;63m± value change in multiline text (two inserts, two deletions)[0m + [38;2;105;105;105m Begin line 1[0m + [38;2;105;105;105m Begin line 2[0m + [38;2;105;105;105m Begin line 3[0m + [38;2;105;105;105m Begin line 4[0m + [38;2;105;105;105m [0m + [38;2;105;105;105m [four lines unchanged)][0m + [38;2;105;105;105m [0m + [38;2;105;105;105m PreChange line 1[0m + [38;2;105;105;105m PreChange line 2[0m + [38;2;105;105;105m PreChange line 3[0m + [38;2;105;105;105m PreChange line 4[0m + [38;2;185;49;27m - This line will change 1[0m + [38;2;185;49;27m - This line will change 2[0m + [38;2;88;191;56m + This line changed 1[0m + [38;2;88;191;56m + This line changed 2[0m + [38;2;105;105;105m PostChange line 1[0m + [38;2;105;105;105m PostChange line 2[0m + [38;2;105;105;105m PostChange line 3[0m + [38;2;105;105;105m PostChange line 4[0m + [38;2;105;105;105m [0m + [38;2;105;105;105m [three lines unchanged)][0m + [38;2;105;105;105m [0m + [38;2;105;105;105m PreAdd line 1[0m + [38;2;105;105;105m PreAdd line 2[0m + [38;2;105;105;105m PreAdd line 3[0m + [38;2;105;105;105m PreAdd line 4[0m + [38;2;88;191;56m + This line was added[0m + [38;2;88;191;56m + This line was added[0m + [38;2;105;105;105m PostAdd line 1[0m + [38;2;105;105;105m PostAdd line 2[0m + [38;2;105;105;105m PostAdd line 3[0m + [38;2;105;105;105m PostAdd line 4[0m + [38;2;105;105;105m [0m + [38;2;105;105;105m [two lines unchanged)][0m + [38;2;105;105;105m [0m + [38;2;105;105;105m PreDelete line 1[0m + [38;2;105;105;105m PreDelete line 2[0m + [38;2;105;105;105m PreDelete line 3[0m + [38;2;105;105;105m PreDelete line 4[0m + [38;2;185;49;27m - This line will be deleted[0m + [38;2;185;49;27m - This line will be deleted[0m + [38;2;185;49;27m - This line will be deleted[0m + [38;2;105;105;105m PostDelete line 1[0m + [38;2;105;105;105m PostDelete line 2[0m + [38;2;105;105;105m PostDelete line 3[0m + [38;2;105;105;105m PostDelete line 4[0m + [38;2;105;105;105m [0m + [38;2;105;105;105m [22 lines unchanged)][0m + [38;2;105;105;105m [0m + [38;2;105;105;105m End line 1[0m + [38;2;105;105;105m End line 2[0m + [38;2;105;105;105m End line 3[0m + [38;2;105;105;105m End line 4[0m + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/assets/multiline/from.yml new/dyff-1.7.0/assets/multiline/from.yml --- old/dyff-1.6.0/assets/multiline/from.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/dyff-1.7.0/assets/multiline/from.yml 2024-02-06 20:50:33.000000000 +0100 @@ -0,0 +1,100 @@ +files: +- name: simple + content: | + UnChanged line + This line will change 1 + UnChanged line + This line will change 2 + UnChanged line + This line will change 3 + +- name: newline + # + to keep trailing newlines + content: |+ + + + This line will change 1 + UnChanged line + + This line will change 2 + UnChanged line + + + + Moved line + + + UnChanged line + This line will change 3 + + +- name: complex + content: | + Begin line 1 + Begin line 2 + Begin line 3 + Begin line 4 + Truncated line + Truncated line + Truncated line + Truncated line + PreChange line 1 + PreChange line 2 + PreChange line 3 + PreChange line 4 + This line will change 1 + This line will change 2 + PostChange line 1 + PostChange line 2 + PostChange line 3 + PostChange line 4 + Truncated line + Truncated line + Truncated line + PreAdd line 1 + PreAdd line 2 + PreAdd line 3 + PreAdd line 4 + PostAdd line 1 + PostAdd line 2 + PostAdd line 3 + PostAdd line 4 + Truncated line + Truncated line + PreDelete line 1 + PreDelete line 2 + PreDelete line 3 + PreDelete line 4 + This line will be deleted + This line will be deleted + This line will be deleted + PostDelete line 1 + PostDelete line 2 + PostDelete line 3 + PostDelete line 4 + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + End line 1 + End line 2 + End line 3 + End line 4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/assets/multiline/to.yml new/dyff-1.7.0/assets/multiline/to.yml --- old/dyff-1.6.0/assets/multiline/to.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/dyff-1.7.0/assets/multiline/to.yml 2024-02-06 20:50:33.000000000 +0100 @@ -0,0 +1,99 @@ +files: +- name: simple + content: | + UnChanged line + This line changed 1 + UnChanged line + This line changed 2 + UnChanged line + This line changed 3 + +- name: newline + # + to keep trailing newlines + content: |+ + + This line changed 1 + UnChanged line + + This line changed 2 + UnChanged line + + + Moved line + + + + UnChanged line + This line changed 3 + + + +- name: complex + content: | + Begin line 1 + Begin line 2 + Begin line 3 + Begin line 4 + Truncated line + Truncated line + Truncated line + Truncated line + PreChange line 1 + PreChange line 2 + PreChange line 3 + PreChange line 4 + This line changed 1 + This line changed 2 + PostChange line 1 + PostChange line 2 + PostChange line 3 + PostChange line 4 + Truncated line + Truncated line + Truncated line + PreAdd line 1 + PreAdd line 2 + PreAdd line 3 + PreAdd line 4 + This line was added + This line was added + PostAdd line 1 + PostAdd line 2 + PostAdd line 3 + PostAdd line 4 + Truncated line + Truncated line + PreDelete line 1 + PreDelete line 2 + PreDelete line 3 + PreDelete line 4 + PostDelete line 1 + PostDelete line 2 + PostDelete line 3 + PostDelete line 4 + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + Truncated line + End line 1 + End line 2 + End line 3 + End line 4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/assets/testbed/expected-dyff-gopatch.human new/dyff-1.7.0/assets/testbed/expected-dyff-gopatch.human --- old/dyff-1.6.0/assets/testbed/expected-dyff-gopatch.human 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/assets/testbed/expected-dyff-gopatch.human 2024-02-06 20:50:33.000000000 +0100 @@ -30,12 +30,14 @@ + one, two, three, four, five, six /multiline (document #1) - ± value change - - Yes, + Yes, strings - strings can have multiple - can lines - have - multiple + ± value change in multiline text (one insert, one deletion) + - Yes, + - strings + - can + - have + - multiple + + Yes, strings + + can have multiple lines diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/assets/testbed/expected-dyff-spruce.human new/dyff-1.7.0/assets/testbed/expected-dyff-spruce.human --- old/dyff-1.6.0/assets/testbed/expected-dyff-spruce.human 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/assets/testbed/expected-dyff-spruce.human 2024-02-06 20:50:33.000000000 +0100 @@ -30,12 +30,14 @@ + one, two, three, four, five, six multiline (document #1) - ± value change - - Yes, + Yes, strings - strings can have multiple - can lines - have - multiple + ± value change in multiline text (one insert, one deletion) + - Yes, + - strings + - can + - have + - multiple + + Yes, strings + + can have multiple lines diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/go.mod new/dyff-1.7.0/go.mod --- old/dyff-1.6.0/go.mod 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/go.mod 2024-02-06 20:50:33.000000000 +0100 @@ -8,23 +8,28 @@ github.com/gonvenience/neat v1.3.12 github.com/gonvenience/term v1.0.2 github.com/gonvenience/text v1.0.7 - github.com/gonvenience/wrap v1.1.2 + github.com/gonvenience/wrap v1.2.0 github.com/gonvenience/ytbx v1.4.4 github.com/lucasb-eyer/go-colorful v1.2.0 github.com/mitchellh/hashstructure v1.1.0 - github.com/onsi/ginkgo/v2 v2.13.0 - github.com/onsi/gomega v1.28.0 - github.com/sergi/go-diff v1.3.1 - github.com/spf13/cobra v1.7.0 + github.com/onsi/ginkgo/v2 v2.15.0 + github.com/onsi/gomega v1.31.1 + github.com/spf13/cobra v1.8.0 github.com/texttheater/golang-levenshtein v1.0.1 gopkg.in/yaml.v3 v3.0.1 ) +// usage untagged version of go-diff +// cause https://github.com/sergi/go-diff/issues/123 +// fixed in https://github.com/sergi/go-diff/pull/136 +// but currently not tagged +require github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 + require ( github.com/BurntSushi/toml v1.3.2 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/mattn/go-ciede2000 v0.0.0-20170301095244-782e8c62fec3 // indirect @@ -33,11 +38,11 @@ github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.8.4 // indirect github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sync v0.4.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - golang.org/x/tools v0.14.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/term v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.17.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/go.sum new/dyff-1.7.0/go.sum --- old/dyff-1.6.0/go.sum 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/go.sum 2024-02-06 20:50:33.000000000 +0100 @@ -1,12 +1,12 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= @@ -18,12 +18,12 @@ github.com/gonvenience/term v1.0.2/go.mod h1:wThTR+3MzWtWn7XGVW6qQ65uaVf8GHED98KmwpuEQeo= github.com/gonvenience/text v1.0.7 h1:YmIqmgTwxnACYCG59DykgMbomwteYyNhAmEUEJtPl14= github.com/gonvenience/text v1.0.7/go.mod h1:OAjH+mohRszffLY6OjgQcUXiSkbrIavooFpfIt1ZwAs= -github.com/gonvenience/wrap v1.1.2 h1:xPKxNwL1HCguwyM+HlP/1CIuc9LRd7k8RodLwe9YTZA= -github.com/gonvenience/wrap v1.1.2/go.mod h1:GiryBSXoI3BAAhbWD1cZVj7RZmtiu0ERi/6R6eJfslI= +github.com/gonvenience/wrap v1.2.0 h1:CwAoa60QIBVmQn/aUregAbk9FstEr17k9vCYpKF972c= +github.com/gonvenience/wrap v1.2.0/go.mod h1:iNijaTmFD8+ORmNp9iS+dSBcCJrmIwwyoYLUngToGdk= github.com/gonvenience/ytbx v1.4.4 h1:jQopwyaLsVGuwdxSiN4WkXjsEaFNPJ3V4lUj7eyEpzo= github.com/gonvenience/ytbx v1.4.4/go.mod h1:w37+MKCPcCMY/jpPNmEklD4xKqrOAVBO6kIWW2+uI6M= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 h1:hR7/MlvK23p6+lIw9SN1TigNLn9ZnF3W4SYRKq2gAHs= github.com/google/pprof v0.0.0-20230602150820-91b7bce49751/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= @@ -46,18 +46,20 @@ github.com/mitchellh/hashstructure v1.1.0/go.mod h1:xUDAozZz0Wmdiufv0uyhnHkUTN6/6d8ulp4AwfLKrmA= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= -github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= -github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c= -github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8= +github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= +github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= +github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= +github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -69,20 +71,29 @@ github.com/texttheater/golang-levenshtein v1.0.1/go.mod h1:PYAKrbF5sAiq9wd+H82hs7gNaen0CplQ9uvm6+enD/8= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 h1:JwtAtbp7r/7QSyGz8mKUbYJBg2+6Cd7OjM8o/GNOcVo= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/internal/cmd/between.go new/dyff-1.7.0/internal/cmd/between.go --- old/dyff-1.6.0/internal/cmd/between.go 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/internal/cmd/between.go 2024-02-06 20:50:33.000000000 +0100 @@ -21,7 +21,8 @@ package cmd import ( - "github.com/gonvenience/wrap" + "fmt" + "github.com/gonvenience/ytbx" "github.com/spf13/cobra" @@ -60,7 +61,7 @@ from, to, err := ytbx.LoadFiles(fromLocation, toLocation) if err != nil { - return wrap.Errorf(err, "failed to load input files") + return fmt.Errorf("failed to load input files: %w", err) } // If the main change root flag is set, this (re-)sets the individual change roots of the two input files @@ -72,14 +73,14 @@ // Change root of 'from' input file if change root flag for 'from' is set if betweenCmdSettings.chrootFrom != "" { if err = dyff.ChangeRoot(&from, betweenCmdSettings.chrootFrom, reportOptions.useGoPatchPaths, betweenCmdSettings.translateListToDocuments); err != nil { - return wrap.Errorf(err, "failed to change root of %s to path %s", from.Location, betweenCmdSettings.chrootFrom) + return fmt.Errorf("failed to change root of %s to path %s: %w", from.Location, betweenCmdSettings.chrootFrom, err) } } // Change root of 'to' input file if change root flag for 'to' is set if betweenCmdSettings.chrootTo != "" { if err = dyff.ChangeRoot(&to, betweenCmdSettings.chrootTo, reportOptions.useGoPatchPaths, betweenCmdSettings.translateListToDocuments); err != nil { - return wrap.Errorf(err, "failed to change root of %s to path %s", to.Location, betweenCmdSettings.chrootTo) + return fmt.Errorf("failed to change root of %s to path %s: %w", to.Location, betweenCmdSettings.chrootTo, err) } } @@ -90,7 +91,7 @@ ) if err != nil { - return wrap.Errorf(err, "failed to compare input files") + return fmt.Errorf("failed to compare input files: %w", err) } if reportOptions.filters != nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/internal/cmd/common.go new/dyff-1.7.0/internal/cmd/common.go --- old/dyff-1.6.0/internal/cmd/common.go 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/internal/cmd/common.go 2024-02-06 20:50:33.000000000 +0100 @@ -30,7 +30,6 @@ "github.com/gonvenience/bunt" "github.com/gonvenience/neat" - "github.com/gonvenience/wrap" "github.com/gonvenience/ytbx" "github.com/spf13/cobra" yamlv3 "gopkg.in/yaml.v3" @@ -47,6 +46,8 @@ exitWithCode bool omitHeader bool useGoPatchPaths bool + minorChangeThreshold float64 + multilineContextLines int additionalIdentifiers []string filters []string excludes []string @@ -63,6 +64,8 @@ exitWithCode: false, omitHeader: false, useGoPatchPaths: false, + minorChangeThreshold: 0.1, + multilineContextLines: 4, additionalIdentifiers: nil, filters: nil, excludes: nil, @@ -118,7 +121,7 @@ // stored in the provided input file to the standard output func (w *OutputWriter) WriteToStdout(filename string) error { if err := w.write(os.Stdout, filename); err != nil { - return wrap.Error(err, bunt.Sprint("failed to write output to _*stdout*_")) + return bunt.Errorf("failed to write output to _*stdout*_: %w", err) } return nil @@ -133,13 +136,13 @@ // Force plain mode to make sure there are no ANSI sequences w.PlainMode = true if err := w.write(bufWriter, filename); err != nil { - return wrap.Errorf(err, "failed to write output to %s", humanReadableFilename(filename)) + return fmt.Errorf("failed to write output to %s: %w", humanReadableFilename(filename), err) } // Write the buffered output to the provided input file (override in place) bufWriter.Flush() if err := os.WriteFile(filename, buf.Bytes(), 0644); err != nil { - return wrap.Errorf(err, "failed to overwrite %s in place", humanReadableFilename(filename)) + return fmt.Errorf("failed to overwrite %s in place: %w", humanReadableFilename(filename), err) } return nil @@ -148,7 +151,7 @@ func (w *OutputWriter) write(writer io.Writer, filename string) error { inputFile, err := ytbx.LoadFile(filename) if err != nil { - return wrap.Errorf(err, "failed to load input from %s", humanReadableFilename(filename)) + return fmt.Errorf("failed to load input from %s: %w", humanReadableFilename(filename), err) } for _, document := range inputFile.Documents { @@ -201,12 +204,13 @@ switch strings.ToLower(reportOptions.style) { case "human", "bosh": reportWriter = &dyff.HumanReport{ - Report: report, - DoNotInspectCerts: reportOptions.doNotInspectCerts, - NoTableStyle: reportOptions.noTableStyle, - OmitHeader: reportOptions.omitHeader, - UseGoPatchPaths: reportOptions.useGoPatchPaths, - MinorChangeThreshold: 0.1, + Report: report, + DoNotInspectCerts: reportOptions.doNotInspectCerts, + NoTableStyle: reportOptions.noTableStyle, + OmitHeader: reportOptions.omitHeader, + UseGoPatchPaths: reportOptions.useGoPatchPaths, + MinorChangeThreshold: reportOptions.minorChangeThreshold, + MultilineContextLines: reportOptions.multilineContextLines, } case "brief", "short", "summary": @@ -215,14 +219,11 @@ } default: - return wrap.Errorf( - fmt.Errorf(cmd.UsageString()), - "unknown output style %s", reportOptions.style, - ) + return fmt.Errorf("unknown output style %s: %w", reportOptions.style, fmt.Errorf(cmd.UsageString())) } if err := reportWriter.WriteReport(os.Stdout); err != nil { - return wrap.Errorf(err, "failed to print report") + return fmt.Errorf("failed to print report: %w", err) } // If configured, make sure `dyff` exists with an exit status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/internal/cmd/json.go new/dyff-1.7.0/internal/cmd/json.go --- old/dyff-1.6.0/internal/cmd/json.go 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/internal/cmd/json.go 2024-02-06 20:50:33.000000000 +0100 @@ -57,10 +57,7 @@ var errors []error for _, filename := range args { if ytbx.IsStdin(filename) && jsonCmdSettings.inplace { - return wrap.Error( - fmt.Errorf("cannot use in-place flag in combination with input from STDIN"), - "incompatible flags", - ) + return fmt.Errorf("incompatible flags: %w", fmt.Errorf("cannot use in-place flag in combination with input from STDIN")) } if jsonCmdSettings.inplace { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/internal/cmd/lastApplied.go new/dyff-1.7.0/internal/cmd/lastApplied.go --- old/dyff-1.6.0/internal/cmd/lastApplied.go 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/internal/cmd/lastApplied.go 2024-02-06 20:50:33.000000000 +0100 @@ -23,7 +23,6 @@ import ( "fmt" - "github.com/gonvenience/wrap" "github.com/gonvenience/ytbx" "github.com/spf13/cobra" yamlv3 "gopkg.in/yaml.v3" @@ -61,7 +60,7 @@ report, err := dyff.CompareInputFiles(lastConfiguration, inputFile, dyff.IgnoreOrderChanges(reportOptions.ignoreOrderChanges)) if err != nil { - return wrap.Errorf(err, "failed to compare input files") + return fmt.Errorf("failed to compare input files: %w", err) } return writeReport(cmd, report) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/internal/cmd/yaml.go new/dyff-1.7.0/internal/cmd/yaml.go --- old/dyff-1.6.0/internal/cmd/yaml.go 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/internal/cmd/yaml.go 2024-02-06 20:50:33.000000000 +0100 @@ -21,6 +21,8 @@ package cmd import ( + "fmt" + "github.com/gonvenience/bunt" "github.com/gonvenience/wrap" "github.com/gonvenience/ytbx" @@ -57,10 +59,7 @@ var errors []error for _, filename := range args { if ytbx.IsStdin(filename) && yamlCmdSettings.inplace { - return wrap.Error( - bunt.Errorf("cannot use in-place flag in combination with input from _*stdin*_"), - "incompatible flags", - ) + return fmt.Errorf("incompatible flags: %w", bunt.Errorf("cannot use in-place flag in combination with input from _*stdin*_")) } if yamlCmdSettings.inplace { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/pkg/dyff/compare_test.go new/dyff-1.7.0/pkg/dyff/compare_test.go --- old/dyff-1.6.0/pkg/dyff/compare_test.go 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/pkg/dyff/compare_test.go 2024-02-06 20:50:33.000000000 +0100 @@ -88,6 +88,16 @@ Expect(result[0]).To(BeSameDiffAs(singleDiff("/some/yaml/structure/name", dyff.MODIFICATION, 1, 2))) }) + It("should return that different representations of true are treated as the same", func() { + from := yml("---\nkey: true") + + to := yml("---\nkey: True") + + result, err := compare(from, to) + Expect(err).To(BeNil()) + Expect(result).To(BeNil()) + }) + It("should return that a float was modified", func() { from := yml(`--- some: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/pkg/dyff/core.go new/dyff-1.7.0/pkg/dyff/core.go --- old/dyff-1.6.0/pkg/dyff/core.go 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/pkg/dyff/core.go 2024-02-06 20:50:33.000000000 +0100 @@ -27,7 +27,6 @@ "github.com/gonvenience/bunt" "github.com/gonvenience/text" - "github.com/gonvenience/wrap" "github.com/gonvenience/ytbx" "github.com/mitchellh/hashstructure" yamlv3 "gopkg.in/yaml.v3" @@ -213,6 +212,9 @@ case "!!null": // Ignore different ways to define a null value + case "!!bool": + diffs, err = compare.boolValues(path, from, to) + default: if from.Value != to.Value { diffs, err = []Diff{{ @@ -608,6 +610,48 @@ return result, nil } +func (compare *compare) boolValues(path ytbx.Path, from *yamlv3.Node, to *yamlv3.Node) ([]Diff, error) { + boolFrom, err := toBool(from.Value) + if err != nil { + return nil, err + } + boolTo, err := toBool(to.Value) + if err != nil { + return nil, err + } + result := make([]Diff, 0) + if boolFrom != boolTo { + result = append(result, Diff{ + &path, + []Detail{{ + Kind: MODIFICATION, + From: from, + To: to, + }}, + }) + } + + return result, nil +} + +// this uses the various values mentioned in https://yaml.org/type/bool.html +var trueValues = [...]string{"y", "Y", "yes", "Yes", "YES", "true", "True", "TRUE", "on", "On", "ON"} +var falseValues = [...]string{"n", "N", "no", "No", "NO", "false", "False", "FALSE", "off", "Off", "OFF"} + +func toBool(input string) (bool, error) { + for _, t := range trueValues { + if input == t { + return true, nil + } + } + for _, f := range falseValues { + if input == f { + return false, nil + } + } + return false, fmt.Errorf("not a valid boolean value: '%s'", input) +} + func (compare *compare) findOrderChangesInSimpleList(fromCommon, toCommon []*yamlv3.Node) []Detail { // Try to find order changes ... if len(fromCommon) == len(toCommon) { @@ -961,7 +1005,7 @@ } if err != nil { - panic(wrap.Errorf(err, "failed to calculate hash of %#v", node.Value)) + panic(fmt.Errorf("failed to calculate hash of %#v: %w", node.Value, err)) } return hash diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/pkg/dyff/core_suite_test.go new/dyff-1.7.0/pkg/dyff/core_suite_test.go --- old/dyff-1.6.0/pkg/dyff/core_suite_test.go 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/pkg/dyff/core_suite_test.go 2024-02-06 20:50:33.000000000 +0100 @@ -124,11 +124,13 @@ Expect(err).To(BeNil()) reportWriter := &dyff.HumanReport{ - Report: report, - DoNotInspectCerts: false, - NoTableStyle: false, - OmitHeader: true, - UseGoPatchPaths: useGoPatchPaths, + Report: report, + DoNotInspectCerts: false, + NoTableStyle: false, + OmitHeader: true, + UseGoPatchPaths: useGoPatchPaths, + MinorChangeThreshold: 0.1, + MultilineContextLines: 4, } buffer := &bytes.Buffer{} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/pkg/dyff/output_human.go new/dyff-1.7.0/pkg/dyff/output_human.go --- old/dyff-1.6.0/pkg/dyff/output_human.go 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/pkg/dyff/output_human.go 2024-02-06 20:50:33.000000000 +0100 @@ -29,6 +29,7 @@ "encoding/pem" "fmt" "io" + "math" "strings" "unicode/utf8" @@ -51,11 +52,12 @@ // HumanReport is a reporter with human readable output in mind type HumanReport struct { Report - MinorChangeThreshold float64 - NoTableStyle bool - DoNotInspectCerts bool - OmitHeader bool - UseGoPatchPaths bool + MinorChangeThreshold float64 + MultilineContextLines int + NoTableStyle bool + DoNotInspectCerts bool + OmitHeader bool + UseGoPatchPaths bool } // WriteReport writes a human readable report to the provided writer @@ -342,48 +344,57 @@ ) case isMultiLine(from, to): - if !bunt.UseColors() { - _, _ = output.WriteString(yellow("%c value change\n", MODIFICATION)) - report.writeTextBlocks(output, 0, - red("%s", createStringWithPrefix(" - ", from)), - green("%s", createStringWithPrefix(" + ", to)), - ) - } else { - dmp := diffmatchpatch.New() - diff := dmp.DiffMain(from, to, true) - diff = dmp.DiffCleanupSemantic(diff) - diff = dmp.DiffCleanupEfficiency(diff) - - var ins, del int - var buf bytes.Buffer - for _, d := range diff { - switch d.Type { - case diffmatchpatch.DiffInsert: - fmt.Fprint(&buf, green("%s", d.Text)) - ins++ - - case diffmatchpatch.DiffDelete: - fmt.Fprint(&buf, red("%s", d.Text)) - del++ - - case diffmatchpatch.DiffEqual: - fmt.Fprint(&buf, dimgray("%s", d.Text)) + // create line by line diff + dmp := diffmatchpatch.New() + oldIdx, newIdx, lines := dmp.DiffLinesToChars(from, to) + diff := dmp.DiffMain(oldIdx, newIdx, false) + diff = dmp.DiffCharsToLines(diff, lines) + + var ins, del int + var buf bytes.Buffer + multilineContextLines := report.MultilineContextLines + for _, d := range diff { + // color and format each diff by type + switch d.Type { + case diffmatchpatch.DiffInsert: + fmt.Fprint(&buf, green(createStringWithContinuousPrefix(" + ", d.Text))) + ins++ + + case diffmatchpatch.DiffDelete: + fmt.Fprint(&buf, red(createStringWithContinuousPrefix(" - ", d.Text))) + del++ + + case diffmatchpatch.DiffEqual: + // skip eqaul output if requested context is 0 or the equal text is empty + if multilineContextLines <= 0 || len(d.Text) == 0 { + continue } + // add amount of unchanged lines as configured + lines := strings.Split(d.Text, "\n") + lower := int(math.Min(float64(len(lines)), float64(multilineContextLines))) + upper := len(lines) - multilineContextLines + // if string ends with \n we need to display one more line on the upper limit + if strings.HasSuffix(d.Text, "\n") { + upper-- + } + var val string + if upper <= lower { + val = strings.Join(lines, "\n") + } else { + val = fmt.Sprintf("%s\n\n[%s unchanged)]\n\n%s", + strings.Join(lines[:lower], "\n"), + text.Plural((upper-lower), "line"), + strings.Join(lines[upper:], "\n")) + } + fmt.Fprint(&buf, dimgray(createStringWithContinuousPrefix(" ", val))) } - fmt.Fprintln(&buf) - - var insDelDetails []string - if ins > 0 { - insDelDetails = append(insDelDetails, text.Plural(ins, "insert")) - } - if del > 0 { - insDelDetails = append(insDelDetails, text.Plural(del, "deletion")) - } - - _, _ = output.WriteString(yellow("%c value change in multiline text (%s)\n", MODIFICATION, strings.Join(insDelDetails, ", "))) - _, _ = output.WriteString(createStringWithPrefix(" ", buf.String())) } + _, _ = output.WriteString( + yellow("%c value change in multiline text (%s, %s)\n", + MODIFICATION, text.Plural(ins, "insert"), text.Plural(del, "deletion"))) + _, _ = output.WriteString(buf.String()) + _, _ = output.WriteString("\n") case isMinorChange(from, to, report.MinorChangeThreshold): _, _ = output.WriteString(yellow("%c value change\n", MODIFICATION)) @@ -614,6 +625,20 @@ return strings.Replace(strings.Replace(text, "\n", bold("âµ\n"), -1), " ", bold("·"), -1) } +// createStringWithContinuousPrefix adds the defined prefix to each line of the +// objects string representation. +// The resulting string will always end with a newline. +func createStringWithContinuousPrefix(prefix string, obj interface{}) string { + trimmed := strings.TrimSuffix(fmt.Sprint(obj), "\n") // avoid add. additional empty newline if orig string ends with \n + var buf bytes.Buffer + for _, line := range strings.Split(trimmed, "\n") { + buf.WriteString(prefix) + buf.WriteString(line) + buf.WriteString("\n") // always adds a newline, even if orig string does not contain any + } + return buf.String() +} + func createStringWithPrefix(prefix string, obj interface{}) string { var buf bytes.Buffer for i, line := range strings.Split(fmt.Sprintf("%v", obj), "\n") { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dyff-1.6.0/pkg/dyff/output_human_test.go new/dyff-1.7.0/pkg/dyff/output_human_test.go --- old/dyff-1.6.0/pkg/dyff/output_human_test.go 2023-10-14 22:42:25.000000000 +0200 +++ new/dyff-1.7.0/pkg/dyff/output_human_test.go 2024-02-06 20:50:33.000000000 +0100 @@ -199,6 +199,15 @@ false, ) }) + + It("should use human friendly compact diff of multiline text differences for complex files", func() { + compareAgainstExpected( + assets("multiline/from.yml"), + assets("multiline/to.yml"), + assets("multiline/expected-dyff-spruce.human"), + false, + ) + }) }) Context("reported output issues (without colors)", func() { ++++++ dyff.obsinfo ++++++ --- /var/tmp/diff_new_pack.lgcrUR/_old 2024-02-07 18:51:53.386249976 +0100 +++ /var/tmp/diff_new_pack.lgcrUR/_new 2024-02-07 18:51:53.390250119 +0100 @@ -1,5 +1,5 @@ name: dyff -version: 1.6.0 -mtime: 1697316145 -commit: bdf15b93b8edf0adb6a01cf9ca8ede59f57a7e5a +version: 1.7.0 +mtime: 1707249033 +commit: a0a00d72a7cd74b5485085d2c1acb4b1be11b17c ++++++ vendor.tar.gz ++++++ ++++ 11835 lines of diff (skipped)