Buggy code:
public class RepositoryMonitor { public static final long REMOTE_CHECK_INTERVAL = 6000 ; public static final long LOCAL_CHECK_INTERVAL = 5000 ; public static BooleanProperty hasFoundNewRemoteChanges = new SimpleBooleanProperty ( false ) ; private static boolean ignoreNewRemoteChanges = false ; private static boolean pauseLocalMonitor = false ; private static int pauseCounter = 0 ; private static Thread th ; private static boolean interrupted = false ; public static void beginWatchingRemote ( SessionModel model ) { } private static synchronized void watchRepoForRemoteChanges ( RepoHelper repo ) { RepositoryMonitor . pause ( ) ; if ( ( RepositoryMonitor . th ) != null ) { RepositoryMonitor . interrupted = true ; try { RepositoryMonitor . th . join ( ) ; } catch ( InterruptedException ignored ) { } finally { RepositoryMonitor . interrupted = false ; RepositoryMonitor . th = null ; } } if ( ( repo == null ) || ( ! ( repo . hasRemoteProperty . get ( ) ) ) ) { RepositoryMonitor . unpause ( ) ; return ; } RepositoryMonitor . th = new Thread ( ( ) -> { while ( ! ( RepositoryMonitor . interrupted ) ) { try { List < BranchHelper > localOriginHeads = repo . getRemoteBranches ( ) ; Collection < Ref > remoteHeads = repo . getRefsFromRemote ( false ) ; if ( ( localOriginHeads . size ( ) ) >= ( remoteHeads . size ( ) ) ) { for ( Ref ref : remoteHeads ) { boolean hasFoundMatchingBranch = false ; boolean hasFoundNewChanges = false ; for ( BranchHelper branch : localOriginHeads ) { if ( ref . getName ( ) . equals ( ( "refs//heads//" + ( branch . getBranchName ( ) ) ) ) ) { hasFoundMatchingBranch = true ; <START_BUG> if ( ! ( branch . getHeadID ( ) . equals ( ref . getObjectId ( ) ) ) ) { <END_BUG> hasFoundNewChanges = true ; } break ; } } if ( hasFoundNewChanges || ( ! hasFoundMatchingBranch ) ) { RepositoryMonitor . setFoundNewChanges ( ) ; break ; } } } else { RepositoryMonitor . setFoundNewChanges ( ) ; } } catch ( GitAPIException | IOException ignored ) { } try { Thread . sleep ( RepositoryMonitor . REMOTE_CHECK_INTERVAL ) ; } catch ( InterruptedException e ) { RepositoryMonitor . interrupted = true ; } } } ) ; RepositoryMonitor . resetFoundNewChanges ( ( ( RepositoryMonitor . REMOTE_CHECK_INTERVAL ) * 2 ) ) ; RepositoryMonitor . th . setDaemon ( true ) ; RepositoryMonitor . th . setName ( ( ( "Remote<seq2seq4repair_space>monitor<seq2seq4repair_space>for<seq2seq4repair_space>repository<seq2seq4repair_space>\"" + repo ) + "\"" ) ) ; RepositoryMonitor . th . setPriority ( 2 ) ; RepositoryMonitor . th . start ( ) ; RepositoryMonitor . unpause ( ) ; } private static void setFoundNewChanges ( ) { } public static synchronized void resetFoundNewChanges ( boolean ignore ) { } public static synchronized void resetFoundNewChanges ( long millis ) { } public static synchronized void beginWatchingLocal ( SessionController controller ) { } private static void pauseWatchingRemote ( long millis ) { } private static void pauseWatchingLocal ( long millis ) { } public static synchronized void pause ( long millis ) { } public static synchronized void pause ( ) { } public static synchronized void unpause ( ) { } }

Fix:
if ( ! ( branch . getHeadId ( ) . equals ( ref . getObjectId ( ) ) ) ) {