Last active
June 28, 2016 18:57
-
-
Save tkf/12bde871bf794e59bea88b659ed5b95b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
bin="${BASH_SOURCE[0]%.*}" | |
go build -o "$bin" "$bin.go" | |
for file in "$@" | |
do | |
for rev in $(git log --format='format:%H' "$file" | head -n-1) | |
do | |
if ! diff <("$bin" <(git show "$rev:./$file") <(git show "$rev^:./$file")) <(git show "$rev:./$file") >&2 | |
then | |
echo "$rev:./$file" | |
fi | |
done | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io" | |
"io/ioutil" | |
"os" | |
"time" | |
"github.com/sergi/go-diff/diffmatchpatch" | |
) | |
func readall(path string) string { | |
file, _ := os.Open(path) | |
text, _ := ioutil.ReadAll(file) | |
return string(text) | |
} | |
func main() { | |
text1 := readall(os.Args[1]) | |
text2 := readall(os.Args[2]) | |
dmp := diffmatchpatch.New() | |
dmp.DiffTimeout = time.Hour | |
// dmp.DiffTimeout = 0 | |
diffs := dmp.DiffMain(text1, text2, true) | |
io.WriteString(os.Stdout, dmp.DiffText1(diffs)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment