From e5c8d79e66c5aebcc342d1cdf8f4a9ac61aa51fd Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Wed, 7 Mar 2012 09:25:37 -0800 Subject: [PATCH] allow options to be passed through to git log --- bin/git-missing | 14 +++++++++++--- man/git-missing.1 | 10 ++++++++-- man/git-missing.html | 10 +++++++--- man/git-missing.md | 6 +++++- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/bin/git-missing b/bin/git-missing index d9cc283..7a7c8b5 100755 --- a/bin/git-missing +++ b/bin/git-missing @@ -1,7 +1,15 @@ #!/bin/sh -firstbranch=$1 -secondbranch=$2 +# grab first two non-option arguments +for arg in $*; do + if [[ $arg != -* ]]; then + test -z "$firstbranch" && firstbranch=$arg && continue + test -z "$secondbranch" && secondbranch=$arg && continue + else + # add anything else to a passthrough + passthrough="$passthrough $arg" + fi +done test -z "$firstbranch" && echo "at least one branch required" && exit 1 @@ -10,4 +18,4 @@ if test -z "$secondbranch"; then firstbranch= fi -git log $firstbranch...$secondbranch --format="%m %h %s" --left-right +git log $passthrough $firstbranch...$secondbranch --format="%m %h %s" --left-right diff --git a/man/git-missing.1 b/man/git-missing.1 index 4393f33..0deada4 100644 --- a/man/git-missing.1 +++ b/man/git-missing.1 @@ -1,13 +1,13 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "GIT\-MISSING" "1" "December 2011" "" "Git Extras" +.TH "GIT\-MISSING" "1" "March 2012" "" "Git Extras" . .SH "NAME" \fBgit\-missing\fR \- Show commits missing from another branch . .SH "SYNOPSIS" -\fBgit\-missing\fR [] +\fBgit\-missing\fR [] [] . .SH "DESCRIPTION" Shows commits that are in either of two branches but not both\. Useful for seeing what would come across in a merge or push\. @@ -24,6 +24,12 @@ First branch to compare\. If not specified, defaults to currently checked out br .P Second branch to compare\. . +.P +[] +. +.P +Any flags that should be passed to \'git log\', such as \-\-no\-merges\. +. .SH "EXAMPLES" Show commits on either my current branch or master but not both: . diff --git a/man/git-missing.html b/man/git-missing.html index 14e97ca..bc0d2c5 100644 --- a/man/git-missing.html +++ b/man/git-missing.html @@ -76,7 +76,7 @@

SYNOPSIS

-

git-missing [<first branch>] <second branch>

+

git-missing [<first branch>] <second branch> [<git log options>]

DESCRIPTION

@@ -93,6 +93,10 @@

Second branch to compare.

+

[<git log options>]

+ +

Any flags that should be passed to 'git log', such as --no-merges.

+

EXAMPLES

Show commits on either my current branch or master but not both:

@@ -111,7 +115,7 @@

AUTHOR

-

Written by Nate Jones <nate@endot.org>

+

Written by Nate Jones <nate@endot.org>

REPORTING BUGS

@@ -124,7 +128,7 @@
  1. -
  2. December 2011
  3. +
  4. March 2012
  5. git-missing(1)
diff --git a/man/git-missing.md b/man/git-missing.md index 4128dab..befa030 100644 --- a/man/git-missing.md +++ b/man/git-missing.md @@ -3,7 +3,7 @@ git-missing(1) -- Show commits missing from another branch ## SYNOPSIS -`git-missing` [<first branch>] <second branch> +`git-missing` [<first branch>] <second branch> [<git log options>] ## DESCRIPTION @@ -20,6 +20,10 @@ git-missing(1) -- Show commits missing from another branch Second branch to compare. + [<git log options>] + + Any flags that should be passed to 'git log', such as --no-merges. + ## EXAMPLES Show commits on either my current branch or master but not both: