sbt / sbt-ghpages

git, site and ghpages support for sbt projects.
Other
91 stars 20 forks source link

forked project doesn't read remote repo value #6

Open msv opened 10 years ago

msv commented 10 years ago

I forked a project, set the proper git.remoteRepo, but ghpages-push-site still publishes to the original repository's gh-pages branch. .git/config points to the right fork, remoteRepo is set to the fork, so I'm not sure where it's getting remote url string from. Has anyone seen this before?

jsuereth commented 10 years ago

I have not... any more info you can give us?

msv commented 10 years ago

Ok I figured out the issue. The plugin creates a ghpages folder in ~/.sbt. Then it creates dir structure based on the project package, and checks out the gh-pages branch under a dir named after the root project (that's for unidoc, site will create a dir for each aggregate). So here's where the problem is:

Suppose I have a repo with root project "parent". I use ghpages to push the site, it creates a /parent folder that points to the gh-pages branch of that repo. Now suppose I fork the project and attempt to push docs to the fork. Because a /parent folder already exists, it will use it to push, the problem is it points to the original repo.

The work around is to delete the checked out folder. Updating the folder structure to be more fully qualified will fix this issue. If you can point me to where in the code it creates the dir where it checks out the project I can attempt to submit a fix.

Hope that helps!

jsuereth commented 10 years ago

So, we're using this to figure out where to put the repository:

https://github.com/sbt/sbt-ghpages/blob/master/src/main/scala/com/typesafe/sbt/SbtGhPages.scala#L31

Then we issue a copy rather than a "sync" to avoid deleting files that we're not actively publishing:

https://github.com/sbt/sbt-ghpages/blob/master/src/main/scala/com/typesafe/sbt/SbtGhPages.scala#L45-L54

If you have a chance to fix, I'll pull in the change. Otherwise I won't have time for sbt-ghpages for a week or so (travel).