@@ -439,39 +439,56 @@ public static boolean hasCommits(Repository repository) {
439439 }
440440 return false ;
441441 }
442+
443+ /**
444+ * Encapsulates the result of cloning or pulling from a repository.
445+ */
446+ public static class LastChange {
447+ public Date when ;
448+ public String who ;
449+
450+ LastChange () {
451+ when = new Date (0 );
452+ }
453+
454+ LastChange (long lastModified ) {
455+ this .when = new Date (lastModified );
456+ }
457+ }
442458
443459 /**
444- * Returns the date of the most recent commit on a branch. If the repository
445- * does not exist Date(0) is returned. If it does exist but is empty, the
446- * last modified date of the repository folder is returned.
460+ * Returns the date and author of the most recent commit on a branch. If the
461+ * repository does not exist Date(0) is returned. If it does exist but is
462+ * empty, the last modified date of the repository folder is returned.
447463 *
448464 * @param repository
449- * @return
465+ * @return a LastChange object
450466 */
451- public static Date getLastChange (Repository repository ) {
467+ public static LastChange getLastChange (Repository repository ) {
452468 if (!hasCommits (repository )) {
453469 // null repository
454470 if (repository == null ) {
455- return new Date ( 0 );
471+ return new LastChange ( );
456472 }
457473 // fresh repository
458- return new Date (repository .getDirectory ().lastModified ());
474+ return new LastChange (repository .getDirectory ().lastModified ());
459475 }
460476
461477 List <RefModel > branchModels = getLocalBranches (repository , true , -1 );
462478 if (branchModels .size () > 0 ) {
463479 // find most recent branch update
464- Date lastChange = new Date ( 0 );
480+ LastChange lastChange = new LastChange ();
465481 for (RefModel branchModel : branchModels ) {
466- if (branchModel .getDate ().after (lastChange )) {
467- lastChange = branchModel .getDate ();
482+ if (branchModel .getDate ().after (lastChange .when )) {
483+ lastChange .when = branchModel .getDate ();
484+ lastChange .who = branchModel .getAuthorIdent ().getName ();
468485 }
469486 }
470487 return lastChange ;
471488 }
472489
473490 // default to the repository folder modification date
474- return new Date (repository .getDirectory ().lastModified ());
491+ return new LastChange (repository .getDirectory ().lastModified ());
475492 }
476493
477494 /**
0 commit comments