There isn't anything to compare

Mar 24, 2016 · 358 words · 2 minutes read gitgithub

As an excuse to write more code in Julia, I’ve been working on exercises from Project Euler. These are a collection of numerical coding problems of varying difficulty. Since I’m still learning my way around Julia it is likely that I’ll learn tricks while solving later problems will also apply to earlier problems.

Although Project Euler doesn’t evaluate the code or how quickly it runs I plan to rework problems to improve performance. So I decided to reorganize my repo and include tests for each problem. This way I can easily check whether a new approach still gives a valid solution. However I didn’t know much about writing tests in Julia.

Down the rabbit hole we go.

After some poking around the documentation I found that writing tests are pretty straightforward. I could have written a script to run the tests and could have stopped there. Instead I thought to myself “wouldn’t it be great to include a build status badge on my repo?”.

So I began digging. It quickly became clear that setting up continuous integration would be a little easier if I set up my project as a package. Creating a package isn’t a requirement but has certain benefits such as pre-compilation.

Unfortunately I hadn’t set up my project as a package initially and already had been pushing to GitHub. That was my first mistake.

Fortunately Julia makes creating a new package very easy, just do Pkg.generate($NAME) which creates the package directory. Instead of changing the original project directory I started copying files into the new directory. That was my second mistake.

After copying my files and making the necessary tweaks I tested my package locally. Everything goes pretty smoothly. Finally I push my changes and head over to GitHub to review the pull request only to be met by

There isn’t anything to compare.

master and package are entirely different commit histories.

Well that was unexpected (but it really shouldn’t have been). In the process of converting my project into a package I completely neglected the commit history. A few rebases, a handful of merge conflicts, and several expletives later everything was up and running again.