本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 line
867B

  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package pipeline
  5. import (
  6. "bytes"
  7. "fmt"
  8. "io"
  9. "strings"
  10. "sync"
  11. "code.gitea.io/gitea/modules/git"
  12. )
  13. // NameRevStdin runs name-rev --stdin
  14. func NameRevStdin(shasToNameReader *io.PipeReader, nameRevStdinWriter *io.PipeWriter, wg *sync.WaitGroup, tmpBasePath string) {
  15. defer wg.Done()
  16. defer shasToNameReader.Close()
  17. defer nameRevStdinWriter.Close()
  18. stderr := new(bytes.Buffer)
  19. var errbuf strings.Builder
  20. if err := git.NewCommand("name-rev", "--stdin", "--name-only", "--always").RunInDirFullPipeline(tmpBasePath, nameRevStdinWriter, stderr, shasToNameReader); err != nil {
  21. _ = shasToNameReader.CloseWithError(fmt.Errorf("git name-rev [%s]: %v - %s", tmpBasePath, err, errbuf.String()))
  22. }
  23. }
上海开阖软件有限公司 沪ICP备12045867号-1