Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

hook: get push options and pass them

Signed-off-by: dusk <y.bera003.06@protonmail.com>

Change-Id: sknkqpvptxsxtulrqrrzkwttmxqlykom

authored by

dusk and committed by
Tangled
690d4b2f 67da5514

+16 -1
+10
hook/hook.go
··· 36 36 Usage: "endpoint for the internal API", 37 37 Value: "http://localhost:5444", 38 38 }, 39 + &cli.StringSliceFlag{ 40 + Name: "push-option", 41 + Usage: "any push option from git", 42 + }, 39 43 }, 40 44 Commands: []*cli.Command{ 41 45 { ··· 56 52 userDid := cmd.String("user-did") 57 53 userHandle := cmd.String("user-handle") 58 54 endpoint := cmd.String("internal-api") 55 + pushOptions := cmd.StringSlice("push-option") 59 56 60 57 payloadReader := bufio.NewReader(os.Stdin) 61 58 payload, _ := payloadReader.ReadString('\n') ··· 72 67 req.Header.Set("X-Git-Dir", gitDir) 73 68 req.Header.Set("X-Git-User-Did", userDid) 74 69 req.Header.Set("X-Git-User-Handle", userHandle) 70 + if pushOptions != nil { 71 + for _, option := range pushOptions { 72 + req.Header.Add("X-Git-Push-Option", option) 73 + } 74 + } 75 75 76 76 resp, err := client.Do(req) 77 77 if err != nil {
+6 -1
hook/setup.go
··· 133 133 134 134 hookContent := fmt.Sprintf(`#!/usr/bin/env bash 135 135 # AUTO GENERATED BY KNOT, DO NOT MODIFY 136 - %s hook -git-dir "$GIT_DIR" -user-did "$GIT_USER_DID" -user-handle "$GIT_USER_HANDLE" -internal-api "%s" post-recieve 136 + push_options=() 137 + for ((i=0; i<GIT_PUSH_OPTION_COUNT; i++)); do 138 + option_var="GIT_PUSH_OPTION_$i" 139 + push_options+=(-push-option "${!option_var}") 140 + done 141 + %s hook -git-dir "$GIT_DIR" -user-did "$GIT_USER_DID" -user-handle "$GIT_USER_HANDLE" -internal-api "%s" "${push_options[@]}" post-recieve 137 142 `, executablePath, config.internalApi) 138 143 139 144 return os.WriteFile(hookPath, []byte(hookContent), 0755)