Prashanth Subramanian
Prashanth Subramanian

Reputation: 663

VSTS Rest API for C# - How to return the full comments when getting a list of commits?

The below API method returns commit details for all commitIds, but the comments are truncated, is there a way to get the full comments for each commit without having to make a separate API call for each commit?

GetCommitsAsync(repositoryId, new GitQueryCommitsCriteria() { Ids = commitIds });

Upvotes: 1

Views: 418

Answers (1)

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30432

Based on my test, we cannot get the full comments with the GetCommitsAsync method, no parameters to expand the comment length, especially for the Multi-line comments (Line break ).

And when retrieve the commits using REST API (Get Commits) you can see that "commentTruncated": true,

So, even with the REST API we cannot get the full comments. There's already a user voice here submitted to suggest the feature, but it's not planed yet.

However we can use the git log command to get the full comments for all the commits:

git log --first-parent > export.csv 

You can also format it to display a commit per line:

git log --first-parent --format="%h;%ci;%cn;%s;%N" > export.csv

You can also reference this thread : https://social.msdn.microsoft.com/Forums/en-US/587cedd4-ed32-421a-9aaf-4040c77ce1f5/tfs-git-api-commits-maxcommentlength-limited-to-100-chars-in-the-comments-today?forum=tfsgeneral

Upvotes: 1

Related Questions