1. Add the ability to pass through diff options to the "git appraise show --diff" command.
  2. Make all of the commands that take options document what those options are (via the output of "git appraise help ").
  3. Update the README file so that the example commands are more inclusive.


@@ -59,15 +59,19 @@ Showing the status of the current review, including comments:
git appraise show
Commenting on a review:
Showing the diff of a particular review:
git appraise show --diff [--diff-opts "<diff-options>"] [<review-hash>]
Commenting on the current review:
git appraise comment -m "<message>" [<file> [<line>]]
Accepting the changes in a review:
git appraise accept [-m "<message>"]
git appraise accept [-m "<message>"] [<review-hash>]
Submitting a review:
Submitting the current review:
git appraise submit [--merge | --rebase]

Modified commands/list.go

@@ -49,7 +49,8 @@ func listReviews(repo repository.Repo, args []string) {
// listCmd defines the "list" subcommand.
var listCmd = &Command{
Usage: func(arg0 string) {
fmt.Printf("Usage: %s list\n", arg0)
fmt.Printf("Usage: %s list <option>...\n\nOptions:\n", arg0)
RunMethod: func(repo repository.Repo, args []string) error {
listReviews(repo, args)

Modified commands/show.go

@@ -22,16 +22,21 @@ import (
var showFlagSet = flag.NewFlagSet("show", flag.ExitOnError)
var showJsonOutput = showFlagSet.Bool("json", false, "Format the output as JSON")
var showDiffOutput = showFlagSet.Bool("diff", false, "Show the current diff for the review")
var showDiffOptions = showFlagSet.String("diff-opts", "", "Options to pass to the diff tool; can only be used with the --diff option")
// showReview prints the current code review.
func showReview(repo repository.Repo, args []string) error {
args = showFlagSet.Args()
if *showDiffOptions != "" && !*showDiffOutput {
return errors.New("The --diff-opts flag can only be used if the --diff flag is set.")
var r *review.Review
var err error
@@ -55,7 +60,11 @@ func showReview(repo repository.Repo, args []string) error {
return r.PrintJson()
if *showDiffOutput {
return r.PrintDiff()
var diffArgs []string
if *showDiffOptions != "" {
diffArgs = strings.Split(*showDiffOptions, ",")
return r.PrintDiff(diffArgs...)
return r.PrintDetails()
@@ -63,7 +72,8 @@ func showReview(repo repository.Repo, args []string) error {
// showCmd defines the "show" subcommand.
var showCmd = &Command{
Usage: func(arg0 string) {
fmt.Printf("Usage: %s show (<commit>)\n", arg0)
fmt.Printf("Usage: %s show <option>... (<commit>)\n\nOptions:\n", arg0)
RunMethod: func(repo repository.Repo, args []string) error {
return showReview(repo, args)

Modified repository/git.go

@@ -193,7 +193,10 @@ func (repo *GitRepo) IsAncestor(ancestor, descendant string) bool {
// Diff computes the diff between two given commits.
func (repo *GitRepo) Diff(left, right string, diffArgs ...string) string {
return repo.runGitCommandOrDie("diff", left, right)
args := []string{"diff"}
args = append(args, diffArgs...)
args = append(args, fmt.Sprintf("%s..%s", left, right))
return repo.runGitCommandOrDie(args...)
// SwitchToRef changes the currently-checked-out ref.

Modified review/review.go

@@ -425,14 +425,14 @@ func (r *Review) GetBaseCommit() (string, error) {
// PrintDiff displays the diff for a review.
func (r *Review) PrintDiff() error {
func (r *Review) PrintDiff(diffArgs ...string) error {
var baseCommit, headCommit string
baseCommit, err := r.GetBaseCommit()
if err == nil {
headCommit, err = r.GetHeadCommit()
if err == nil {
fmt.Println(r.Repo.Diff(baseCommit, headCommit))
fmt.Println(r.Repo.Diff(baseCommit, headCommit, diffArgs...))
return err