(ctx context.Context, dir, url string)
| 17 | const nothingToCommitErrorText = "nothing to commit" |
| 18 | |
| 19 | func Push(ctx context.Context, dir, url string) error { |
| 20 | defer trace.StartRegion(ctx, "Push").End() |
| 21 | |
| 22 | tmpDir, err := fileutil.CreateDevboxTempDir() |
| 23 | if err != nil { |
| 24 | return err |
| 25 | } |
| 26 | |
| 27 | if err := cloneGitHistory(url, tmpDir); err != nil { |
| 28 | return err |
| 29 | } |
| 30 | |
| 31 | if err := fileutil.CopyAll(dir, tmpDir); err != nil { |
| 32 | return err |
| 33 | } |
| 34 | |
| 35 | if err := createCommit(tmpDir); err != nil { |
| 36 | return err |
| 37 | } |
| 38 | |
| 39 | return push(tmpDir) |
| 40 | } |
| 41 | |
| 42 | func cloneGitHistory(url, dst string) error { |
| 43 | // See https://stackoverflow.com/questions/38999901/clone-only-the-git-directory-of-a-git-repo |
no test coverage detected