Perhaps the easiest approach is to set a global timeout for all Git operations (say 30 minutes) which could be overridden by a system property. This can be enforced in GitAPI.launchCommandIn() by using ProcStarter.joinWithTimeout() instead of just join().
Instead of a global default for all commands, you could perhaps create an overloaded version of launchCommandIn which accepts a timeout, defaulting to Integer.MAX_VALUE. It looks like this method is already overloaded, so this may be messy.
Or perhaps it is best to just perform the fetching using a Future/Task thread which could joinWithTimeout. It seems like polling is the one place where a timeout is required, since a build can/should timeout through other mechanisms.
Perhaps the easiest approach is to set a global timeout for all Git operations (say 30 minutes) which could be overridden by a system property. This can be enforced in GitAPI.launchCommandIn() by using ProcStarter.joinWithTimeout() instead of just join().
Instead of a global default for all commands, you could perhaps create an overloaded version of launchCommandIn which accepts a timeout, defaulting to Integer.MAX_VALUE. It looks like this method is already overloaded, so this may be messy.
Or perhaps it is best to just perform the fetching using a Future/Task thread which could joinWithTimeout. It seems like polling is the one place where a timeout is required, since a build can/should timeout through other mechanisms.