Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getRootHash and getCommitObject on project API #118

Merged
merged 1 commit into from
Aug 9, 2018

Conversation

pmeijer
Copy link
Contributor

@pmeijer pmeijer commented Aug 9, 2018

Before these you needed to first obtain the commit-hash and load the commit-object using the quasi-internal and non-promisfied method loadObject. These simplify the loading of a new root in the core given e.g. a branch:

project.getRootHash('master')
  .then(rootHash => core.loadRoot(rootHash))   
  .then((rootNode) => {
     ...
  })
        /**
         * Retrieves the root hash at the provided branch or commit-hash.
         * @param {string} branchNameOrCommitHash - Name of branch or a commit-hash.
         * @param {function} [callback] - if provided no promise will be returned.
         *
         * @return {external:Promise}  On success the promise will be resolved with
         * {@link module:Core~ObjectHash} <b>rootHash</b>.<br>
         * On error the promise will be rejected with {@link Error} <b>error</b>.
         */
        this.getRootHash = function (branchNameOrCommitHash, callback) {
        ...
        }
        /**
         * Retrieves the commit-object at the provided branch or commit-hash.
         * @param {string} branchNameOrCommitHash - Name of branch or a commit-hash.
         * @param {function} [callback] - if provided no promise will be returned.
         *
         * @return {external:Promise}  On success the promise will be resolved with
         * {@link module:Storage~CommitObject} <b>commitObject</b>.<br>
         * On error the promise will be rejected with {@link Error} <b>error</b>.
         */
        this.getCommitObject = function (branchNameOrCommitHash, callback) {
        ...
        }

@kecso kecso merged commit 93665c2 into master Aug 9, 2018
@pmeijer pmeijer deleted the add-utility-methods-on-project branch August 9, 2018 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants