cmd/rofl: Fix git repository initialization#543
Conversation
862bcc6 to
09249e9
Compare
| } | ||
|
|
||
| // Initialize .gitignore. | ||
| // Initialize .gitignore in the appropriate path. |
There was a problem hiding this comment.
It's fine if .gitignore lives in the path where the ROFL app is and not the root.
There was a problem hiding this comment.
That seems kind of messy :/
There was a problem hiding this comment.
No really. In the monorepos it's perfectly fine to have .gitignore for each module, so this should be fine.
There was a problem hiding this comment.
OK, I've updated the code, please have another look :)
| gitInitCmd := exec.Command("git", "init") | ||
| if err = gitInitCmd.Run(); err != nil { | ||
| fmt.Printf("Git repository not initialized: %s.\n", err) | ||
| // Save current working directory. |
There was a problem hiding this comment.
Since you rely on the git command for initializing the repo, I see no reason why not simply execute git rev-parse to check whether the project folder is already part of the git repo and if not, run init?
There was a problem hiding this comment.
That was my initial idea, but then realized that we need to modify the .gitignore file and need its path anyway.
There was a problem hiding this comment.
Btw, we already have a "get me the Git root" as we need it when determining the project base dir for use with the Docker builder. Please take a look at build/env/base.go which should probably be used instead of reimplementing it.
✅ Deploy Preview for oasisprotocol-cli canceled.
|
09249e9 to
65feade
Compare
Fixes #535.