knotserver: fix commit counting for branch creation #447

merged
opened by oppi.li targeting master from push-ytkuzknmmrmn

rev-list was over-counting

Signed-off-by: oppiliappan me@oppi.li

Changed files
+9 -1
knotserver
+9 -1
knotserver/git/post_receive.go
··· 95 95 args := []string{fmt.Sprintf("--max-count=%d", 100)} 96 96 97 97 if line.OldSha.IsZero() { 98 - // just git rev-list <newsha> 98 + // git rev-list <newsha> ^other-branches --not ^this-branch 99 99 args = append(args, line.NewSha.String()) 100 + 101 + branches, _ := g.Branches() 102 + for _, b := range branches { 103 + args = append(args, fmt.Sprintf("^%s", b.Name)) 104 + } 105 + 106 + args = append(args, "--not") 107 + args = append(args, fmt.Sprintf("^%s", line.Ref)) 100 108 } else { 101 109 // git rev-list <oldsha>..<newsha> 102 110 args = append(args, fmt.Sprintf("%s..%s", line.OldSha.String(), line.NewSha.String()))