-
Notifications
You must be signed in to change notification settings - Fork 534
improve git package documentation (fix #231) #295
Conversation
Codecov Report
@@ Coverage Diff @@
## master #295 +/- ##
=======================================
Coverage 77.22% 77.22%
=======================================
Files 117 117
Lines 7948 7948
=======================================
Hits 6138 6138
Misses 1159 1159
Partials 651 651
Continue to review full report at Codecov.
|
blame.go
Outdated
type BlameResult struct { | ||
Path string | ||
Rev plumbing.Hash | ||
// Path is the path of the Blob object that we're blaming |
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.
We blame files, not blobs.
blame.go
Outdated
Path string | ||
// Rev is the hash of the specified Commit used to generate this result | ||
Rev plumbing.Hash | ||
// Lines contains the last person that modifies this line, and the content itself |
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.
Not very clear. Lines contains lines, not person. Maybe reword:
Lines contains the last person that modifies this line, and the content itself
-> Lines contrains every line with its authorship
blame.go
Outdated
@@ -98,8 +96,10 @@ func Blame(c *object.Commit, path string) (*BlameResult, error) { | |||
|
|||
// Line values represent the contents and author of a line in BlamedResult values. | |||
type Line struct { | |||
Author string // email address of the author of the line. | |||
Text string // original text of the line. | |||
// email address of the author of the line. |
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.
Suggested reword: Author is the email address of the last author that modified the line
blame.go
Outdated
Text string // original text of the line. | ||
// email address of the author of the line. | ||
Author string | ||
// original text of the line. |
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.
Add Text
at the begining, such as Text is the original text of the line
blame.go
Outdated
@@ -13,17 +13,21 @@ import ( | |||
"srcd.works/go-git.v4/utils/diff" | |||
) | |||
|
|||
// BlameResult represents the result of a Blame operation |
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.
Add a full stop at the end of the sentence, as it is going to be rendered as English prose by go-doc.
blame.go
Outdated
type BlameResult struct { | ||
Path string | ||
Rev plumbing.Hash | ||
// Path is the path of the File that we're blaming |
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.
full stop.
blame.go
Outdated
Rev plumbing.Hash | ||
// Path is the path of the File that we're blaming | ||
Path string | ||
// Rev is the hash of the specified Commit used to generate this result |
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.
Full stop.
Maybe you should mention that rev is the abbreviation of revision, or change the field name to Revision
.
blame.go
Outdated
Path string | ||
// Rev is the hash of the specified Commit used to generate this result | ||
Rev plumbing.Hash | ||
// Lines contains every line with its authorship |
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.
Full stop.
blame.go
Outdated
// The output is a slice of commits, one for each line in the file. | ||
// Blame returns a BlameResult that contains all the data needed to know the | ||
// last author of each line of an specified file starting the history from | ||
// a specified commit. The file to blame is identified by the input arguments: |
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.
I don't understand what you mean here by "starting the history from a specified commit".
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.
The specified commit is the commit that you are using to call Blame. The BlameResult will change depending of the commit you are using.
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.
Some alternative rewordings:
A) This is correct, but maybe too short and dependent on the BlameResult definition.
Blame returns a BlameResult for file `path` in commit `c`.
B) This one is more user friendly.
Blame returns a BlameResult with the information about the
last author of each line from file `path` at commit `c`.
The original wording, written by me, was too verbose, because I was
not familiarized with go-git back then and I feel the need to explain
how the same file in different commits are different entries. Now I
clearly see being so verbose is no good.
I will also make private the rest of the paragraphs in this comment, as
you did with the one referencing the paper.
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.
👍
// described in Zimmermann, et al. "Mining Version Archives for | ||
// Co-changed Lines", in proceedings of the Mining Software | ||
// Repositories workshop, Shanghai, May 22-23, 2006. | ||
// |
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.
Why did you remove this comment? how are you going to understand the current implementation without the paper describing the algorithm? it is probably the most important comment in the whole file. I agree it should not be public, though, it should be private as it explains the implementation details.
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.
Regarding to #231 (General questions) how the things are implemented is not documentation.
I will keep this comment inside the method.
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.
👍
blame.go
Outdated
@@ -98,8 +96,10 @@ func Blame(c *object.Commit, path string) (*BlameResult, error) { | |||
|
|||
// Line values represent the contents and author of a line in BlamedResult values. | |||
type Line struct { | |||
Author string // email address of the author of the line. | |||
Text string // original text of the line. | |||
// Author is the email address of the last author that modified the line |
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.
Full stop.
references.go
Outdated
// - Cherry-picks are not detected unless there are no commits between them and | ||
// therefore can appear repeated in the list. | ||
// (see git path-id for hints on how to fix this). | ||
// therefore can appear repeated in the list. (see git path-id for hints on how to fix this). |
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.
This comment line looks longer than the rest, it may be longer than 60 or 70 chars (or whatever the line length we are using for comments).
remote.go
Outdated
@@ -32,7 +32,7 @@ func newRemote(s storage.Storer, c *config.RemoteConfig) *Remote { | |||
return &Remote{s: s, c: c} | |||
} | |||
|
|||
// Config return the config | |||
// Config returns the RemoteConfig object used to instantiate this Remote |
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.
Full stop.
blame.go
Outdated
// The output is a slice of commits, one for each line in the file. | ||
// Blame returns a BlameResult that contains all the data needed to know the | ||
// last author of each line of an specified file starting the history from | ||
// a specified commit. The file to blame is identified by the input arguments: |
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.
Some alternative rewordings:
A) This is correct, but maybe too short and dependent on the BlameResult definition.
Blame returns a BlameResult for file `path` in commit `c`.
B) This one is more user friendly.
Blame returns a BlameResult with the information about the
last author of each line from file `path` at commit `c`.
The original wording, written by me, was too verbose, because I was
not familiarized with go-git back then and I feel the need to explain
how the same file in different commits are different entries. Now I
clearly see being so verbose is no good.
I will also make private the rest of the paragraphs in this comment, as
you did with the one referencing the paper.
No description provided.