Skip to content

create_golem corrupts git repo #423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
antoine-sachet opened this issue Apr 28, 2020 · 0 comments · Fixed by #426
Closed

create_golem corrupts git repo #423

antoine-sachet opened this issue Apr 28, 2020 · 0 comments · Fixed by #426

Comments

@antoine-sachet
Copy link
Contributor

Running golem::create_golem in an existing directory under git version control corrupts the git index, which is a fatal error completely breaking the repo.

To reproduce: run golem::create_golem() in a non-empty git repository.

mkdir golem.repro
cd golem.repro
git init
echo Golem repro > README
git add .
git commit -m "Initial commit"
git status
# On branch master
# nothing to commit, working tree clean

# Now go run `golem::create_golem("path/to/golem.repro")` in R and overwrite
# (Cannot run in console since overwriting requires an interactive session)

git status
# error: bad index version 175051126
# fatal: index file corrupt

The fix is ignoring the .git directory in create_golem. In fact, if you want to support running create_golem on an existing shiny app (which you totally should, it is a standard use case to want to convert a normal shiny app to a golem app), you need to be more careful in create_golem.

A better fix would be to modify the package name on the fly as the files are copied instead of copying the shinyexample app then listing all the files (which will list existing files instead of just the copied one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant