mirror of
https://github.com/cooperspencer/gickup.git
synced 2025-05-11 17:55:34 +02:00
add backup creation date directory in s3 (#320)
* add backup creation date directory in s3 * fix var name --------- Co-authored-by: y.bazhenov <y.bazhenov@arenadata.io>
This commit is contained in:
parent
533b98ba0c
commit
97c26eef7b
4 changed files with 21 additions and 10 deletions
5
main.go
5
main.go
|
@ -155,6 +155,7 @@ func substituteHomeForTildeInPath(path string) string {
|
|||
|
||||
func backup(repos []types.Repo, conf *types.Conf) {
|
||||
checkedpath := false
|
||||
currentDateDir := time.Now().Format("2006-01-02") + "/"
|
||||
|
||||
for _, r := range repos {
|
||||
log.Info().
|
||||
|
@ -217,6 +218,10 @@ func backup(repos []types.Repo, conf *types.Conf) {
|
|||
r.Name = path.Join(r.Hoster, r.Owner, r.Name)
|
||||
}
|
||||
|
||||
if d.DateCreateDir {
|
||||
r.Name = currentDateDir + r.Name
|
||||
}
|
||||
|
||||
defer os.RemoveAll(tempdir)
|
||||
tempClonePath := path.Join(tempdir, r.Name)
|
||||
_, err = local.TempCloneBare(r, tempClonePath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue