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

There should be an option to disable searching for lastTag #56

Open
AndrejZbin opened this issue Jun 2, 2020 · 4 comments
Open

There should be an option to disable searching for lastTag #56

AndrejZbin opened this issue Jun 2, 2020 · 4 comments

Comments

@AndrejZbin
Copy link

For repositories without tags or use cases where lastTag information is not required, findLastTag causes unnecessarily long execution time, as it might iterate though all or nearly all commits.

There should be an option to get repo info without lastTag information, as it would improve the execution time drastically.

@AndrejZbin AndrejZbin changed the title There should be an option to disabled searching for lastTag There should be an option to disable searching for lastTag Jun 2, 2020
@hjdivad
Copy link
Collaborator

hjdivad commented Jun 2, 2020

@AndrejZbin SGTM. Something like

getRepoInfo(path, { findLastTag: false})

If you have time for an implementation I'd be happy to review

@hjdivad
Copy link
Collaborator

hjdivad commented Jun 2, 2020

@AndrejZbin thinking a little more on it, what do you think about making the properties lazy cached getters so you only pay the cost if you actually access the property? And potentially also exporting the individual functions?

Something like

module.exports = function getRepoInfo() {
  return {
    get branch() {
      if(this._branch === undefined) { this._branch = branchInfo(); }
      return this._branch;
    },

    get lastTag() {
      if(this._lastTag === undefined) { this._lastTag = lastTagInfo(); }
      return this._branch;
    },

    // ...
  }
}

module.exports.lastTagInfo = lastTagInfo;
module.exports.branchInfo = branchInfo;
// ...

@AndrejZbin
Copy link
Author

@hjdivad sounds good. I am happy to implement it, unless you or someone else wants to do it :)

@hjdivad
Copy link
Collaborator

hjdivad commented Jun 3, 2020

@AndrejZbin if you have time to implement that would be wonderful. I'd be happy to review the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants