@@ -13,7 +13,7 @@ import (
1313 "code.gitea.io/gitea/modules/globallock"
1414)
1515
16- func GetGitConfig (ctx context.Context , repo Repository , key string ) (string , error ) {
16+ func GitConfigGet (ctx context.Context , repo Repository , key string ) (string , error ) {
1717 result , _ , err := git .NewCommand ("config" , "--get" ).
1818 AddDynamicArguments (key ).
1919 RunStdString (ctx , & git.RunOpts {Dir : repoPath (repo )})
@@ -26,13 +26,13 @@ func GetGitConfig(ctx context.Context, repo Repository, key string) (string, err
2626 return result , nil
2727}
2828
29- func getRepoConfigLockKey (repoStoragePath string ) string {
29+ func repoGitConfigLockKey (repoStoragePath string ) string {
3030 return "repo-config:" + repoStoragePath
3131}
3232
33- // AddGitConfig add a git configuration key to a specific value for the given repository.
34- func AddGitConfig (ctx context.Context , repo Repository , key , value string ) error {
35- releaser , err := globallock .Lock (ctx , getRepoConfigLockKey (repo .RelativePath ()))
33+ // GitConfigAdd add a git configuration key to a specific value for the given repository.
34+ func GitConfigAdd (ctx context.Context , repo Repository , key , value string ) error {
35+ releaser , err := globallock .Lock (ctx , repoGitConfigLockKey (repo .RelativePath ()))
3636 if err != nil {
3737 return err
3838 }
@@ -44,24 +44,24 @@ func AddGitConfig(ctx context.Context, repo Repository, key, value string) error
4444 return err
4545}
4646
47- // UpdateGitConfig updates a git configuration key to a specific value for the given repository.
47+ // GitConfigSet updates a git configuration key to a specific value for the given repository.
4848// If the key does not exist, it will be created.
4949// If the key exists, it will be updated to the new value.
50- func UpdateGitConfig (ctx context.Context , repo Repository , key , value string ) ( string , error ) {
51- releaser , err := globallock .Lock (ctx , getRepoConfigLockKey (repo .RelativePath ()))
50+ func GitConfigSet (ctx context.Context , repo Repository , key , value string ) error {
51+ releaser , err := globallock .Lock (ctx , repoGitConfigLockKey (repo .RelativePath ()))
5252 if err != nil {
53- return "" , err
53+ return err
5454 }
5555 defer releaser ()
5656
57- value , _ , err1 : = git .NewCommand ("config" ).
57+ _ , _ , err = git .NewCommand ("config" ).
5858 AddDynamicArguments (key , value ).
5959 RunStdString (ctx , & git.RunOpts {Dir : repoPath (repo )})
60- return value , err1
60+ return err
6161}
6262
63- func AddGitRemote (ctx context.Context , repo Repository , remoteName , remoteURL string , options ... string ) error {
64- releaser , err := globallock .Lock (ctx , getRepoConfigLockKey (repo .RelativePath ()))
63+ func GitRemoteAdd (ctx context.Context , repo Repository , remoteName , remoteURL string , options ... string ) error {
64+ releaser , err := globallock .Lock (ctx , repoGitConfigLockKey (repo .RelativePath ()))
6565 if err != nil {
6666 return err
6767 }
@@ -77,8 +77,8 @@ func AddGitRemote(ctx context.Context, repo Repository, remoteName, remoteURL st
7777 return err
7878}
7979
80- func RemoveGitRemote (ctx context.Context , repo Repository , remoteName string ) error {
81- releaser , err := globallock .Lock (ctx , getRepoConfigLockKey (repo .RelativePath ()))
80+ func GitRemoteRemove (ctx context.Context , repo Repository , remoteName string ) error {
81+ releaser , err := globallock .Lock (ctx , repoGitConfigLockKey (repo .RelativePath ()))
8282 if err != nil {
8383 return err
8484 }
@@ -89,18 +89,18 @@ func RemoveGitRemote(ctx context.Context, repo Repository, remoteName string) er
8989 return err
9090}
9191
92- // GetRemoteURL returns the url of a specific remote of the repository.
93- func GetRemoteURL (ctx context.Context , repo Repository , remoteName string ) (* giturl.GitURL , error ) {
92+ // GitRemoteGetURL returns the url of a specific remote of the repository.
93+ func GitRemoteGetURL (ctx context.Context , repo Repository , remoteName string ) (* giturl.GitURL , error ) {
9494 addr , err := git .GetRemoteAddress (ctx , repoPath (repo ), remoteName )
9595 if err != nil {
9696 return nil , err
9797 }
9898 return giturl .ParseGitURL (addr )
9999}
100100
101- // PruneRemote prunes the remote branches that no longer exist in the remote repository.
102- func PruneRemote (ctx context.Context , repo Repository , remoteName string , timeout time.Duration , stdout , stderr io.Writer ) error {
103- releaser , err := globallock .Lock (ctx , getRepoConfigLockKey (repo .RelativePath ()))
101+ // FIXME: config related? long-time running?
102+ func GitRemotePrune (ctx context.Context , repo Repository , remoteName string , timeout time.Duration , stdout , stderr io.Writer ) error {
103+ releaser , err := globallock .Lock (ctx , repoGitConfigLockKey (repo .RelativePath ()))
104104 if err != nil {
105105 return err
106106 }
@@ -115,8 +115,9 @@ func PruneRemote(ctx context.Context, repo Repository, remoteName string, timeou
115115 })
116116}
117117
118- func UpdateRemotePrune (ctx context.Context , repo Repository , remoteName string , timeout time.Duration , stdout , stderr io.Writer ) error {
119- releaser , err := globallock .Lock (ctx , getRepoConfigLockKey (repo .RelativePath ()))
118+ // FIXME: config related? long-time running?
119+ func GitRemoteUpdatePrune (ctx context.Context , repo Repository , remoteName string , timeout time.Duration , stdout , stderr io.Writer ) error {
120+ releaser , err := globallock .Lock (ctx , repoGitConfigLockKey (repo .RelativePath ()))
120121 if err != nil {
121122 return err
122123 }
0 commit comments