Class RebuildCommitGraph


  • class RebuildCommitGraph
    extends TextBuiltin
    Recreates a repository from another one's commit graph.

    Do not run this on a repository unless you want to destroy it.

    To create the input files, in the source repository use:

     git for-each-ref >in.refs
     git log --all '--pretty=format:%H %ct %P' >in.dag
     

    Run the rebuild in either an empty repository, or a clone of the source. Any missing commits (which might be the entire graph) will be created. All refs will be modified to match the input exactly, which means some refs may be deleted from the current repository.

    • Constructor Detail

      • RebuildCommitGraph

        RebuildCommitGraph()
    • Method Detail

      • run

        protected void run()
                    throws java.lang.Exception
        Perform the actions of this command.

        This method should only be invoked by TextBuiltin.execute(String[]).

        Specified by:
        run in class TextBuiltin
        Throws:
        java.lang.Exception - an error occurred while processing the command. The main framework will catch the exception and print a message on standard error.
      • recreateCommitGraph

        private void recreateCommitGraph()
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • detachHead

        private void detachHead()
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • deleteAllRefs

        private void deleteAllRefs()
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • recreateRefs

        private void recreateRefs()
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • computeNewRefs

        private java.util.Map<java.lang.String,​Ref> computeNewRefs()
                                                                  throws java.io.IOException
        Throws:
        java.io.IOException