Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • bazel/git
1 result
Show changes
Commits on Source (5)
# [1.0.0-alpha.3](https://git.gitlab.arm.com/bazel/git/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2024-04-09)
### Features
- make `git init` re-initialize ([22bcdd3](https://git.gitlab.arm.com/bazel/git/commit/22bcdd3a01c73ee2017db259c501f3a50d54f507))
# [1.0.0-alpha.2](https://git.gitlab.arm.com/bazel/git/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2024-04-09)
### Features
......
module(
name = "bazel-git",
version = "1.0.0-alpha.2",
version = "1.0.0-alpha.3",
bazel_compatibility = [
">=7.0.0",
],
......
......@@ -4,13 +4,13 @@ load("@rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "bazel-git_lib",
srcs = [
"cat-file.go",
"cat_file.go",
"checkout.go",
"config.go",
"error.go",
"fetch.go",
"init.go",
"ls-remote.go",
"ls_remote.go",
"main.go",
],
importpath = "gitlab.arm.com/bazel/git/v1/cmd/bazel-git",
......
......@@ -30,7 +30,7 @@ func (x *CatFileCommand) Execute(rest []string) error {
log := slog.With("object", x.Args.Object)
log.Debug("cat-file")
found, err := object.Exists(object.ExistsOptions{Object: x.Args.Object, GitDir: options.Dir})
found, err := object.Exists(object.ExistsOptions{Object: x.Args.Object, GitDir: options.GitDir})
if err != nil {
return err
......
......@@ -20,7 +20,7 @@ func (x *CheckoutCommand) Execute(_ []string) error {
log.Debug("checkout", "commit", x.Args.Commit)
err := checkout.Commit(checkout.CommitOptions{
Commit: x.Args.Commit,
GitDir: options.Dir,
GitDir: options.GitDir,
WorkTree: options.WorkTree,
})
return err
......
......@@ -24,7 +24,7 @@ func (x *ConfigCommand) Execute(rest []string) error {
log := slog.With("name", x.Args.Name, "value", x.Args.Value)
log.Debug("set")
err := config.Set(config.SetOptions{
GitDir: options.Dir,
GitDir: options.GitDir,
Name: x.Args.Name,
Value: x.Args.Value,
})
......
......@@ -32,7 +32,7 @@ func (x *FetchCommand) Execute(_ []string) error {
Remote: x.Args.Remote,
Commitishes: x.Args.Commitishes,
Depth: x.Depth,
GitDir: options.Dir,
GitDir: options.GitDir,
})
return err
}
......
......@@ -22,7 +22,7 @@ func (x *InitCommand) Execute(a []string) error {
return &flags.Error{flags.ErrDuplicatedFlag, "only one directory can be specified"}
}
dir := options.Dir
dir := options.GitDir
if x.Args.Directory != "" {
dir = x.Args.Directory
}
......@@ -32,6 +32,10 @@ func (x *InitCommand) Execute(a []string) error {
_, err := git.PlainInitWithOptions(dir, &git.PlainInitOptions{
Bare: x.Bare,
})
if err == git.ErrRepositoryAlreadyExists {
fmt.Printf("Reinitialized existing Git repository in %s\n", dir)
return nil
}
if err != nil {
return err
}
......
File moved
......@@ -9,7 +9,7 @@ import (
)
type Options struct {
Dir string `long:"git-dir" description:"Path to store objects." value-name:"<path>" env:"GIT_DIR" default:".git"`
GitDir string `long:"git-dir" description:"Path to store objects." value-name:"<path>" env:"GIT_DIR" default:".git"`
WorkTree string `long:"work-tree" description:"Path to the working tree." value-name:"<path>" env:"GIT_WORK_TREE" default:"."`
LogLevel func(string) `long:"log-level" description:"Set the structured logging level." choice:"debug" choice:"info" choice:"warning" choice:"error" default:"error"`
}
......