ChangeEditModifier: Fix exception message when ref cannot be updated

RefUpdate doesn't implement toString and hence the exception message was
not very useful.

Change-Id: Icf24aa5e9955affd4a369c1c5faa074b8a1460fd
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin 2017-09-20 14:38:06 +02:00
parent 8130cfad06
commit 47caf01a7f
1 changed files with 7 additions and 1 deletions

View File

@ -566,7 +566,13 @@ public class ChangeEditModifier {
try (RevWalk revWalk = new RevWalk(repository)) {
RefUpdate.Result res = ru.update(revWalk);
if (res != RefUpdate.Result.NEW && res != RefUpdate.Result.FORCED) {
throw new IOException("update failed: " + ru);
throw new IOException(
"cannot update "
+ ru.getName()
+ " in "
+ repository.getDirectory()
+ ": "
+ ru.getResult());
}
}
}