package com.atlassian.bitbucket.scm.git;

import com.atlassian.bitbucket.i18n.KeyedMessage;

import javax.annotation.Nonnull;
import java.io.File;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Thrown when a repository operation fails because the layout of the repository on disk does not follow the expected
 * format. For example, when a repository is created, {@code git init} and {@code git clone} have a set of standard
 * directories they create. If any of those directories are missing, it may trigger this exception when the system
 * attempts to use them.
 */
public class GitRepositoryLayoutException extends GitException {

    private final File path;

    public GitRepositoryLayoutException(@Nonnull KeyedMessage message, @Nonnull File path) {
        super(message);

        this.path = checkNotNull(path, "path");
    }

    @Nonnull
    public File getPath() {
        return path;
    }
}
