File tree 1 file changed +10
-11
lines changed
infrastructure/src/main/java/scala/bench
1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -118,17 +118,16 @@ public static ObjectId resolve(String branch, Repository repo) {
118
118
ObjectId id = repo .resolve ("origin/" + branch );
119
119
if (id == null ) {
120
120
id = repo .resolve ("scala/" + branch ); // name of the remote on jenkins, TODO add to config
121
- if (id == null ) {
122
- ObjectId resolve = repo .resolve (branch );
123
- if (resolve == null ) {
124
- throw new IllegalArgumentException ("Cannot resolve: " + branch + " from " + repo );
125
- }
126
- return resolve ;
127
- } else {
128
- return id ;
129
- }
130
- } else {
131
- return id ;
121
+ if (id == null )
122
+ id = repo .resolve (branch );
123
+ }
124
+
125
+ if (id == null )
126
+ throw new IllegalArgumentException ("Cannot resolve: " + branch + " from " + repo );
127
+
128
+ // if `id` is a tag, `peel` goes from the tag object to the referenced commit object
129
+ try (RevWalk w = new RevWalk (repo )) {
130
+ return w .peel (w .parseAny (id )).getId ();
132
131
}
133
132
} catch (IOException e ) {
134
133
throw new RuntimeException (e );
You can’t perform that action at this time.
0 commit comments