Clojure code cleanups

* Simplify nil equality check
* Use positive checks for (when ...) cases
* `repeatedly` can take a length 'n'
* Use `dec` to make this simple operation easier to skim read
* Replace a loop with internal conditional with `while`
* Use (when-not ...) for conditionals where positive-case is nil
* Use Clojure's own readable fn for equality checks with zero
* Use positive conditional checks (nil punning)
* nil equality checks can use the (nil? ...) fn
* Equality checks with zero can use the readable form (zero? ...)
* Simplify negative nil return condition by using (when ...)
Merge branch 'clojure-clean-up' into 1.5.x

* clojure-clean-up:
  Clojure code cleanups
testing: Improve git fetch handling to support refspec

For PR testing we need to download quite a different refspec, this patch
provides a better refspec for PR handling.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #744 from kbarber/maint/1.5.x/improve_git_fetch_for_pr_testing

testing: Improve git fetch handling to support refspec
Merge branch '1.5.x'

* 1.5.x:
  testing: Improve git fetch handling to support refspec
  Clojure code cleanups