From b9f0c55a788ccde3a4955911c59b3fdb00a371c9 Mon Sep 17 00:00:00 2001 From: Andy Davidoff Date: Fri, 11 Sep 2020 23:03:13 -0400 Subject: [PATCH] 1.8.23: check branch earlier --- bump.nim | 20 ++++++++++---------- bump.nimble | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bump.nim b/bump.nim index ef64487..7c8de85 100644 --- a/bump.nim +++ b/bump.nim @@ -459,6 +459,16 @@ proc bump*(minor = false; major = false; patch = true; release = false; debug sought.message target = sought.found.get + # if we're not on the master branch, let's just bail for now + let + branch = appearsToBeMasterBranch() + if branch.isNone: + crash "uh oh; i cannot tell if i'm on the master branch" + elif not branch.get: + crash "i'm afraid to modify any branch that isn't master" + else: + debug "good; this appears to be the master branch" + # make a temp file in an appropriate spot, with a significant name let temp = createTemporaryFile(target.package, dotNimble) @@ -533,16 +543,6 @@ proc bump*(minor = false; major = false; patch = true; release = false; debug "dry run and done" return - # if we're not on the master branch, let's just bail for now - let - branch = appearsToBeMasterBranch() - if branch.isNone: - crash "uh oh; i cannot tell if i'm on the master branch" - elif not branch.get: - crash "i'm afraid to modify any branch that isn't master" - else: - debug "good; this appears to be the master branch" - # copy the new .nimble over the old one try: debug &"copying {temp} over {target}" diff --git a/bump.nimble b/bump.nimble index 7f43793..601dbca 100644 --- a/bump.nimble +++ b/bump.nimble @@ -1,4 +1,4 @@ -version = "1.8.22" +version = "1.8.23" author = "disruptek" description = "a tiny tool to bump nimble versions" license = "MIT"