Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(freebsd): FreeBSD 13.0-RELEASE compat #113

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 7 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
SHELL = /usr/local/bin/bash
BINARY = bin/gtm
VERSION = 0.0.0-dev
COMMIT = $(shell git show -s --format='%h' HEAD)
LDFLAGS = -ldflags "-X main.Version=$(VERSION)-$(COMMIT)"
GIT2GO_VERSION = v27
GIT2GO_PATH = $(GOPATH)/src/github.com/libgit2/git2go
GIT2GO_VERSION = v33.0.7
GIT2GO_PATH = vendor/github.com/libgit2/git2go/v33
LIBGIT2_PATH = $(GIT2GO_PATH)/vendor/libgit2
PKGS = $(shell go list ./... | grep -v vendor)
BUILD_TAGS = static
Expand Down Expand Up @@ -54,29 +55,15 @@ clean:
rm bin/*

git2go-install:
[[ -d $(GIT2GO_PATH) ]] || git clone https://github.com/libgit2/git2go.git $(GIT2GO_PATH) && \
[[ -d $(GIT2GO_PATH)/.git ]] || (rm -rf $(GIT2GO_PATH) && git clone https://github.com/libgit2/git2go.git $(GIT2GO_PATH)) && \
cd ${GIT2GO_PATH} && \
git pull && \
git fetch origin $(GIT2GO_VERSION) && \
git checkout -qf $(GIT2GO_VERSION) && \
git submodule update --init

git2go: git2go-install
cd $(LIBGIT2_PATH) && \
mkdir -p install/lib && \
mkdir -p build && \
cd build && \
cmake -DTHREADSAFE=ON \
-DBUILD_CLAR=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS=-fPIC \
-DUSE_SSH=OFF \
-DCURL=OFF \
-DUSE_HTTPS=OFF \
-DUSE_BUNDLED_ZLIB=ON \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
-DCMAKE_INSTALL_PREFIX=../install \
.. && \
cmake --build .
cd $(GIT2GO_PATH) && \
gmake install-static

git2go-clean:
[[ -d $(GIT2GO_PATH) ]] && rm -rf $(GIT2GO_PATH)
Expand Down
6 changes: 3 additions & 3 deletions scm/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"time"

"github.com/git-time-metric/gtm/util"
"github.com/libgit2/git2go"
"github.com/libgit2/git2go/v33"
)

// Workdir returns the working directory for a repo
Expand Down Expand Up @@ -298,7 +298,7 @@ func DiffParentCommit(childCommit *git.Commit) (CommitStats, error) {
files := []string{}

err := childTree.Walk(
func(s string, entry *git.TreeEntry) int {
func(s string, entry *git.TreeEntry) error {
switch entry.Filemode {
case git.FilemodeTree:
// directory where file entry is located
Expand All @@ -307,7 +307,7 @@ func DiffParentCommit(childCommit *git.Commit) (CommitStats, error) {
files = append(files, filepath.Join(path, entry.Name))
fileCnt++
}
return 0
return nil
})

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion util/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"testing"
"time"

"github.com/libgit2/git2go"
"github.com/libgit2/git2go/v33"
)

// TestRepo represents a test git repo used in testing
Expand Down