diff --git a/lib/util/git/index.spec.ts b/lib/util/git/index.spec.ts
index d23dd7fd618ca21a1975da7ea94004d22cb1bc4c..b2006e6d6ffb155cb89b230390c3fa7df2a95794 100644
--- a/lib/util/git/index.spec.ts
+++ b/lib/util/git/index.spec.ts
@@ -114,6 +114,9 @@ describe('platform/git', () => {
     });
   });
   describe('isBranchStale()', () => {
+    beforeEach(async () => {
+      await git.setBranch('master');
+    });
     it('should return false if same SHA as master', async () => {
       expect(await git.isBranchStale('renovate/future_branch')).toBe(false);
     });
diff --git a/lib/util/git/index.ts b/lib/util/git/index.ts
index 05f056bfedebb8a4a56f1bc23e5cc072751e2017..b35c1f6e488796f0822eb11aa0da31caed949f83 100644
--- a/lib/util/git/index.ts
+++ b/lib/util/git/index.ts
@@ -308,34 +308,30 @@ export async function getCommitMessages(): Promise<string[]> {
 }
 
 export async function setBranch(branchName: string): Promise<string> {
-  if (branchName) {
-    if (!(await branchExists(branchName))) {
-      throwBranchValidationError(branchName);
-    }
-    logger.debug(`Setting current branch to ${branchName}`);
+  if (!(await branchExists(branchName))) {
+    throwBranchValidationError(branchName);
+  }
+  logger.debug(`Setting current branch to ${branchName}`);
+  try {
     config.currentBranch = branchName;
-    try {
-      if (branchName !== 'master') {
-        config.currentBranchSha = (
-          await git.raw(['rev-parse', 'origin/' + branchName])
-        ).trim();
-      }
-      await git.checkout([branchName, '-f']);
-      await git.reset(ResetMode.HARD);
-      const latestCommitDate = (await git.log({ n: 1 })).latest.date;
-      logger.debug({ branchName, latestCommitDate }, 'latest commit');
-    } catch (err) /* istanbul ignore next */ {
-      checkForPlatformFailure(err);
-      if (
-        err.message.includes(
-          'unknown revision or path not in the working tree'
-        ) ||
-        err.message.includes('did not match any file(s) known to git')
-      ) {
-        throwBranchValidationError(branchName);
-      }
-      throw err;
+    config.currentBranchSha = (
+      await git.raw(['rev-parse', 'origin/' + branchName])
+    ).trim();
+    await git.checkout([branchName, '-f']);
+    const latestCommitDate = (await git.log({ n: 1 })).latest.date;
+    logger.debug({ branchName, latestCommitDate }, 'latest commit');
+    await git.reset(ResetMode.HARD);
+  } catch (err) /* istanbul ignore next */ {
+    checkForPlatformFailure(err);
+    if (
+      err.message.includes(
+        'unknown revision or path not in the working tree'
+      ) ||
+      err.message.includes('did not match any file(s) known to git')
+    ) {
+      throwBranchValidationError(branchName);
     }
+    throw err;
   }
   return (
     config.currentBranchSha ||
@@ -396,7 +392,7 @@ export async function isBranchStale(branchName: string): Promise<boolean> {
     '--remotes',
     '--verbose',
     '--contains',
-    config.currentBranchSha || `origin/${config.currentBranch}`,
+    config.currentBranchSha,
   ]);
   return !branches.all.map(localName).includes(branchName);
 }