Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sergi/go-diff
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.2.0
Choose a base ref
...
head repository: sergi/go-diff
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.3.1
Choose a head ref
  • 8 commits
  • 5 files changed
  • 4 contributors

Commits on Oct 27, 2020

  1. test

    sreekanth370 authored Oct 27, 2020
    Configuration menu
    Copy the full SHA
    2fe9485 View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2020

  1. test

    sreekanth370 authored Nov 9, 2020
    Configuration menu
    Copy the full SHA
    138eea2 View commit details
    Browse the repository at this point in the history
  2. test

    sreekanth370 authored Nov 9, 2020
    Configuration menu
    Copy the full SHA
    d9add37 View commit details
    Browse the repository at this point in the history

Commits on Mar 30, 2021

  1. Merge pull request #113 from sreekanth370/master

    Added power support for the travis.yml file with ppc64le. and update go versions for package: go-diff
    sergi authored Mar 30, 2021
    Configuration menu
    Copy the full SHA
    849d7eb View commit details
    Browse the repository at this point in the history

Commits on Mar 1, 2022

  1. fix bug: CVE-2019-11254

    upgrade gopkg.in/yaml.v2
    moyrn authored and moyrn committed Mar 1, 2022
    Configuration menu
    Copy the full SHA
    ca1db56 View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2022

  1. fix: use common lineHash to share indice between text1 and text2

    Use common cache of line contents between two texts in `DiffLinesToChars` to get line diffs correctly.
    In some cases, line diffs cannot be retrieved correctly in the standard way (https://github.com/google/diff-match-patch/wiki/Line-or-Word-Diffs#line-mode).
    In the below case, we failed to get line diffs correctly before this fix.
    
    ```go:main.go
    package main
    
    import (
    	"fmt"
    
    	"github.com/sergi/go-diff/diffmatchpatch"
    )
    
    const (
    	text1 = `hoge:
      step11:
      - arrayitem1
      - arrayitem2
      step12:
        step21: hoge
        step22: -93
    fuga: flatitem
    `
    	text2 = `hoge:
      step11:
      - arrayitem4
      - arrayitem2
      - arrayitem3
      step12:
        step21: hoge
        step22: -92
    fuga: flatitem
    `
    )
    
    func main() {
    	dmp := diffmatchpatch.New()
    	a, b, c := dmp.DiffLinesToChars(text1, text2)
    	diffs := dmp.DiffMain(a, b, false)
    	diffs = dmp.DiffCharsToLines(diffs, c)
    	// diffs = dmp.DiffCleanupSemantic(diffs)
    	fmt.Println(diffs)
    }
    ```
    
    ```text:output
    [{Insert hoge:
      step11:
    hoge:
    } {Equal hoge:
    } {Insert hoge:
    } {Equal   step11:
    } {Insert hoge:
    } {Equal   - arrayitem1
    } {Insert hoge:
    } {Equal   - arrayitem2
    } {Insert hoge:
    } {Equal   step12:
    } {Insert hoge:
    } {Equal     step21: hoge
    } {Insert hoge:
    } {Equal     step22: -93
    } {Delete fuga: flatitem
    }]
    ```
    
    Note: This fix corresponds to a javascript implementation.
    (ref: https://github.com/google/diff-match-patch/blob/62f2e689f498f9c92dbc588c58750addec9b1654/javascript/diff_match_patch_uncompressed.js#L466)
    nrnrk committed Oct 15, 2022
    Configuration menu
    Copy the full SHA
    6dbe13c View commit details
    Browse the repository at this point in the history

Commits on Jan 13, 2023

  1. Merge pull request #135 from nrnrk/fix_use_common_line_hash

    Use common lineHash to share indice between text1 and text2 for correct line diffs
    sergi authored Jan 13, 2023
    Configuration menu
    Copy the full SHA
    11fe19c View commit details
    Browse the repository at this point in the history
  2. Merge pull request #130 from moyrne/master

    sergi authored Jan 13, 2023
    Configuration menu
    Copy the full SHA
    facec63 View commit details
    Browse the repository at this point in the history
Loading