Repositories

<ojarjur@google.com>
[email protected] wants to merge refs/heads/ojarjur/push-and-pull-commands into refs/heads/master

Add implementations of the pull and push subcommands.

<bstanley@google.com>
[email protected] commented on 2015-05-09 01:22:40 with status ℹ️

My only question that applies throughout: What if an error occurs?

Barbara

<bstanley@google.com>
[email protected] commented on 2015-05-09 01:22:40 with status ℹ️
Location { commit: Some("7d3b2f2157e7c1125b354fd5f786e37dafcdc889"), path: Some("commands/pull.go"), range: Some(Range { start_line: Some(45) }) }

What is returned if there's an error? nil?

<bstanley@google.com>
[email protected] commented on 2015-05-09 01:22:40 with status ℹ️
Location { commit: Some("7d3b2f2157e7c1125b354fd5f786e37dafcdc889"), path: Some("commands/pull.go"), range: Some(Range { start_line: Some(36) }) }

Can PullNotes return an error? or be unsuccessful?

<amshali@google.com>
[email protected] commented on 2015-05-11 23:17:59 with status ℹ️
Location { commit: Some("7d3b2f2157e7c1125b354fd5f786e37dafcdc889"), path: Some("repository/git.go"), range: Some(Range { start_line: Some(229) }) }

return "refs/notes/" + remote + "/" + strings.TrimPrefix(localNotesRef, "refs/notes/") ?

<ojarjur@google.com>
[email protected] commented on 2015-05-11 23:23:22 with status ℹ️
Location { commit: Some("7d3b2f2157e7c1125b354fd5f786e37dafcdc889"), path: Some("repository/git.go"), range: Some(Range { start_line: Some(229) }) }

I actually prefer the intermediate value, as it documents what is going on and makes an otherwise quite unwieldy statement easier to understand.

<ojarjur@google.com>
[email protected] commented on 2015-05-11 23:23:22 with status ℹ️
Location { commit: Some("7d3b2f2157e7c1125b354fd5f786e37dafcdc889"), path: Some("commands/pull.go"), range: Some(Range { start_line: Some(45) }) }

No, the return type is error, so nil means there was no error (everything worked as expected).

<ojarjur@google.com>
[email protected] commented on 2015-05-11 23:23:22 with status ℹ️
Location { commit: Some("7d3b2f2157e7c1125b354fd5f786e37dafcdc889"), path: Some("commands/pull.go"), range: Some(Range { start_line: Some(36) }) }

It can fail, but any such failures are treated as fatal and cause the tool to exit with a non-zero status. They would require either an inability to communicate with a remote repo or an internal error in wrapping a call to the git command line tool.

The error return value here is reserved for user errors; something where the right response is to print a usage string.

<amshali@google.com>
[email protected] commented on 2015-05-11 23:34:10 with status 👍