Skip to content

Commit cd749fc

Browse files
authored
Fix NPE in remote/origin error message (#17 fixes #16)
2 parents 52fd295 + eeaf8a1 commit cd749fc

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Fixed
9+
- When the remote branch was missing (as in a bare checkout), the user got an NPE rather than a nice error message. ([#16](https://github.com/diffplug/spotless-changelog/issues/16))
810

911
## [2.0.0] - 2020-06-16
1012
### Changed

settings.gradle

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
pluginManagement {
22
plugins {
3-
id 'com.diffplug.blowdryer' version '1.0.0'
4-
id 'com.diffplug.blowdryerSetup' version '1.0.0'
5-
id 'com.diffplug.eclipse.mavencentral' version '3.22.0'
6-
id 'com.diffplug.gradle.spotless' version '4.3.0'
3+
id 'com.diffplug.blowdryer' version '1.1.1'
4+
id 'com.diffplug.blowdryerSetup' version '1.1.1'
5+
id 'com.diffplug.osgi.bndmanifest' version '3.28.0'
76
id 'com.diffplug.spotless-changelog' version '2.0.0'
8-
id 'com.gradle.plugin-publish' version '0.12.0'
9-
id 'com.jfrog.bintray' version '1.8.5'
10-
id 'org.jdrupes.mdoclet' version '1.0.10'
7+
id 'com.diffplug.spotless' version '5.10.1'
8+
id 'com.gradle.plugin-publish' version '0.13.0'
9+
id 'com.jfrog.bintray' version '1.8.5'
10+
id 'org.jdrupes.mdoclet' version '1.0.10'
1111
}
1212
}
1313
plugins {
1414
id 'com.diffplug.blowdryerSetup'
15-
id 'com.diffplug.eclipse.mavencentral' apply false
16-
id 'com.diffplug.gradle.spotless' apply false
15+
id 'com.diffplug.osgi.bndmanifest' apply false
16+
id 'com.diffplug.spotless' apply false
1717
id 'com.diffplug.spotless-changelog' apply false
18-
id 'com.gradle.plugin-publish' apply false
19-
id 'com.jfrog.bintray' apply false
20-
id 'org.jdrupes.mdoclet' apply false
18+
id 'com.gradle.plugin-publish' apply false
19+
id 'com.jfrog.bintray' apply false
20+
id 'org.jdrupes.mdoclet' apply false
2121
}
2222
blowdryerSetup {
23-
github 'diffplug/blowdryer-diffplug', 'tag', '3.2.4'
23+
github 'diffplug/blowdryer-diffplug', 'tag', '3.3.0'
2424
//devLocal '../blowdryer-diffplug'
2525
}
2626
rootProject.name = 'spotless-changelog-agg'

spotless-changelog-lib/src/main/java/com/diffplug/spotless/changelog/GitActions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 DiffPlug
2+
* Copyright (C) 2019-2021 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -63,7 +63,7 @@ public void checkCanPush() throws GitAPIException, IOException {
6363
Ref ref = repository.getRefDatabase().exactRef(Constants.R_HEADS + cfg.branch);
6464
Objects.requireNonNull(ref, "Expected ref " + Constants.R_HEADS + cfg.branch);
6565
Ref remoteRef = repository.getRefDatabase().exactRef(Constants.R_REMOTES + cfg.remote + "/" + cfg.branch);
66-
Objects.requireNonNull(ref, "Expected ref " + Constants.R_REMOTES + cfg.remote + "/" + cfg.branch);
66+
Objects.requireNonNull(remoteRef, "Expected ref " + Constants.R_REMOTES + cfg.remote + "/" + cfg.branch);
6767
if (!ref.getObjectId().equals(remoteRef.getObjectId())) {
6868
throw new IllegalStateException("Local branch " + cfg.branch + " is out of sync with " + cfg.remote + ", so we can't safely push it automatically.");
6969
}

0 commit comments

Comments
 (0)