Interface GitWorkTreeBuilder


public interface GitWorkTreeBuilder
Since:
7.14
  • Method Details

    • alternate

      @Nonnull GitWorkTreeBuilder alternate(@Nonnull com.atlassian.bitbucket.repository.Repository repository)
      Parameters:
      repository - the repository to use as an alternate in the work tree
      Returns:
      the builder
    • checkoutType

      @Nonnull GitWorkTreeBuilder checkoutType(@Nonnull GitCheckoutType type)
      Configures the type of checkout to initialize the work tree with. If not set, the system defaults to GitCheckoutType.NONE.
      Parameters:
      type - the type of checkout to initialize the work tree with
      Returns:
      the builder
    • commit

      @Nonnull GitWorkTreeBuilder commit(@Nullable String commitId)
      Parameters:
      commitId - the commit to set as the tip of the work tree, or null to create an initial commit
      Returns:
      the builder
    • execute

      <T> T execute(@Nonnull GitWorkTreeCallback<T> callback) throws IOException
      Creates a work tree, calls the provided callback, and finally destroys the work tree before returning the callback result.

      A work tree is typically required for operations that create one or more new commits, such as merging or rebasing. For this type of operation, this method sets up a temporary work tree that is automatically cleaned up after the operation completes.

      Type Parameters:
      T - the callback return type
      Parameters:
      callback - the callback to invoke with the work tree
      Returns:
      the callback's result
      Throws:
      IOException - when an I/O error occurs
    • expiry

      @Nonnull GitWorkTreeBuilder expiry(@Nullable Duration expiry)
      Parameters:
      expiry - the duration after which the GitWorkTree automatically expires and becomes eligible for cleanup. If not set, the system default is applied.
      Returns:
      the builder