Set gist visibility via Git push options (#215)

هذا الالتزام موجود في:
Thomas Miceli
2024-01-30 00:07:57 +01:00
الأصل 7a75c5ecfa
التزام db6d6a5eba
15 ملفات معدلة مع 326 إضافات و213 حذوفات

24
internal/hooks/hook.go Normal file
عرض الملف

@@ -0,0 +1,24 @@
package hooks
import (
"fmt"
"os"
"strconv"
"strings"
)
const BaseHash = "0000000000000000000000000000000000000000"
func pushOptions() map[string]string {
opts := make(map[string]string)
if pushCount, err := strconv.Atoi(os.Getenv("GIT_PUSH_OPTION_COUNT")); err == nil {
for i := 0; i < pushCount; i++ {
opt := os.Getenv(fmt.Sprintf("GIT_PUSH_OPTION_%d", i))
kv := strings.SplitN(opt, "=", 2)
if len(kv) == 2 {
opts[kv[0]] = kv[1]
}
}
}
return opts
}