Przeglądaj źródła

Merge pull request #125 from vmarkovtsev/master

Fix bugs in collapseFastForwards
Vadim Markovtsev 6 lat temu
rodzic
commit
f8dc7d8652

+ 3 - 3
.appveyor.yml

@@ -6,7 +6,6 @@ clone_folder: c:\gopath\src\gopkg.in\src-d\hercules.v5
 
 environment:
   GOPATH: c:\gopath
-  GOGIT_TAG: v4.7.0
 
 install:
   - curl -SLko protoc.zip https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-win32.zip
@@ -14,10 +13,11 @@ install:
   - move protoc.exe C:\msys64\mingw64\bin
 
 build_script:
-  - set PATH=C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;C:\msys64\usr\bin;C:\msys64\mingw64\bin;%PATH%
+  - go version
+  - set PATH=C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;C:\msys64\usr\bin;C:\msys64\mingw64\bin;%GOPATH%\bin;%PATH%
   - set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
-  - git clone --depth 1 --single-branch --branch %GOGIT_TAG% https://github.com/src-d/go-git %GOPATH%/src/gopkg.in/src-d/go-git.v4
   - cd %GOPATH%\src\gopkg.in\src-d\hercules.v5
+  - go get -v github.com/golang/dep/cmd/dep
   - set DISABLE_TENSORFLOW=1
   - make
   - 7z a c:\gopath\src\gopkg.in\src-d\hercules.v5\hercules.win64.zip %GOPATH%\bin\hercules.exe

+ 1 - 1
.flake8

@@ -1,3 +1,3 @@
 [flake8]
 max-line-length=99
-exclude=.git,internal/pb/pb_pb2.py
+exclude=.git,internal/pb/pb_pb2.py,vendor

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
+vendor
 cmd/hercules/plugin_template_source.go
 contrib/_plugin_example/churn_analysis.pb.go
 pb/pb.pb.go

+ 17 - 13
.travis.yml

@@ -1,9 +1,14 @@
 dist: xenial
+sudo: required
 
 git:
   depth: 9999999
 
 language: go
+go_import_path: gopkg.in/src-d/hercules.v5
+go:
+- 1.10.x
+- 1.11.x
 
 services:
   - docker
@@ -13,10 +18,6 @@ addons:
     packages:
     - libxml2-dev
 
-go_import_path: gopkg.in/src-d/hercules.v5
-go:
-  - 1.10.x
-  - 1.11.x
 cache:
   directories:
     - $HOME/.cache/pip
@@ -35,16 +36,15 @@ stages:
   - deploy
 
 env:
-  - PROTOC_VERSION=3.6.0 TENSORFLOW_VERSION=1.8.0 GOGIT_TAG=v4.7.0
+  - PROTOC_VERSION=3.6.0 TENSORFLOW_VERSION=1.8.0
 
 before_install:
   - wget -O protoc.zip https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip
   - unzip -d ~/.local protoc.zip && rm protoc.zip
   - go get -v golang.org/x/lint/golint
