~edwargix/git.sr.ht

49717721680d64c5acbefd5a8e0a24afcffba217 — Drew DeVault 5 years ago d95fde2
API: return nil if HEAD reference does not exist
4 files changed, 11 insertions(+), 3 deletions(-)

M api/go.mod
M api/go.sum
M api/graph/model/repository.go
M api/loaders/middleware.go
M api/go.mod => api/go.mod +2 -2
@@ 4,7 4,7 @@ go 1.14

require (
	git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3
	git.sr.ht/~sircmpwn/gql.sr.ht v0.0.0-20200519155752-5492494ccefa
	git.sr.ht/~sircmpwn/gql.sr.ht v0.0.0-20200522165442-58de263ab370
	github.com/99designs/gqlgen v0.11.4-0.20200512031635-40570d1b4d70
	github.com/Masterminds/squirrel v1.4.0
	github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect


@@ 18,7 18,7 @@ require (
	github.com/lib/pq v1.5.2
	github.com/martinlindhe/base36 v1.0.0
	github.com/matryer/moq v0.0.0-20200310130814-7721994d1b54 // indirect
	github.com/mitchellh/mapstructure v1.3.0 // indirect
	github.com/mitchellh/mapstructure v1.3.1 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/prometheus/client_golang v1.6.0 // indirect
	github.com/prometheus/common v0.10.0 // indirect

M api/go.sum => api/go.sum +4 -0
@@ 10,6 10,8 @@ git.sr.ht/~sircmpwn/gql.sr.ht v0.0.0-20200519153250-9929f08a73ba h1:Sar7LLCjGDyP
git.sr.ht/~sircmpwn/gql.sr.ht v0.0.0-20200519153250-9929f08a73ba/go.mod h1:V38DHc2+k1GmbNT4pE6OH/2fOXYcZHn9o/PUAEXH1P0=
git.sr.ht/~sircmpwn/gql.sr.ht v0.0.0-20200519155752-5492494ccefa h1:yh3hxZcollhjHZHEjkbh9PrBBFFNClYh0b5SAk+zJAY=
git.sr.ht/~sircmpwn/gql.sr.ht v0.0.0-20200519155752-5492494ccefa/go.mod h1:V38DHc2+k1GmbNT4pE6OH/2fOXYcZHn9o/PUAEXH1P0=
git.sr.ht/~sircmpwn/gql.sr.ht v0.0.0-20200522165442-58de263ab370 h1:0X9bkwmK7jnqCKAItGF1PIn3SJ2BzJNF1jXN0nq1rcI=
git.sr.ht/~sircmpwn/gql.sr.ht v0.0.0-20200522165442-58de263ab370/go.mod h1:V38DHc2+k1GmbNT4pE6OH/2fOXYcZHn9o/PUAEXH1P0=
git.sr.ht/~sircmpwn/gqlgen v0.0.0-20200412134447-57d7234737d4 h1:J/Sb88htNHzZaN6ZEF8BnRWj3LzYoTrOL4WRhZEEiQE=
git.sr.ht/~sircmpwn/gqlgen v0.0.0-20200412134447-57d7234737d4/go.mod h1:W1cijL2EqAyL1eo1WAJ3ijNVkZM2okpYyCF5TRu1VfI=
github.com/99designs/gqlgen v0.11.3 h1:oFSxl1DFS9X///uHV3y6CEfpcXWrDUxVblR4Xib2bs4=


@@ 142,6 144,8 @@ github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc
github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.3.0 h1:iDwIio/3gk2QtLLEsqU5lInaMzos0hDTz8a6lazSFVw=
github.com/mitchellh/mapstructure v1.3.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.3.1 h1:cCBH2gTD2K0OtLlv/Y5H01VQCqmlDxz30kS5Y5bqfLA=
github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=

M api/graph/model/repository.go => api/graph/model/repository.go +4 -0
@@ 7,6 7,7 @@ import (
	"strconv"

	"github.com/go-git/go-git/v5"
	"github.com/go-git/go-git/v5/plumbing"
	sq "github.com/Masterminds/squirrel"

	"git.sr.ht/~sircmpwn/gql.sr.ht/database"


@@ 44,6 45,9 @@ func (r *Repository) Repo() *git.Repository {
func (r *Repository) Head() *Reference {
	ref, err := r.Repo().Head()
	if err != nil {
		if err == plumbing.ErrReferenceNotFound {
			return nil
		}
		panic(err)
	}
	return &Reference{Ref: ref, Repo: r.repo}

M api/loaders/middleware.go => api/loaders/middleware.go +1 -1
@@ 21,7 21,7 @@ import (
	"git.sr.ht/~sircmpwn/git.sr.ht/api/graph/model"
)

var loadersCtxKey = &contextKey{"user"}
var loadersCtxKey = &contextKey{"loaders"}

type contextKey struct {
	name string