/** * Gets the remote ref that matches the provided ref spec. * * @param refspec the refspec to parse * @return the matching {@link Ref} or {@link Optional#absent()} if the ref could not be found */ @Override protected Optional<Ref> getRemoteRef(String refspec) { return remoteRepo.command(RefParse.class).setName(refspec).call(); }
@Test public void testPreconditions() { try { command.call(); fail("expected ISE"); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("name has not been set")); } }
@Test public void testPreconditions() { try { command.call(); fail("expected ISE"); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("name has not been set")); } }
/** * Gets the remote ref that matches the provided ref spec. * * @param refspec the refspec to parse * @return the matching {@link Ref} or {@link Optional#absent()} if the ref could not be found */ @Override protected Optional<Ref> getRemoteRef(String refspec) { return remoteRepo.command(RefParse.class).setName(refspec).call(); }
/** * @param ref the ref to find * @return an {@link Optional} of the ref, or {@link Optional#absent()} if it wasn't found */ public Optional<Ref> findRemoteRef(String ref) { String remoteRef = Ref.REMOTES_PREFIX + remote.get().get().getName() + "/" + ref; return command(RefParse.class).setName(remoteRef).call(); } }