-  - rm -rf $GOPATH/src/gopkg.in/src-d/go-git.v4
-  - git clone --depth 1 --single-branch --branch $GOGIT_TAG https://github.com/src-d/go-git $GOPATH/src/gopkg.in/src-d/go-git.v4
+  - go get -v github.com/golang/dep/cmd/dep
   - (wget https://bootstrap.pypa.io/get-pip.py || wget https://raw.githubusercontent.com/pypa/get-pip/master/get-pip.py) && python3 get-pip.py --user && rm get-pip.py
-  - export PATH=~/usr/bin:$PATH
+  - export PATH=~/usr/bin:$GOPATH/bin:$PATH
   - make --version
   - pip3 --version
   - pip3 install --user --no-build-isolation -r requirements.txt tensorflow flake8
@@ -59,12 +59,11 @@ install:
   - make
 script:
   - set -e
-  - test -z "$(gofmt -s -l .)"
+  - if [ $TRAVIS_GO_VERSION = "1.11.*" ]; then test -z "$(gofmt -s -l . | grep -v vendor/)"; fi
   - go vet -tags tensorflow ./...
-  - golint -set_exit_status ./...
+  - golint -set_exit_status $(go list ./... | grep -v /vendor/)
   - flake8
-  - if [[ $TRAVIS_GO_VERSION != 1.9.* ]]; then go test -coverpkg=all -v -cpu=1,2 -coverprofile=coverage.txt -covermode=count gopkg.in/src-d/hercules.v5/... && sed -i '/cmd\/hercules\|core.go/d' coverage.txt; fi
-  - if [[ $TRAVIS_GO_VERSION = 1.9.* ]]; then go test -v -cpu=1,2 gopkg.in/src-d/hercules.v5/...; fi
+  - go test -coverpkg=all -v -coverprofile=coverage.txt -covermode=count gopkg.in/src-d/hercules.v5/... && sed -i '/cmd\/hercules\|core.go/d' coverage.txt
   - $GOPATH/bin/hercules version
   - $GOPATH/bin/hercules --burndown --couples --quiet --pb https://github.com/src-d/hercules > 1.pb
   - cp 1.pb 2.pb
@@ -75,11 +74,12 @@ script:
   - $GOPATH/bin/hercules --burndown --burndown-files --burndown-people --couples --quiet --pb https://github.com/src-d/hercules | python3 labours.py -f pb -m all -o out --backend Agg --disable-projector
   - # $GOPATH/bin/hercules --sentiment --quiet --languages Python https://github.com/src-d/hercules > /dev/null
   - set +e
-  - if [[ $TRAVIS_GO_VERSION = 1.10.* ]]; then bash <(curl -s https://codecov.io/bash); fi
+  - if [ $TRAVIS_GO_VERSION = "1.11.*" ]; then bash <(curl -s https://codecov.io/bash); fi
 
 jobs:
   include:
     - stage: test
+      addons: false
       language: generic
       env: DOCKER_BUILD=1
       before_install: skip
@@ -93,6 +93,8 @@ jobs:
       before_install:
         - wget -O protoc.zip https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-osx-x86_64.zip
         - unzip -d ~/.local protoc.zip && rm protoc.zip
+        - go get -v github.com/golang/dep/cmd/dep
+        - export PATH=$GOPATH/bin:$PATH
       after_success:
         - gzip -S .darwin_amd64.gz $GOPATH/bin/hercules
       script: skip
@@ -113,6 +115,8 @@ jobs:
       before_install:
         - wget -O protoc.zip https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip
         - unzip -d ~/.local protoc.zip && rm protoc.zip
+        - go get -v github.com/golang/dep/cmd/dep
+        - export PATH=$GOPATH/bin:$PATH
       script: skip
       install:
         - DISABLE_TENSORFLOW=1 make

+ 3 - 3
Dockerfile

@@ -3,6 +3,7 @@ FROM ubuntu:18.04
 ENV GOPATH /root
 ENV PROTOBUF_VERSION 3.5.1
 
+COPY . /root/src/gopkg.in/src-d/hercules.v5
 RUN apt-get update && \
     apt-get install -y --no-install-suggests --no-install-recommends software-properties-common && \
     add-apt-repository -y ppa:gophers/archive && \
@@ -11,9 +12,8 @@ RUN apt-get update && \
     curl -SLo protoc.zip https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-x86_64.zip && \
     unzip -d /usr/local protoc.zip && rm protoc.zip && \
     locale-gen en_US.UTF-8 && \
-    export PATH=/usr/lib/go-1.10/bin:$PATH && \
-    git clone --single-branch --branch v4.7.0 --depth 1 https://github.com/src-d/go-git /root/src/gopkg.in/src-d/go-git.v4 && \
-    go get -v -d gopkg.in/src-d/hercules.v5/... && \
+    export PATH=/usr/lib/go-1.10/bin:/root/bin:$PATH && \
+    go get -v github.com/golang/dep/cmd/dep && \
     cd /root/src/gopkg.in/src-d/hercules.v5 && \
     export CGO_CXXFLAGS=-std=c++14 && \
     curl -L "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-$(go env GOOS)-x86_64-1.7.0.tar.gz" | tar -C /usr/local -xz && \

+ 630 - 0
Gopkg.lock

@@ -0,0 +1,630 @@
+# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
+
+
+[[projects]]
+  digest = "1:9f3b30d9f8e0d7040f729b82dcbc8f0dead820a133b3147ce355fc451f32d761"
+  name = "github.com/BurntSushi/toml"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005"
+  version = "v0.3.1"
+
+[[projects]]
+  branch = "master"
+  digest = "1:666e6921bb482fe300dc23d2ac545e4bc8ad08a493ffad37ea8d7edbf8fc05c5"
+  name = "github.com/Masterminds/semver"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "c84ddcca87bf5a941b138dde832a7e20b0159ad8"
+
+[[projects]]
+  branch = "master"
+  digest = "1:c5277d85d0dde9168f086cb3fc19f6f759c8524f0c13fb8dea9573bff4860abe"
+  name = "github.com/Masterminds/sprig"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "77bb58b7f5e10889a1195c21b9e7a96ee166f199"
+
+[[projects]]
+  branch = "master"
+  digest = "1:607794e3030e79527e11cba224fb6db52d53c602d57879d8771c19c0e256a59d"
+  name = "github.com/antchfx/xpath"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "3de91f3991a1af6e495d49c9218318b5544b20e3"
+
+[[projects]]
+  branch = "master"
+  digest = "1:8f5416c7f59da8600725ae1ff00a99af1da8b04c211ae6f3c8f8bcab0164f650"
+  name = "github.com/aokoli/goutils"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "3391d3790d23d03408670993e957e8f408993c34"
+
+[[projects]]
+  digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
+  name = "github.com/davecgh/go-spew"
+  packages = ["spew"]
+  pruneopts = "UT"
+  revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
+  version = "v1.1.1"
+
+[[projects]]
+  branch = "master"
+  digest = "1:10ed28b6c04f028f3b2421fcd3074c0224bb0c4b69ca99e783fbff0fac13ac5e"
+  name = "github.com/emirpasic/gods"
+  packages = [
+    "containers",
+    "lists",
+    "lists/arraylist",
+    "trees",
+    "trees/binaryheap",
+    "utils",
+  ]
+  pruneopts = "UT"
+  revision = "bba54c718c4e39e4db35f73e0c660df44a4de4cd"
+
+[[projects]]
+  branch = "master"
+  digest = "1:bbc4aacabe6880bdbce849c64cb061b7eddf39f132af4ea2853ddd32f85fbec3"
+  name = "github.com/fatih/camelcase"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "44e46d280b43ec1531bb25252440e34f1b800b65"
+
+[[projects]]
+  digest = "1:3f7c586d2fd571c4f2e3d313c0638b33b999055de507d5f11fafe27e5adc30db"
+  name = "github.com/gogo/protobuf"
+  packages = [
+    "gogoproto",
+    "proto",
+    "protoc-gen-gogo/descriptor",
+    "sortkeys",
+    "types",
+  ]
+  pruneopts = "UT"
+  revision = "636bf0302bc95575d69441b25a2603156ffdddf1"
+  version = "v1.1.1"
+
+[[projects]]
+  digest = "1:4c0989ca0bcd10799064318923b9bc2db6b4d6338dd75f3f2d86c3511aaaf5cf"
+  name = "github.com/golang/protobuf"
+  packages = [
+    "proto",
+    "ptypes",
+    "ptypes/any",
+    "ptypes/duration",
+    "ptypes/timestamp",
+  ]
+  pruneopts = "UT"
+  revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
+  version = "v1.2.0"
+
+[[projects]]
+  branch = "master"
+  digest = "1:4b3280120660e5f6649d6396be841bcdfb6834dbf9ca25d84a639b14a0a6d13a"
+  name = "github.com/google/uuid"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "e704694aed0ea004bb7eb1fc2e911d048a54606a"
+
+[[projects]]
+  branch = "master"
+  digest = "1:82ae4a01ab513802a68d4094e0eca6c5aaa9445633560e2c0491263e37361620"
+  name = "github.com/huandu/xstrings"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "8bbcf2f9ccb55755e748b7644164cd4bdce94c1d"
+
+[[projects]]
+  branch = "master"
+  digest = "1:8eb1de8112c9924d59bf1d3e5c26f5eaa2bfc2a5fcbb92dc1c2e4546d695f277"
+  name = "github.com/imdario/mergo"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "9f23e2d6bd2a77f959b2bf6acdbefd708a83a4a4"
+
+[[projects]]
+  digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be"
+  name = "github.com/inconshreveable/mousetrap"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
+  version = "v1.0"
+
+[[projects]]
+  branch = "master"
+  digest = "1:62fe3a7ea2050ecbd753a71889026f83d73329337ada66325cbafd5dea5f713d"
+  name = "github.com/jbenet/go-context"
+  packages = ["io"]
+  pruneopts = "UT"
+  revision = "d14ea06fba99483203c19d92cfcd13ebe73135f4"
+
+[[projects]]
+  branch = "master"
+  digest = "1:7248f832d2ec4b41627eb8bd55645bc42048a392ddeb647fd0abb2b69f1ded1a"
+  name = "github.com/jeffail/tunny"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "59cfa8fcb19f5acba8db07a0dd3cb2fa7edbc228"
+
+[[projects]]
+  branch = "master"
+  digest = "1:a84fae99960f33c73468c3de94b5053f1362d62806a92dc925bc6ba9b687f646"
+  name = "github.com/kevinburke/ssh_config"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "802051befeb51da415c46972b5caf36e7c33c53d"
+
+[[projects]]
+  branch = "master"
+  digest = "1:bcdd3c95159bf18932c5a3bc7da945c19dd477f54d0d24f4ea04b31076468681"
+  name = "github.com/mattn/go-runewidth"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "97311d9f7767e3d6f422ea06661bc2c7a19e8a5d"
+
+[[projects]]
+  branch = "master"
+  digest = "1:1c1a166be1c2f3bbc0c9b7c87a0877ede9ff5f865b406bb0379ca790b3dddf03"
+  name = "github.com/mcuadros/go-lookup"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "5650f26be7675b629fff8356a50d906fa03e9c8b"
+
+[[projects]]
+  branch = "master"
+  digest = "1:c99caced18127b6ae7a0be25bdf64155a8b5337d18fce1e7df0a8e68beb18767"
+  name = "github.com/minio/highwayhash"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "85fc8a2dacad36a6beb2865793cd81363a496696"
+
+[[projects]]
+  branch = "master"
+  digest = "1:12ae6210bdbdad658a9a67fd95cd9c99f7fdbf12f6d36eaf0af704e69dacf4f5"
+  name = "github.com/mitchellh/go-homedir"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "b8bc1bf767474819792c23f32d8286a45736f1c6"
+
+[[projects]]
+  branch = "master"
+  digest = "1:cab1f682826733526a4b49a45cb64fab31930f2cc2684fa14c64b090b1c25b13"
+  name = "github.com/pelletier/go-buffruneio"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "e2f66f8164ca709d4c21e815860afd2024e9b894"
+
+[[projects]]
+  branch = "master"
+  digest = "1:6c13131f5eae63cc6c362fc27bee2ed16e32d0bd2bfd869ce2093b6e32917c7c"
+  name = "github.com/pkg/errors"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "f15c970de5b76fac0b59abb32d62c17cc7bed265"
+
+[[projects]]
+  digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
+  name = "github.com/pmezard/go-difflib"
+  packages = ["difflib"]
+  pruneopts = "UT"
+  revision = "792786c7400a136282c1664665ae0a8db921c6c2"
+  version = "v1.0.0"
+
+[[projects]]
+  branch = "master"
+  digest = "1:11847ffa6c699272c5eec9a987a6a50e81fcab8e9379857a1c6998150bad7d72"
+  name = "github.com/sergi/go-diff"
+  packages = ["diffmatchpatch"]
+  pruneopts = "UT"
+  revision = "feef008d51ad2b3778f85d387ccf91735543008d"
+
+[[projects]]
+  digest = "1:645cabccbb4fa8aab25a956cbcbdf6a6845ca736b2c64e197ca7cbb9d210b939"
+  name = "github.com/spf13/cobra"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385"
+  version = "v0.0.3"
+
+[[projects]]
+  digest = "1:c1b1102241e7f645bc8e0c22ae352e8f0dc6484b6cb4d132fa9f24174e0119e2"
+  name = "github.com/spf13/pflag"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "298182f68c66c05229eb03ac171abe6e309ee79a"
+  version = "v1.0.3"
+
+[[projects]]
+  branch = "v1"
+  digest = "1:3681df693b35e7df9937dbd54b9f179aee5b54f4a28f72ad191e87038e6ffcab"
+  name = "github.com/src-d/gcfg"
+  packages = [
+    ".",
+    "scanner",
+    "token",
+    "types",
+  ]
+  pruneopts = "UT"
+  revision = "f187355171c936ac84a82793659ebb4936bc1c23"
+
+[[projects]]
+  branch = "master"
+  digest = "1:b566bbc018497ffb47060cab752ed1b899dea649c9cf1c6b54ae13b4f81f4d10"
+  name = "github.com/stretchr/testify"
+  packages = ["assert"]
+  pruneopts = "UT"
+  revision = "4d4bfba8f1d1027c4fdbe371823030df51419987"
+
+[[projects]]
+  branch = "master"
+  digest = "1:da7aadd5db15c43ddd9b13d2c770103c081f7c377d92b3a8b256087fc74311ea"
+  name = "github.com/tensorflow/tensorflow"
+  packages = ["tensorflow/go"]
+  pruneopts = "UT"
+  revision = "f73d7c90ed05bcf9f36f6a3be0c29efa5fef0f6e"
+
+[[projects]]
+  branch = "master"
+  digest = "1:2699f40ea73866f38eccb385738750a71a05cec654f029e78f620caccefd85e4"
+  name = "github.com/toqueteos/trie"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "56fed4a05683322f125e2d78ee269bb102280392"
+
+[[projects]]
+  digest = "1:afc0b8068986a01e2d8f449917829753a54f6bd4d1265c2b4ad9cba75560020f"
+  name = "github.com/xanzy/ssh-agent"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "640f0ab560aeb89d523bb6ac322b1244d5c3796c"
+  version = "v0.2.0"
+
+[[projects]]
+  branch = "master"
+  digest = "1:19469bd9ed9a0ab16d14e328f48f9b97113b9a54bdc8b16ad47ba2c378778818"
+  name = "golang.org/x/crypto"
+  packages = [
+    "cast5",
+    "curve25519",
+    "ed25519",
+    "ed25519/internal/edwards25519",
+    "openpgp",
+    "openpgp/armor",
+    "openpgp/elgamal",
+    "openpgp/errors",
+    "openpgp/packet",
+    "openpgp/s2k",
+    "pbkdf2",
+    "scrypt",
+    "ssh",
+    "ssh/agent",
+    "ssh/knownhosts",
+    "ssh/terminal",
+  ]
+  pruneopts = "UT"
+  revision = "96846453c37f0876340a66a47f3f75b1f3a6cd2d"
+
+[[projects]]
+  branch = "master"
+  digest = "1:05975da5a07cfcf19e75724b282453225b4c2d73ae5d238362406e408328d126"
+  name = "golang.org/x/net"
+  packages = [
+    "context",
+    "http2",
+    "http2/hpack",
+    "idna",
+    "internal/timeseries",
+    "lex/httplex",
+    "trace",
+  ]
+  pruneopts = "UT"
+  revision = "a8b9294777976932365dabb6640cf1468d95c70f"
+
+[[projects]]
+  branch = "master"
+  digest = "1:62ca3f49ce225f596c1b1581e2fcbbb7710d84aa59580d48c4ed025b43aa949b"
+  name = "golang.org/x/sys"
+  packages = [
+    "cpu",
+    "unix",
+    "windows",
+  ]
+  pruneopts = "UT"
+  revision = "5cd93ef61a7c8f0f858690154eb6de2e69415fa1"
+
+[[projects]]
+  branch = "master"
+  digest = "1:3c6a43a33a473a50194e978adf812e62fe8ca0f430847231e1f4a71543572faa"
+  name = "golang.org/x/text"
+  packages = [
+    "collate",
+    "collate/build",
+    "internal/colltab",
+    "internal/gen",
+    "internal/tag",
+    "internal/triegen",
+    "internal/ucd",
+    "language",
+    "secure/bidirule",
+    "transform",
+    "unicode/bidi",
+    "unicode/cldr",
+    "unicode/norm",
+    "unicode/rangetable",
+  ]
+  pruneopts = "UT"
+  revision = "556d234e9c5239918de4d1fe247d1fe004e71764"
+
+[[projects]]
+  branch = "master"
+  digest = "1:cd018653a358d4b743a9d3bee89e825521f2ab2f2ec0770164bf7632d8d73ab7"
+  name = "google.golang.org/genproto"
+  packages = ["googleapis/rpc/status"]
+  pruneopts = "UT"
+  revision = "7f0da29060c682909f650ad8ed4e515bd74fa12a"
+
+[[projects]]
+  digest = "1:c3ad9841823db6da420a5625b367913b4ff54bbe60e8e3c98bd20e243e62e2d2"
+  name = "google.golang.org/grpc"
+  packages = [
+    ".",
+    "balancer",
+    "balancer/base",
+    "balancer/roundrobin",
+    "codes",
+    "connectivity",
+    "credentials",
+    "encoding",
+    "encoding/proto",
+    "grpclog",
+    "internal",
+    "internal/backoff",
+    "internal/channelz",
+    "internal/envconfig",
+    "internal/grpcrand",
+    "internal/transport",
+    "keepalive",
+    "metadata",
+    "naming",
+    "peer",
+    "resolver",
+    "resolver/dns",
+    "resolver/passthrough",
+    "stats",
+    "status",
+    "tap",
+  ]
+  pruneopts = "UT"
+  revision = "2e463a05d100327ca47ac218281906921038fd95"
+  version = "v1.16.0"
+
+[[projects]]
+  digest = "1:ace997f8ef569276114f7a4e2a8b44cc8ee34b4d756ccbeb73f612589d98b0b3"
+  name = "gopkg.in/bblfsh/client-go.v2"
+  packages = [
+    ".",
+    "tools",
+  ]
+  pruneopts = "UT"
+  revision = "47a750b0793f5094635bd013001c435bacc6ac48"
+  version = "v2.8.8"
+
+[[projects]]
+  digest = "1:861bb28098fdd02360af9d9a1c246cce4e255c94d6a75661e74dd60144d72105"
+  name = "gopkg.in/bblfsh/sdk.v1"
+  packages = [
+    "manifest",
+    "protocol",
+    "uast",
+  ]
+  pruneopts = "UT"
+  revision = "94e3b212553e761677da180f321d9a7a60ebec5f"
+  version = "v1.16.1"
+
+[[projects]]
+  digest = "1:6346689fd052f5857391860ca459e3e8a53db2fe5da5165d8be8ec17735bd4c0"
+  name = "gopkg.in/bblfsh/sdk.v2"
+  packages = [
+    "driver",
+    "driver/manifest",
+    "protocol",
+    "protocol/v1",
+    "uast",
+    "uast/nodes",
+    "uast/nodes/nodesproto",
+    "uast/nodes/nodesproto/pio",
+    "uast/query",
+    "uast/query/xpath",
+    "uast/role",
+    "uast/transformer",
+  ]
+  pruneopts = "UT"
+  revision = "73dccf5b138866d38733c4b371fcd597e4240516"
+  version = "v2.3.0"
+
+[[projects]]
+  branch = "master"
+  digest = "1:454dadc0f4c0252055bc56677665f87736f1ec62c960b21e6c116e7f70f993a4"
+  name = "gopkg.in/cheggaaa/pb.v1"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "43d64de27312b32812ca7e994fa0bb03ccf08fdf"
+
+[[projects]]
+  branch = "master"
+  digest = "1:8276341abd121205600721bd831eb5209b83dd7a124d3a982e3ccc2da8c03012"
+  name = "gopkg.in/neurosnap/sentences.v1"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "a7f18ead1433a139742a8b42ce7a059cfb484d60"
+
+[[projects]]
+  branch = "master"
+  digest = "1:1260b963ef72806a56841af91479a3d2d9fa02bc11dc6b2a7f0866739b5b908c"
+  name = "gopkg.in/src-d/enry.v1"
+  packages = [
+    ".",
+    "data",
+    "internal/tokenizer",
+  ]
+  pruneopts = "UT"
+  revision = "acaf8f3d385e8c6f43e24713538007fb72bbfc16"
+
+[[projects]]
+  branch = "master"
+  digest = "1:c057dcdb0f2891f49cc48a6faa3d39efee510b040c6aaa6341e71a79a759ea12"
+  name = "gopkg.in/src-d/go-billy-siva.v4"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "cd8ce6d3364eb9355e1f63649174b26901fb43c4"
+
+[[projects]]
+  branch = "master"
+  digest = "1:38a7affd09d9ae9111aa4e4406216b27ead3c798d38e11572757d7f37b92e631"
+  name = "gopkg.in/src-d/go-billy.v4"
+  packages = [
+    ".",
+    "helper/chroot",
+    "helper/mount",
+    "helper/polyfill",
+    "memfs",
+    "osfs",
+    "util",
+  ]
+  pruneopts = "UT"
+  revision = "83cf655d40b15b427014d7875d10850f96edba14"
+
+[[projects]]
+  digest = "1:48c5414d07b77e35a4c19f35e1c78d6a0cbdba6386005d0f8b7b86862d0ceca3"
+  name = "gopkg.in/src-d/go-errors.v1"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "8bbbeeb767dfdd053b9b45d5a16a4f4ce2c6f694"
+  version = "v1.0.0"
+
+[[projects]]
+  digest = "1:e625251525d1f5db4be16d133171b031876ff4e29d8546264d8eea8ab906d977"
+  name = "gopkg.in/src-d/go-git.v4"
+  packages = [
+    ".",
+    "config",
+    "internal/revision",
+    "plumbing",
+    "plumbing/cache",
+    "plumbing/filemode",
+    "plumbing/format/config",
+    "plumbing/format/diff",
+    "plumbing/format/gitignore",
+    "plumbing/format/idxfile",
+    "plumbing/format/index",
+    "plumbing/format/objfile",
+    "plumbing/format/packfile",
+    "plumbing/format/pktline",
+    "plumbing/object",
+    "plumbing/protocol/packp",
+    "plumbing/protocol/packp/capability",
+    "plumbing/protocol/packp/sideband",
+    "plumbing/revlist",
+    "plumbing/storer",
+    "plumbing/transport",
+    "plumbing/transport/client",
+    "plumbing/transport/file",
+    "plumbing/transport/git",
+    "plumbing/transport/http",
+    "plumbing/transport/internal/common",
+    "plumbing/transport/server",
+    "plumbing/transport/ssh",
+    "storage",
+    "storage/filesystem",
+    "storage/filesystem/dotgit",
+    "storage/memory",
+    "utils/binary",
+    "utils/diff",
+    "utils/ioutil",
+    "utils/merkletrie",
+    "utils/merkletrie/filesystem",
+    "utils/merkletrie/index",
+    "utils/merkletrie/internal/frame",
+    "utils/merkletrie/noder",
+  ]
+  pruneopts = "UT"
+  revision = "cd64b4d630b6c2d2b3d72e9615e14f9d58bb5787"
+  version = "v4.7.1"
+
+[[projects]]
+  branch = "master"
+  digest = "1:dc4a92e4e85a5d281406fb696c2fb14d1fdbc13a4f7e6ff7c6474f64c18db3da"
+  name = "gopkg.in/src-d/go-siva.v1"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "b4cd504f9d6e57728058609e4540e931fbd41220"
+
+[[projects]]
+  branch = "master"
+  digest = "1:98e121dbd49eb03c58bd8ef3b76322b2fdc3676cf11fa0084bb17ff01b2aa704"
+  name = "gopkg.in/toqueteos/substring.v1"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "c5f61671513240ddf5563635cc4a90e9f3ae4710"
+
+[[projects]]
+  branch = "master"
+  digest = "1:bb55e2e0b84d01d21855d3c0db46f2581b44fc82f4138d9554b0ac459e08f5f6"
+  name = "gopkg.in/vmarkovtsev/BiDiSentiment.v1"
+  packages = [
+    ".",
+    "assets",
+  ]
+  pruneopts = "UT"
+  revision = "75f168ddf1615a274af79640178536b2adc44123"
+
+[[projects]]
+  branch = "master"
+  digest = "1:9df3443440bf95dc72f21ffc33300eca3975edf4b899af969a577879afe551de"
+  name = "gopkg.in/warnings.v0"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "8a331561fe74dadba6edfc59f3be66c22c3b065d"
+
+[solve-meta]
+  analyzer-name = "dep"
+  analyzer-version = 1
+  input-imports = [
+    "github.com/Masterminds/sprig",
+    "github.com/fatih/camelcase",
+    "github.com/gogo/protobuf/proto",
+    "github.com/jeffail/tunny",
+    "github.com/minio/highwayhash",
+    "github.com/mitchellh/go-homedir",
+    "github.com/pkg/errors",
+    "github.com/sergi/go-diff/diffmatchpatch",
+    "github.com/spf13/cobra",
+    "github.com/spf13/pflag",
+    "github.com/stretchr/testify/assert",
+    "golang.org/x/crypto/ssh/terminal",
+    "gopkg.in/bblfsh/client-go.v2",
+    "gopkg.in/bblfsh/client-go.v2/tools",
+    "gopkg.in/bblfsh/sdk.v1/protocol",
+    "gopkg.in/bblfsh/sdk.v1/uast",
+    "gopkg.in/cheggaaa/pb.v1",
+    "gopkg.in/src-d/enry.v1",
+    "gopkg.in/src-d/go-billy-siva.v4",
+    "gopkg.in/src-d/go-billy.v4/memfs",
+    "gopkg.in/src-d/go-billy.v4/osfs",
+    "gopkg.in/src-d/go-git.v4",
+    "gopkg.in/src-d/go-git.v4/config",
+    "gopkg.in/src-d/go-git.v4/plumbing",
+    "gopkg.in/src-d/go-git.v4/plumbing/cache",
+    "gopkg.in/src-d/go-git.v4/plumbing/object",
+    "gopkg.in/src-d/go-git.v4/plumbing/storer",
+    "gopkg.in/src-d/go-git.v4/plumbing/transport/ssh",
+    "gopkg.in/src-d/go-git.v4/storage",
+    "gopkg.in/src-d/go-git.v4/storage/filesystem",
+    "gopkg.in/src-d/go-git.v4/storage/memory",
+    "gopkg.in/src-d/go-git.v4/utils/merkletrie",
+    "gopkg.in/vmarkovtsev/BiDiSentiment.v1",
+  ]
+  solver-name = "gps-cdcl"
+  solver-version = 1

+ 87 - 0
Gopkg.toml

@@ -0,0 +1,87 @@
+[[override]]
+  name = "github.com/xanzy/ssh-agent"
+  version = "0.2.0"
+
+[[constraint]]
+  branch = "master"
+  name = "github.com/Masterminds/sprig"
+
+[[constraint]]
+  branch = "master"
+  name = "github.com/fatih/camelcase"
+
+[[constraint]]
+  name = "github.com/gogo/protobuf"
+  version = "1.1.1"
+
+[[constraint]]
+  branch = "master"
+  name = "github.com/jeffail/tunny"
+
+[[constraint]]
+  branch = "master"
+  name = "github.com/minio/highwayhash"
+
+[[constraint]]
+  branch = "master"
+  name = "github.com/mitchellh/go-homedir"
+
+[[constraint]]
+  branch = "master"
+  name = "github.com/pkg/errors"
+
+[[constraint]]
+  branch = "master"
+  name = "github.com/sergi/go-diff"
+
+[[constraint]]
+  name = "github.com/spf13/cobra"
+  version = "0.0.3"
+
+[[constraint]]
+  name = "github.com/spf13/pflag"
+  version = "1.0.2"
+
+[[constraint]]
+  branch = "master"
+  name = "github.com/stretchr/testify"
+
+[[constraint]]
+  branch = "master"
+  name = "golang.org/x/crypto"
+
+[[constraint]]
+  name = "gopkg.in/bblfsh/client-go.v2"
+  version = "2.8.8"
+
+[[constraint]]
+  name = "gopkg.in/bblfsh/sdk.v1"
+  version = "1.16.1"
+
+[[constraint]]
+  branch = "master"
+  name = "gopkg.in/cheggaaa/pb.v1"
+
+[[constraint]]
+  branch = "master"
+  name = "gopkg.in/src-d/enry.v1"
+
+[[constraint]]
+  branch = "master"
+  name = "gopkg.in/src-d/go-billy-siva.v4"
+
+[[constraint]]
+  branch = "master"
+  name = "gopkg.in/src-d/go-billy.v4"
+
+[[constraint]]
+  name = "gopkg.in/src-d/go-git.v4"
+  version = "4.7.1"
+
+[[constraint]]
+  branch = "master"
+  name = "gopkg.in/vmarkovtsev/BiDiSentiment.v1"
+
+[prune]
+  go-tests = true
+  unused-packages = true

+ 10 - 6
Makefile

@@ -8,6 +8,7 @@ PKG = $(shell go env GOOS)_$(shell go env GOARCH)
 ifneq (${DISABLE_TENSORFLOW},1)
 TAGS ?= tensorflow
 endif
+BBLFSH_DEP =
 
 all: ${GOPATH}/bin/hercules${EXE}
 
@@ -32,12 +33,15 @@ internal/pb/pb_pb2.py: internal/pb/pb.proto
 cmd/hercules/plugin_template_source.go: cmd/hercules/plugin.template
 	cd cmd/hercules && go generate
 
-${GOPATH}/src/gopkg.in/bblfsh/client-go.v2/README.md:
-	go get -d -v gopkg.in/bblfsh/client-go.v2/...
+vendor:
+	dep ensure -v
 
-${GOPATH}/pkg/$(PKG)/gopkg.in/bblfsh/client-go.v2: ${GOPATH}/src/gopkg.in/bblfsh/client-go.v2/README.md
-	cd ${GOPATH}/src/gopkg.in/bblfsh/client-go.v2 && \
-	make dependencies
+ifeq ($(OS),Windows_NT)
+BBLFSH_DEP = vendor/gopkg.in/bblfsh/client-go.v2/tools/include
 
-${GOPATH}/bin/hercules${EXE}: *.go */*.go */*/*.go */*/*/*.go ${GOPATH}/pkg/$(PKG)/gopkg.in/bblfsh/client-go.v2 internal/pb/pb.pb.go internal/pb/pb_pb2.py cmd/hercules/plugin_template_source.go
+vendor/gopkg.in/bblfsh/client-go.v2/tools/include:
+	cd vendor/gopkg.in/bblfsh/client-go.v2 && make cgo-dependencies
+endif
+
+${GOPATH}/bin/hercules${EXE}: vendor *.go */*.go */*/*.go */*/*/*.go internal/pb/pb.pb.go internal/pb/pb_pb2.py cmd/hercules/plugin_template_source.go ${BBLFSH_DEP}
 	go get -tags "$(TAGS)" -ldflags "-X gopkg.in/src-d/hercules.v5.BinaryGitHash=$(shell git rev-parse HEAD)" gopkg.in/src-d/hercules.v5/cmd/hercules

+ 8 - 3
README.md

@@ -44,17 +44,20 @@ Blog posts: [1](https://blog.sourced.tech/post/hercules.v4), [2](https://blog.so
 
 ## Installation
 
-Grab `hercules` binary from the [Releases page](https://github.com/src-d/hercules/releases). `labours.py` requires the Python packages listed in [requirements.txt](requirements.txt):
+Grab `hercules` binary from the [Releases page](https://github.com/src-d/hercules/releases).
+`labours.py` requires the Python packages listed in [requirements.txt](requirements.txt):
 
 ```
 pip3 install -r requirements.txt
 ```
 
+[`pip3`](https://pip.pypa.io/en/stable/installing/) is the Python package manager.
+
 Numpy and Scipy can be installed on Windows using http://www.lfd.uci.edu/~gohlke/pythonlibs/
-Linux releases require [`libtensorflow`](https://www.tensorflow.org/install/install_go).
 
 ### Build from source
-You are going to need Go (>= v1.8), [`protoc`](https://github.com/google/protobuf/releases) and Python 2 or 3.
+You are going to need Go (>= v1.10), [`protoc`](https://github.com/google/protobuf/releases),
+and [`dep`](https://github.com/golang/dep).
 ```
 go get -d gopkg.in/src-d/hercules.v5/cmd/hercules
 cd $GOPATH/src/gopkg.in/src-d/hercules.v5
@@ -62,6 +65,8 @@ make
 ```
 
 Replace `$GOPATH` with `%GOPATH%` on Windows.
+By default the build requires [`libtensorflow`](https://www.tensorflow.org/install/install_go).
+Disable the analyses which require Tensorflow with `DISABLE_TENSORFLOW=1 make`.
 
 ## Contributions
 

+ 0 - 3
cmd/hercules/hack.go

@@ -1,3 +0,0 @@
-package main
-
-import "C" // needed for go:linkname in root.go

+ 35 - 15
cmd/hercules/root.go

@@ -14,7 +14,8 @@ import (
 	"regexp"
 	"runtime/pprof"
 	"strings"
-	_ "unsafe" // for go:linkname
+	"text/template"
+	"unicode"
 
 	"github.com/Masterminds/sprig"
 	"github.com/gogo/protobuf/proto"
@@ -27,6 +28,7 @@ import (
 	"gopkg.in/src-d/go-billy.v4/memfs"
 	"gopkg.in/src-d/go-billy.v4/osfs"
 	"gopkg.in/src-d/go-git.v4"
+	"gopkg.in/src-d/go-git.v4/plumbing/cache"
 	"gopkg.in/src-d/go-git.v4/plumbing/object"
 	"gopkg.in/src-d/go-git.v4/plumbing/transport/ssh"
 	"gopkg.in/src-d/go-git.v4/storage"
@@ -69,10 +71,7 @@ func loadRepository(uri string, cachePath string, disableStatus bool, sshIdentit
 	var err error
 	if strings.Contains(uri, "://") || regexp.MustCompile("^[A-Za-z]\\w*@[A-Za-z0-9][\\w.]*:").MatchString(uri) {
 		if cachePath != "" {
-			backend, err = filesystem.NewStorage(osfs.New(cachePath))
-			if err != nil {
-				panic(err)
-			}
+			backend = filesystem.NewStorage(osfs.New(cachePath), cache.NewObjectLRUDefault())
 			_, err = os.Stat(cachePath)
 			if !os.IsNotExist(err) {
 				log.Printf("warning: deleted %s\n", cachePath)
@@ -107,10 +106,7 @@ func loadRepository(uri string, cachePath string, disableStatus bool, sshIdentit
 		if err2 != nil {
 			log.Panicf("unable to create a siva filesystem from %s: %v", uri, err2)
 		}
-		sivaStorage, err2 := filesystem.NewStorage(fs)
-		if err2 != nil {
-			log.Panicf("unable to create a new storage backend for siva file %s: %v", uri, err2)
-		}
+		sivaStorage := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
 		repository, err = git.Open(sivaStorage, tmpFs)
 	} else {
 		if uri[len(uri)-1] == os.PathSeparator {
@@ -315,9 +311,34 @@ func protobufResults(
 	os.Stdout.Write(serialized)
 }
 
-// animate the private function defined in Cobra
-//go:linkname tmpl github.com/spf13/cobra.tmpl
-func tmpl(w io.Writer, text string, data interface{}) error
+// trimRightSpace removes the trailing whitespace characters.
+func trimRightSpace(s string) string {
+	return strings.TrimRightFunc(s, unicode.IsSpace)
+}
+
+// rpad adds padding to the right of a string.
+func rpad(s string, padding int) string {
+	return fmt.Sprintf(fmt.Sprintf("%%-%ds", padding), s)
+}
+
+// tmpl was adapted from cobra/cobra.go
+func tmpl(w io.Writer, text string, data interface{}) error {
+	var templateFuncs = template.FuncMap{
+		"trim":                    strings.TrimSpace,
+		"trimRightSpace":          trimRightSpace,
+		"trimTrailingWhitespaces": trimRightSpace,
+		"rpad":                    rpad,
+		"gt":                      cobra.Gt,
+		"eq":                      cobra.Eq,
+	}
+	for k, v := range sprig.TxtFuncMap() {
+		templateFuncs[k] = v
+	}
+	t := template.New("top")
+	t.Funcs(templateFuncs)
+	template.Must(t.Parse(text))
+	return t.Execute(w, data)
+}
 
 func formatUsage(c *cobra.Command) error {
 	// the default UsageFunc() does some private magic c.mergePersistentFlags()
@@ -348,9 +369,8 @@ func formatUsage(c *cobra.Command) error {
 		"plumbing": plumbing,
 		"features": features,
 	}
-	cobra.AddTemplateFuncs(sprig.TxtFuncMap())
 
-	template := `Usage:{{if .c.Runnable}}
+	helpTemplate := `Usage:{{if .c.Runnable}}
   {{.c.UseLine}}{{end}}{{if .c.HasAvailableSubCommands}}
   {{.c.CommandPath}} [command]{{end}}{{if gt (len .c.Aliases) 0}}
 
@@ -401,7 +421,7 @@ Additional help topics:{{range .c.Commands}}{{if .IsAdditionalHelpTopicCommand}}
 
 Use "{{.c.CommandPath}} [command] --help" for more information about a command.{{end}}
 `
-	err := tmpl(c.OutOrStderr(), template, args)
+	err := tmpl(c.OutOrStderr(), helpTemplate, args)
 	for key := range filter {
 		localFlags.Lookup(key).Hidden = false
 	}

+ 2 - 5
cmd/hercules/root_test.go

@@ -11,6 +11,7 @@ import (
 	"github.com/stretchr/testify/assert"
 	"gopkg.in/src-d/go-billy.v4/osfs"
 	"gopkg.in/src-d/go-git.v4"
+	"gopkg.in/src-d/go-git.v4/plumbing/cache"
 	"gopkg.in/src-d/go-git.v4/storage/filesystem"
 )
 
@@ -25,11 +26,7 @@ func TestLoadRepository(t *testing.T) {
 		assert.FailNow(t, "ioutil.TempDir")
 	}
 	defer os.RemoveAll(tempdir)
-	backend, err := filesystem.NewStorage(osfs.New(tempdir))
-	assert.Nil(t, err)
-	if err != nil {
-		assert.FailNow(t, "filesystem.NewStorage")
-	}
+	backend := filesystem.NewStorage(osfs.New(tempdir), cache.NewObjectLRUDefault())
 	cloneOptions := &git.CloneOptions{URL: "https://github.com/src-d/hercules"}
 	_, err = git.Clone(backend, nil, cloneOptions)
 	assert.Nil(t, err)

+ 24 - 11
internal/core/forks.go

@@ -366,6 +366,7 @@ func collapseFastForwards(
 			continue
 		}
 		toRemove := map[plumbing.Hash]bool{}
+		sort.Slice(vals, func(i, j int) bool { return vals[i].Hash.String() < vals[j].Hash.String() })
 		for _, child := range vals {
 			var queue []plumbing.Hash
 			visited := map[plumbing.Hash]bool{child.Hash: true}
@@ -405,13 +406,14 @@ func collapseFastForwards(
 								}
 							}
 						}
+						break
 					}
-					break
-				}
-				for parent := range parents[head] {
-					if !visited[parent] {
-						visited[head] = true
-						queue = append(queue, parent)
+				} else {
+					for parent := range parents[head] {
+						if !visited[parent] {
+							visited[head] = true
+							queue = append(queue, parent)
+						}
 					}
 				}
 			}
@@ -419,6 +421,7 @@ func collapseFastForwards(
 		if len(toRemove) == 0 {
 			continue
 		}
+
 		// update dag
 		var newVals []*object.Commit
 		node := mergedSeq[key][len(mergedSeq[key])-1].Hash
@@ -457,6 +460,12 @@ func collapseFastForwards(
 				}
 			}
 		}
+
+		// update parents
+		for rm := range toRemove {
+			delete(parents[rm], key)
+		}
+
 		if !merged {
 			mergedDag[key] = newVals
 		} else {
@@ -494,7 +503,7 @@ func generatePlan(
 				branch = -1
 			}
 		}
-		branchExists := func() bool { return branch >= 0 }
+		branchExists := func() bool { return branch >= rootBranchIndex }
 		appendCommit := func(c *object.Commit, branch int) {
 			if branch == 0 {
 				log.Panicf("setting a zero branch for %s", c.Hash.String())
@@ -505,9 +514,9 @@ func generatePlan(
 				Items:  []int{branch},
 			})
 		}
-		appendMergeIfNeeded := func() {
+		appendMergeIfNeeded := func() bool {
 			if len(parents[commit.Hash]) < 2 {
-				return
+				return false
 			}
 			// merge after the merge commit (the first in the sequence)
 			var items []int
@@ -539,13 +548,14 @@ func generatePlan(
 				branch = minBranch
 				branches[commit.Hash] = minBranch
 			} else if !branchExists() {
-				log.Panicf("!branchExists(%s)", commit.Hash.String())
+				log.Panicf("failed to assign the branch to merge %s", commit.Hash.String())
 			}
 			plan = append(plan, runAction{
 				Action: runActionMerge,
 				Commit: nil,
 				Items:  items,
 			})
+			return true
 		}
 		var head plumbing.Hash
 		if subseq, exists := mergedSeq[commit.Hash]; exists {
@@ -554,7 +564,10 @@ func generatePlan(
 					appendCommit(offspring, branch)
 				}
 				if subseqIndex == 0 {
-					appendMergeIfNeeded()
+					if !appendMergeIfNeeded() && !branchExists() {
+						log.Panicf("head of the sequence does not have an assigned branch: %s",
+							commit.Hash.String())
+					}
 				}
 			}
 			head = subseq[len(subseq)-1].Hash

+ 4 - 0
internal/plumbing/identity/identity_test.go

@@ -328,6 +328,10 @@ func (strr fakeEncodedObjectStorer) IterEncodedObjects(plumbing.ObjectType) (sto
 	return nil, nil
 }
 
+func (strr fakeEncodedObjectStorer) EncodedObjectSize(plumbing.Hash) (int64, error) {
+	return 0, nil
+}
+
 func getFakeCommitWithFile(name string, contents string) *object.Commit {
 	c := object.Commit{
 		Hash: plumbing.NewHash("ffffffffffffffffffffffffffffffffffffffff"),

+ 7 - 6
internal/plumbing/tree_diff.go

@@ -2,12 +2,13 @@ package plumbing
 
 import (
 	"fmt"
-	"gopkg.in/src-d/enry.v1"
 	"io"
 	"log"
 	"regexp"
 	"strings"
 
+	"gopkg.in/src-d/enry.v1"
+
 	"gopkg.in/src-d/go-git.v4"
 	"gopkg.in/src-d/go-git.v4/plumbing"
 	"gopkg.in/src-d/go-git.v4/plumbing/object"
@@ -47,9 +48,9 @@ const (
 	// allLanguages denotes passing all files in.
 	allLanguages = "all"
 
-	// ConfigTreeDiffFilterRegex is the name of the configuration option
+	// ConfigTreeDiffFilterRegexp is the name of the configuration option
 	// (TreeDiff.Configure()) which makes FileDiff consider only those files which have names matching this regexp.
-	ConfigTreeDiffFilterRegex = "TreeDiff.FilteredRegexes"
+	ConfigTreeDiffFilterRegexp = "TreeDiff.FilteredRegexes"
 )
 
 // defaultBlacklistedPrefixes is the list of file path prefixes which should be skipped by default.
@@ -106,8 +107,8 @@ func (treediff *TreeDiff) ListConfigurationOptions() []core.ConfigurationOption
 		Type:    core.StringsConfigurationOption,
 		Default: []string{allLanguages}}, {
 
-		Name:        ConfigTreeDiffFilterRegex,
-		Description: "Whitelist Regex to determine which files to analyze",
+		Name:        ConfigTreeDiffFilterRegexp,
+		Description: "Whitelist regexp to determine which files to analyze.",
 		Flag:        "whitelist",
 		Type:        core.StringConfigurationOption,
 		Default:     ""},
@@ -130,7 +131,7 @@ func (treediff *TreeDiff) Configure(facts map[string]interface{}) {
 		treediff.Languages[allLanguages] = true
 	}
 
-	if val, exists := facts[ConfigTreeDiffFilterRegex].(string); exists {
+	if val, exists := facts[ConfigTreeDiffFilterRegexp].(string); exists {
 		treediff.NameFilter = regexp.MustCompile(val)
 	}
 }

+ 1 - 1
internal/plumbing/tree_diff_test.go

@@ -164,7 +164,7 @@ func TestTreeDiffConsumeOnlyFilesThatMatchFilter(t *testing.T) {
 	td = fixtureTreeDiff()
 	td.previousTree, _ = prevCommit.Tree()
 	td.Configure(map[string]interface{}{
-		ConfigTreeDiffFilterRegex: ".*go",
+		ConfigTreeDiffFilterRegexp: ".*go",
 	})
 	res, err = td.Consume(deps)
 	assert.Nil(t, err)