// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/model/GitBranch.java
// public interface GitBranch {
// 
//     @Nonnull
//     String getShortName();
// 
//     @Nonnull
//     String getFullName();
// 
//     @Nonnull
//     GitCommit getHead();
// }
// 
// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/model/GitCommit.java
// public interface GitCommit extends HasObjectId {
// 
//     @Nonnull
//     String getMessage();
// 
//     /**
//      * Gets a collection of all tags in the repository that point to this commit.
//      *
//      * @return a collection of {@link GitTag} objects (may be empty)
//      */
//     @Nonnull
//     Collection<? extends GitTag> getTags();
// 
//     /**
//      * Gets a list of the parent commits.
//      *
//      * <p>If a commit has more than one parent, the commit is a merge commit, and the second and any further
//      * parents refer to the merged branch(es).</p>
//      *
//      * @return the list of parent commits; may be empty
//      */
//     @Nonnull
//     List<? extends GitCommit> getParents();
// }
// 
// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/util/io/IOUtils.java
// public final class IOUtils {
// 
//     private IOUtils() { }
// 
//     public static <T> T unchecked(IOCallable<T> callable) {
//         try {
//             return callable.call();
//         } catch (IOException ex) {
//             throw new RuntimeIOException(ex);
//         }
//     }
// 
//     public static void unchecked(IORunnable runnable) {
//         try {
//             runnable.run();
//         } catch (IOException ex) {
//             throw new RuntimeIOException(ex);
//         }
//     }
// }


import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.unbrokendome.gradle.plugins.gitversion.model.GitBranch;
import org.unbrokendome.gradle.plugins.gitversion.model.GitCommit;
import org.unbrokendome.gradle.plugins.gitversion.util.io.IOUtils;
import javax.annotation.Nonnull;
import java.util.Objects;
        } else if (fullName.startsWith(Constants.R_REMOTES)) {
            return fullName.substring(Constants.R_REMOTES.length());
        } else {
            return fullName;
        }
    }


    @Nonnull
    @Override
    public String getFullName() {
        return ref.getName();
    }


    @Nonnull
    @Override
    public GitCommit getHead() {
        ObjectId objectId = IOUtils.unchecked(() -> ref.getLeaf().getObjectId());
        return new JGitCommit(repository, objectId);
    }


    @Override
    public boolean equals(Object obj) {
        return obj instanceof JGitBranch && equals((JGitBranch) obj);
    }


    private boolean equals(JGitBranch other) {
// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/model/GitBranch.java
// public interface GitBranch {
// 
//     @Nonnull
//     String getShortName();
// 
//     @Nonnull
//     String getFullName();
// 
//     @Nonnull
//     GitCommit getHead();
// }
// 
// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/model/GitCommit.java
// public interface GitCommit extends HasObjectId {
// 
//     @Nonnull
//     String getMessage();
// 
//     /**
//      * Gets a collection of all tags in the repository that point to this commit.
//      *
//      * @return a collection of {@link GitTag} objects (may be empty)
//      */
//     @Nonnull
//     Collection<? extends GitTag> getTags();
// 
//     /**
//      * Gets a list of the parent commits.
//      *
//      * <p>If a commit has more than one parent, the commit is a merge commit, and the second and any further
//      * parents refer to the merged branch(es).</p>
//      *
//      * @return the list of parent commits; may be empty
//      */
//     @Nonnull
//     List<? extends GitCommit> getParents();
// }
// 
// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/util/io/IOUtils.java
// public final class IOUtils {
// 
//     private IOUtils() { }
// 
//     public static <T> T unchecked(IOCallable<T> callable) {
//         try {
//             return callable.call();
//         } catch (IOException ex) {
//             throw new RuntimeIOException(ex);
//         }
//     }
// 
//     public static void unchecked(IORunnable runnable) {
//         try {
//             runnable.run();
//         } catch (IOException ex) {
//             throw new RuntimeIOException(ex);
//         }
//     }
// }


// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/model/jgit/JGitBranch.java
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.unbrokendome.gradle.plugins.gitversion.model.GitBranch;
import org.unbrokendome.gradle.plugins.gitversion.model.GitCommit;
import org.unbrokendome.gradle.plugins.gitversion.util.io.IOUtils;
import javax.annotation.Nonnull;
import java.util.Objects;

        } else if (fullName.startsWith(Constants.R_REMOTES)) {
            return fullName.substring(Constants.R_REMOTES.length());
        } else {
            return fullName;
        }
    }


    @Nonnull
    @Override
    public String getFullName() {
        return ref.getName();
    }


    @Nonnull
    @Override
    public GitCommit getHead() {
        ObjectId objectId = IOUtils.unchecked(() -> ref.getLeaf().getObjectId());
        return new JGitCommit(repository, objectId);
    }


    @Override
    public boolean equals(Object obj) {
        return obj instanceof JGitBranch && equals((JGitBranch) obj);
    }


    private boolean equals(JGitBranch other) {
        return repository == other.repository