Skip to content
This repository was archived by the owner on May 27, 2022. It is now read-only.
Merged
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cover: test

# Run all the linters
lint:
./bin/golangci-lint run --disable godox --disable wsl --disable gomnd --disable testpackage --disable gofumpt --disable godot --enable-all ./...
./bin/golangci-lint run --disable godox --disable wsl --disable gomnd --disable testpackage --disable gofumpt --disable godot --disable nlreturn --enable-all ./...
.PHONY: lint

# Run all the tests and code checks
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Documentation can be found at https://getantibody.github.io
- @davidkna's [dotfiles](https://github.com/davidkna/dotfiles);
- @sobolevn's [dotfiles](https://github.com/sobolevn/dotfiles);
- @jesseleite's [dotfiles](https://github.com/jesseleite/dotfiles);
- @mattmc3's [dotfiles](https://github.com/mattmc3/zdotdir/tree/antibody)
- and probably [many others](https://github.com/search?q=antibody&type=Code);

## Thanks
Expand Down
28 changes: 17 additions & 11 deletions project/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewClonedGit(home, folderName string) Project {
folderPath := filepath.Join(home, folderName)
version, err := branch(folderPath)
if err != nil {
version = "master"
version = ""
}
url := folder.ToURL(folderName)
return gitProject{
Expand All @@ -45,7 +45,7 @@ const (
// NewGit A git project can be any repository in any given branch. It will
// be downloaded to the provided cwd
func NewGit(cwd, line string) Project {
version := "master"
version := ""
inner := ""
parts := strings.Split(line, " ")
for _, part := range parts {
Expand Down Expand Up @@ -91,13 +91,16 @@ func (g gitProject) Download() error {
defer lock.Unlock()
if _, err := os.Stat(g.folder); os.IsNotExist(err) {
// #nosec
var cmd = exec.Command("git", "clone",
args := []string{
"clone",
"--recursive",
"--depth", "1",
"-b", g.Version,
g.URL,
g.folder,
)
}
if g.Version != "" {
args = append(args, "-b", g.Version)
}
args = append(args, g.URL, g.folder)
var cmd = exec.Command("git", args...)
cmd.Env = gitCmdEnv

if bts, err := cmd.CombinedOutput(); err != nil {
Expand All @@ -115,12 +118,15 @@ func (g gitProject) Update() error {
return err
}
// #nosec
cmd := exec.Command(
"git", "pull",
args := []string{
"pull",
"--recurse-submodules",
"origin",
g.Version,
)
}
if g.Version != "" {
args = append(args, g.Version)
}
cmd := exec.Command("git", args...)
cmd.Env = gitCmdEnv

cmd.Dir = g.folder
Expand Down
2 changes: 1 addition & 1 deletion project/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestDownloadAllKinds(t *testing.T) {

func TestDownloadSubmodules(t *testing.T) {
var home = home()
var proj = NewGit(home, "fribmendes/geometry")
var proj = NewGit(home, "fribmendes/geometry branch:master")
var module = filepath.Join(proj.Path(), "lib/zsh-async")
require.NoError(t, proj.Download())
require.NoError(t, proj.Update())
Expand Down