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

Git: Expose blame information in API #59134

Closed
TomasHubelbauer opened this issue Sep 21, 2018 · 2 comments
Closed

Git: Expose blame information in API #59134

TomasHubelbauer opened this issue Sep 21, 2018 · 2 comments
Assignees
Labels
feature-request Request for new features or functionality git GIT issues help wanted Issues identified as good community contribution opportunities
Milestone

Comments

@TomasHubelbauer
Copy link
Contributor

TomasHubelbauer commented Sep 21, 2018

I'd like to request new method be added to the Git extension API detailed in:

https://github.com/Microsoft/vscode/blob/master/extensions/git/src/api/git.d.ts

My use case for this are is that in my extension MarkDown To-Do I currently shell out to Git to get blame for a line in order to determine the age of a MarkDown checkbox (- [ ] checkbox) on that line.

This feature request is prompted by @joaomoreno after his comment in #48674.

@vscodebot vscodebot bot added the markdown Markdown support issues label Sep 21, 2018
@mjbvz mjbvz assigned joaomoreno and unassigned mjbvz Sep 21, 2018
@mjbvz mjbvz removed the markdown Markdown support issues label Sep 21, 2018
@joaomoreno
Copy link
Member

Let's split this into two separate feature request issues. Can you clean this one up and create another one?

Let's keep the blame one here.

@joaomoreno joaomoreno changed the title Consider exposing ignore status and blame information in the Git extension API Git: Expose blame information in API Sep 24, 2018
@joaomoreno joaomoreno added the git GIT issues label Sep 24, 2018
@joaomoreno joaomoreno added this to the Backlog milestone Sep 24, 2018
@joaomoreno joaomoreno added the feature-request Request for new features or functionality label Sep 24, 2018
@joaomoreno joaomoreno added the help wanted Issues identified as good community contribution opportunities label Oct 8, 2019
@anirudhrb
Copy link
Contributor

The blame API is already available:

blame(path: string): Promise<string>;
log(options?: LogOptions): Promise<Commit[]>;
}

and implemented like so:

async blame(path: string): Promise<string> {
try {
const args = ['blame'];
args.push(path);
let result = await this.run(args);
return result.stdout.trim();
} catch (err) {
if (/^fatal: no such path/.test(err.stderr || '')) {
err.gitErrorCode = GitErrorCodes.NoPathFound;
}
throw err;
}
}

Is there something more that is needed?

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality git GIT issues help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests

4 participants