All checks were successful
continuous-integration/drone/push Build is passing
This implements coop-cloud/organising#540 by checking if a`release/next` file exists and if so moves it to `release/<tag>`. When no release notes exists it prompts for them. Reviewed-on: coop-cloud/abra#393 Reviewed-by: moritz <moritz.m@local-it.org> Co-authored-by: p4u1 <p4u1_f4u1@riseup.net> Co-committed-by: p4u1 <p4u1_f4u1@riseup.net>
28 lines
422 B
Go
28 lines
422 B
Go
package git
|
|
|
|
import (
|
|
"github.com/go-git/go-git/v5"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// Add adds a file to the git index.
|
|
func Add(repoPath, path string, dryRun bool) error {
|
|
repo, err := git.PlainOpen(repoPath)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
worktree, err := repo.Worktree()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if dryRun {
|
|
logrus.Debugf("dry run: adding %s", path)
|
|
} else {
|
|
worktree.Add(path)
|
|
}
|
|
|
|
return nil
|
|
}
|