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 git blame api #66416

Merged
merged 2 commits into from Jan 16, 2019
Merged

add git blame api #66416

merged 2 commits into from Jan 16, 2019

Conversation

rebornix
Copy link
Member

@rebornix rebornix commented Jan 11, 2019

add git blame api to git extension, right now I just use string for the result and users take care of the parsing.


return result.stdout.trim();
} catch (err) {
throw err;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftovers? 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, for now we only need to specificily handle one error type no such path.

@@ -999,6 +1000,10 @@ export class Repository implements Disposable {
await this.run(Operation.Push, () => this.repository.push(remote, undefined, false, true, forcePushMode));
}

async blame(path: string): Promise<string> {
return await this.run(Operation.Blame, () => this.repository.blame(path));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we parse the blame result into something more structured?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to git log, the output of git blame is more or less free form once we add more options to it. I thought about returing string[] but for --porcelain, one info entry for a line can be multiline so I'd like to suggest to leave the parsing work to callers. Does this make sense?

@joaomoreno joaomoreno added this to the December/January 2019 milestone Jan 16, 2019
@joaomoreno joaomoreno added the git GIT issues label Jan 16, 2019
@joaomoreno joaomoreno merged commit 65fcf31 into master Jan 16, 2019
@joaomoreno joaomoreno deleted the rebornix/git-blame branch January 16, 2019 08:17
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
git GIT issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants