@@ -41,6 +41,7 @@ import (
4141 "syscall"
4242 "time"
4343
44+ "github.com/go-logr/logr/funcr"
4445 "github.com/golang-jwt/jwt/v4"
4546 "github.com/prometheus/client_golang/prometheus"
4647 "github.com/prometheus/client_golang/prometheus/promhttp"
@@ -803,6 +804,28 @@ func main() {
803804 }
804805 }
805806
807+ // Log configs for debug. The -z means to produce a list of NUL-delimted KV
808+ // pairs, where the first newline is the key/value separator and any
809+ // additional newlines are part of the value.
810+ if stdout , stderr , err := cmdRunner .Run (ctx , "" , nil , * flGitCmd , "config" , "list" , "-z" ); err != nil {
811+ log .Error (err , "can't list git config" )
812+ os .Exit (1 )
813+ } else if stderr != "" {
814+ log .V (0 ).Info ("unexpected stderr reading git config" , "stdout" , stdout , "stderr" , stderr )
815+ os .Exit (1 )
816+ } else {
817+ cfgs := strings .Split (stdout , string (rune (0 )))
818+ kvs := funcr.PseudoStruct {} // like a map but ordered
819+ for _ , cfg := range cfgs {
820+ if cfg == "" {
821+ continue
822+ }
823+ parts := strings .SplitN (cfg , "\n " , 2 ) // any additional newlines are part of the value
824+ kvs = append (kvs , parts [0 ], parts [1 ])
825+ }
826+ log .V (0 ).Info ("git config" , "configs" , kvs )
827+ }
828+
806829 // The scope of the initialization context ends here, so we call cancel to release resources associated with it.
807830 cancel ()
808831
0 commit comments