Class StashDropCommand

  • All Implemented Interfaces:
    java.util.concurrent.Callable<ObjectId>

    public class StashDropCommand
    extends GitCommand<ObjectId>
    Command class to delete a stashed commit reference

    Currently only supported on a traditional file repository using one-file-per-ref reflogs.

    Since:
    2.0
    See Also:
    Git documentation about Stash
    • Field Detail

      • stashRefEntry

        private int stashRefEntry
      • all

        private boolean all
    • Constructor Detail

      • StashDropCommand

        public StashDropCommand​(Repository repo)
        Constructor for StashDropCommand.
        Parameters:
        repo - a Repository object.
    • Method Detail

      • setStashRef

        public StashDropCommand setStashRef​(int stashRef)
        Set the stash reference to drop (0-based).

        This will default to drop the latest stashed commit (stash@{0}) if unspecified

        Parameters:
        stashRef - the 0-based index of the stash reference
        Returns:
        this
      • setAll

        public StashDropCommand setAll​(boolean all)
        Set whether to drop all stashed commits
        Parameters:
        all - true to drop all stashed commits, false to drop only the stashed commit set via calling setStashRef(int)
        Returns:
        this
      • createRefUpdate

        private RefUpdate createRefUpdate​(Ref stashRef)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • deleteRef

        private void deleteRef​(Ref stashRef)
      • updateRef

        private void updateRef​(Ref stashRef,
                               ObjectId newId)