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
add git blame api #66416
Conversation
|
||
return result.stdout.trim(); | ||
} catch (err) { | ||
throw err; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftovers? 😄
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
add git blame api to git extension, right now I just use string for the result and users take care of the parsing.