5
5
package git
6
6
7
7
import (
8
+ "context"
8
9
"fmt"
9
10
"strings"
10
11
@@ -24,7 +25,7 @@ func (gpgSettings *GPGSettings) LoadPublicKeyContent() error {
24
25
}
25
26
26
27
// GetDefaultPublicGPGKey will return and cache the default public GPG settings for this repository
27
- func (repo * Repository ) GetDefaultPublicGPGKey (forceUpdate bool ) (* GPGSettings , error ) {
28
+ func (repo * Repository ) GetDefaultPublicGPGKey (ctx context. Context , forceUpdate bool ) (* GPGSettings , error ) {
28
29
if repo .gpgSettings != nil && ! forceUpdate {
29
30
return repo .gpgSettings , nil
30
31
}
@@ -33,21 +34,21 @@ func (repo *Repository) GetDefaultPublicGPGKey(forceUpdate bool) (*GPGSettings,
33
34
Sign : true ,
34
35
}
35
36
36
- value , _ , _ := NewCommand ("config" , "--get" , "commit.gpgsign" ).RunStdString (repo . Ctx , & RunOpts {Dir : repo .Path })
37
+ value , _ , _ := NewCommand ("config" , "--get" , "commit.gpgsign" ).RunStdString (ctx , & RunOpts {Dir : repo .Path })
37
38
sign , valid := ParseBool (strings .TrimSpace (value ))
38
39
if ! sign || ! valid {
39
40
gpgSettings .Sign = false
40
41
repo .gpgSettings = gpgSettings
41
42
return gpgSettings , nil
42
43
}
43
44
44
- signingKey , _ , _ := NewCommand ("config" , "--get" , "user.signingkey" ).RunStdString (repo . Ctx , & RunOpts {Dir : repo .Path })
45
+ signingKey , _ , _ := NewCommand ("config" , "--get" , "user.signingkey" ).RunStdString (ctx , & RunOpts {Dir : repo .Path })
45
46
gpgSettings .KeyID = strings .TrimSpace (signingKey )
46
47
47
- defaultEmail , _ , _ := NewCommand ("config" , "--get" , "user.email" ).RunStdString (repo . Ctx , & RunOpts {Dir : repo .Path })
48
+ defaultEmail , _ , _ := NewCommand ("config" , "--get" , "user.email" ).RunStdString (ctx , & RunOpts {Dir : repo .Path })
48
49
gpgSettings .Email = strings .TrimSpace (defaultEmail )
49
50
50
- defaultName , _ , _ := NewCommand ("config" , "--get" , "user.name" ).RunStdString (repo . Ctx , & RunOpts {Dir : repo .Path })
51
+ defaultName , _ , _ := NewCommand ("config" , "--get" , "user.name" ).RunStdString (ctx , & RunOpts {Dir : repo .Path })
51
52
gpgSettings .Name = strings .TrimSpace (defaultName )
52
53
53
54
if err := gpgSettings .LoadPublicKeyContent (); err != nil {
0 commit comments