0
0
mirror of https://github.com/thegeeklab/wp-git-action.git synced 2024-06-02 18:29:41 +02:00

use pointer

This commit is contained in:
Robert Kaussow 2024-05-06 10:56:47 +02:00
parent 6c8b1da0a4
commit fe43c710d3
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
6 changed files with 16 additions and 16 deletions

View File

@ -8,7 +8,7 @@ import (
)
// FetchSource fetches the source from remote.
func (r Repository) FetchSource() *types.Cmd {
func (r *Repository) FetchSource() *types.Cmd {
args := []string{
"fetch",
"origin",
@ -24,7 +24,7 @@ func (r Repository) FetchSource() *types.Cmd {
}
// CheckoutHead handles branch checkout.
func (r Repository) CheckoutHead() *types.Cmd {
func (r *Repository) CheckoutHead() *types.Cmd {
args := []string{
"checkout",
"-qf",

View File

@ -6,7 +6,7 @@ import (
)
// ForceAdd forces the addition of all dirty files.
func (r Repository) ForceAdd() *types.Cmd {
func (r *Repository) ForceAdd() *types.Cmd {
cmd := execabs.Command(
gitBin,
"add",
@ -21,7 +21,7 @@ func (r Repository) ForceAdd() *types.Cmd {
}
// Add updates the index to match the working tree.
func (r Repository) Add() *types.Cmd {
func (r *Repository) Add() *types.Cmd {
cmd := execabs.Command(
gitBin,
"add",
@ -35,7 +35,7 @@ func (r Repository) Add() *types.Cmd {
}
// TestCleanTree returns non-zero if diff between index and local repository.
func (r Repository) IsCleanTree() *types.Cmd {
func (r *Repository) IsCleanTree() *types.Cmd {
cmd := execabs.Command(
gitBin,
"diff-index",
@ -53,7 +53,7 @@ func (r Repository) IsCleanTree() *types.Cmd {
// Commit creates a new commit with the specified commit message.
// If EmptyCommit is true, it will allow an empty commit.
// If NoVerify is true, it will skip the pre-commit and commit-msg hooks.
func (r Repository) Commit() *types.Cmd {
func (r *Repository) Commit() *types.Cmd {
args := []string{
"commit",
"-m",

View File

@ -9,7 +9,7 @@ import (
// ConfigAutocorrect sets the local git autocorrect configuration for the given repository.
// The autocorrect setting determines how git handles minor typos in commands.
func (r Repository) ConfigAutocorrect() *types.Cmd {
func (r *Repository) ConfigAutocorrect() *types.Cmd {
args := []string{
"config",
"--local",
@ -26,7 +26,7 @@ func (r Repository) ConfigAutocorrect() *types.Cmd {
}
// ConfigUserEmail sets the global git author email.
func (r Repository) ConfigUserEmail() *types.Cmd {
func (r *Repository) ConfigUserEmail() *types.Cmd {
args := []string{
"config",
"--local",
@ -43,7 +43,7 @@ func (r Repository) ConfigUserEmail() *types.Cmd {
}
// ConfigUserName configures the user.name git config setting for the given repository.
func (r Repository) ConfigUserName() *types.Cmd {
func (r *Repository) ConfigUserName() *types.Cmd {
args := []string{
"config",
"--local",
@ -60,7 +60,7 @@ func (r Repository) ConfigUserName() *types.Cmd {
}
// ConfigSSLVerify configures the http.sslVerify git config setting for the given repository.
func (r Repository) ConfigSSLVerify(skipVerify bool) *types.Cmd {
func (r *Repository) ConfigSSLVerify(skipVerify bool) *types.Cmd {
args := []string{
"config",
"--local",

View File

@ -6,7 +6,7 @@ import (
)
// Init creates a new Git repository in the specified directory.
func (r Repository) Init() *types.Cmd {
func (r *Repository) Init() *types.Cmd {
args := []string{
"init",
"-b",

View File

@ -8,7 +8,7 @@ import (
)
// RemoteRemove drops the defined remote from a git repo.
func (r Repository) RemoteRemove() *types.Cmd {
func (r *Repository) RemoteRemove() *types.Cmd {
args := []string{
"remote",
"rm",
@ -24,7 +24,7 @@ func (r Repository) RemoteRemove() *types.Cmd {
}
// RemoteAdd adds an additional remote to a git repo.
func (r Repository) RemoteAdd() *types.Cmd {
func (r *Repository) RemoteAdd() *types.Cmd {
args := []string{
"remote",
"add",
@ -41,7 +41,7 @@ func (r Repository) RemoteAdd() *types.Cmd {
}
// RemotePush pushs the changes from the local head to a remote branch.
func (r Repository) RemotePush() *types.Cmd {
func (r *Repository) RemotePush() *types.Cmd {
args := []string{
"push",
r.RemoteName,

View File

@ -7,7 +7,7 @@ import (
)
// Status returns a command that runs `git status --porcelain` for the given repository.
func (r Repository) Status() *types.Cmd {
func (r *Repository) Status() *types.Cmd {
cmd := execabs.Command(
gitBin,
"status",
@ -24,7 +24,7 @@ func (r Repository) Status() *types.Cmd {
// It runs `git status --porcelain` and returns true if the output is non-empty,
// indicating that there are uncommitted changes in the repository.
// If there is an error running the git command, it returns false.
func (r Repository) IsDirty() bool {
func (r *Repository) IsDirty() bool {
cmd := r.Status()
cmd.Dir = r.WorkDir