Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

improve git package documentation (fix #231) #295

Merged
merged 3 commits into from
Mar 3, 2017
Merged

improve git package documentation (fix #231) #295

merged 3 commits into from
Mar 3, 2017

Conversation

ajnavarro
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Feb 28, 2017

Codecov Report

Merging #295 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #295   +/-   ##
=======================================
  Coverage   77.22%   77.22%           
=======================================
  Files         117      117           
  Lines        7948     7948           
=======================================
  Hits         6138     6138           
  Misses       1159     1159           
  Partials      651      651
Impacted Files Coverage Δ
references.go 71.18% <ø> (ø)
remote.go 69.61% <ø> (ø)
blame.go 54.23% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 047a795...e408162. Read the comment docs.

@mcuadros mcuadros requested a review from alcortesm March 1, 2017 09:26
blame.go Outdated
type BlameResult struct {
Path string
Rev plumbing.Hash
// Path is the path of the Blob object that we're blaming
Copy link
Collaborator

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
Copy link
Collaborator

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.
Copy link
Collaborator

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.
Copy link
Collaborator

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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:
Copy link
Contributor

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".

Copy link
Contributor Author

@ajnavarro ajnavarro Mar 2, 2017

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.
//
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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
Copy link
Contributor

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).
Copy link
Contributor

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
Copy link
Contributor

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:
Copy link
Contributor

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.

@ajnavarro ajnavarro merged commit 199317f into src-d:master Mar 3, 2017
@ajnavarro ajnavarro deleted the improvement/package-git-doc branch March 3, 2017 15:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants