Commit Graph

7 Commits

Author SHA1 Message Date
Sam Dowell ae22b20d07 fix: recover when there is unreleased lock file
If a previous git invocation crashes, it is possible that an orphaned
lock file (e.g. shallow.lock) is left on the filesystem. This previously
caused git-sync to crash loop because the lock file is never deleted.

This change adds a check in sanityCheckRepo for the existence of a git
lock file. If the git lock file exists at this stage, then initRepo will
re-initialize the repository.
2024-08-12 10:55:47 -07:00
Tim Hockin 8fa652dafa Break up main.go
Add new files for abspath, credential, and env functions.
2023-10-13 13:27:52 -07:00
Tim Hockin d4f0c07bf1
Fix goroutine leak in git option parsing 2023-07-29 10:18:02 -07:00
justinsb 4aa9cd7487 Lint fixes (part 1)
Fix a few misc linter issues:

main_test.go:750:7: Error return value is not checked (errcheck)
        touch(dirPath)
             ^
main_test.go:759:7: Error return value is not checked (errcheck)
        touch(filePath)
             ^
main_test.go:768:7: Error return value is not checked (errcheck)
        touch(newfilePath)
             ^
main.go:2089:3: S1023: redundant `return` statement (gosimple)
                return
                ^
main.go:1935:13: S1039: unnecessary use of fmt.Sprintf (gosimple)
                sshCmd += fmt.Sprintf(" -o StrictHostKeyChecking=no")
                          ^
main.go:1152:33: SA1016: os.Kill cannot be trapped (did you mean syscall.SIGTERM?) (staticcheck)
        signal.Notify(c, os.Interrupt, os.Kill)
2023-07-29 10:44:16 -04:00
Tim Hockin ed170912c9 Move main.go to root of repo
This allows `go install k8s.io/git-sync` which I like.
2023-05-22 08:40:24 -07:00
Tim Hockin 70feeb5ae1 Use the go-build-template
Faster builds and versions from tags.  Also use alpine as a base image.  We
need alpine for other architectures...

Also change the --wait flag to take a float for sub-second waits.
2016-10-30 17:09:06 -07:00
Tim Hockin ad53194601 Add files from github.com/kubernetes/contrib/git-sync 2016-08-20 14:14:27 -07:00