From 86fa7617efcfb468837f58c9b530c4ef7cbcb460 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Tue, 16 Feb 2016 17:21:00 +0100 Subject: package documentation --- blame.go | 8 -------- doc.go | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/blame.go b/blame.go index 66224fe..fa25922 100644 --- a/blame.go +++ b/blame.go @@ -1,11 +1,3 @@ -// Package blame contains blaming functionality for files in the repo. -// -// Blaming a file is finding what commit was the last to modify each of -// the lines in the file, therefore the output of a blaming operation is -// usualy a slice of commits, one commit per line in the file. -// -// This package also provides a pretty print function to output the -// results of a blame in a similar format to the git-blame command. package git import ( diff --git a/doc.go b/doc.go index a37a12d..d6b3cf5 100644 --- a/doc.go +++ b/doc.go @@ -4,4 +4,31 @@ // // We have been following the open/close principle in its design to facilitate // extensions. +// +// Small example extracting the commits from a repository: +// func ExampleBasic_printCommits() { +// r, err := git.NewRepository("https://github.com/src-d/go-git", nil) +// if err != nil { +// panic(err) +// } +// +// if err := r.Pull("origin", "refs/heads/master"); err != nil { +// panic(err) +// } +// +// iter := r.Commits() +// defer iter.Close() +// +// for { +// commit, err := iter.Next() +// if err != nil { +// if err == io.EOF { +// break +// } +// +// panic(err) +// } +// +// fmt.Println(commit) +// } package git -- cgit