Class RefDirectoryRename


  • class RefDirectoryRename
    extends RefRename
    Rename any reference stored by RefDirectory.

    This class works by first renaming the source reference to a temporary name, then renaming the temporary name to the final destination reference.

    This strategy permits switching a reference like refs/heads/foo, which is a file, to refs/heads/foo/bar, which is stored inside a directory that happens to match the source name.

    • Field Detail

      • LOG

        private static final org.slf4j.Logger LOG
      • objId

        private ObjectId objId
        The value of the source reference at the start of the rename.

        At the end of the rename the destination reference must have this same value, otherwise we have a concurrent update and the rename must fail without making any changes.

    • Method Detail

      • doRename

        protected RefUpdate.Result doRename()
                                     throws java.io.IOException
        Do the actual rename
        Specified by:
        doRename in class RefRename
        Returns:
        the result of the rename operation.
        Throws:
        java.io.IOException
      • rename

        private static boolean rename​(java.io.File src,
                                      java.io.File dst)
      • linkHEAD

        private boolean linkHEAD​(RefUpdate target)