6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-05 17:43:48 +00:00

Rename git package to repo package

This commit is contained in:
Grzegorz Dlugoszewski
2020-06-18 14:16:59 +02:00
parent da8f0931d0
commit 8511cd6c97
12 changed files with 65 additions and 65 deletions

View File

@@ -2,7 +2,7 @@ package path
import (
"bufio"
"git-get/pkg/git"
"git-get/pkg/repo"
"os"
"strings"
@@ -14,7 +14,7 @@ var (
)
// ParseBundleFile opens a given gitgetfile and parses its content into a slice of CloneOpts.
func ParseBundleFile(path string) ([]*git.CloneOpts, error) {
func ParseBundleFile(path string) ([]*repo.CloneOpts, error) {
file, err := os.Open(path)
if err != nil {
return nil, errors.Wrapf(err, "Failed opening gitgetfile %s", path)
@@ -23,7 +23,7 @@ func ParseBundleFile(path string) ([]*git.CloneOpts, error) {
scanner := bufio.NewScanner(file)
var opts []*git.CloneOpts
var opts []*repo.CloneOpts
var line int
for scanner.Scan() {
line++
@@ -40,7 +40,7 @@ func ParseBundleFile(path string) ([]*git.CloneOpts, error) {
// parseLine splits a gitgetfile line into space-separated segments.
// First part is the URL to clone. Second, optional, is the branch (or tag) to checkout after cloning
func parseLine(line string) (*git.CloneOpts, error) {
func parseLine(line string) (*repo.CloneOpts, error) {
parts := strings.Split(line, " ")
if len(parts) > 2 {
@@ -57,7 +57,7 @@ func parseLine(line string) (*git.CloneOpts, error) {
branch = parts[1]
}
return &git.CloneOpts{
return &repo.CloneOpts{
URL: url,
Branch: branch,
// When cloning a bundle we ignore errors about already cloned repos

View File

@@ -3,7 +3,7 @@ package path
import (
"fmt"
"git-get/pkg/cfg"
"git-get/pkg/git"
"git-get/pkg/repo"
"os"
"sort"
"strings"
@@ -65,13 +65,13 @@ func ErrorCb(_ string, err error) godirwalk.ErrorAction {
return godirwalk.Halt
}
func OpenAll(paths []string) ([]*git.Repo, error) {
var repos []*git.Repo
reposChan := make(chan *git.Repo)
func OpenAll(paths []string) ([]*repo.Repo, error) {
var repos []*repo.Repo
reposChan := make(chan *repo.Repo)
for _, path := range paths {
go func(path string) {
repo, err := git.OpenRepo(path)
repo, err := repo.Open(path)
if err != nil {
// TODO handle error