3737# git show $(git merge-base REL9_5_STABLE master)
3838# where the branch to mention is the previously forked-off branch. This
3939# shows the last commit before that branch was made.
40+ #
41+ # Note that --master-only is an imperfect filter, since it will not detect
42+ # cases where a HEAD patch was back-patched awhile later or with a slightly
43+ # different commit message. To find such cases, it's a good idea to look
44+ # through the output of
45+ # git_changelog --non-master-only --oldest-first --since='start-date'
46+ # and then remove anything from the --master-only output that would be
47+ # duplicative.
4048
4149
4250use strict;
@@ -62,6 +70,7 @@ my $brief = 0;
6270my $details_after = 0;
6371my $post_date = 0;
6472my $master_only = 0;
73+ my $non_master_only = 0;
6574my $oldest_first = 0;
6675my $since ;
6776my @output_buffer ;
@@ -71,6 +80,7 @@ Getopt::Long::GetOptions(
7180' brief' => \$brief ,
7281' details-after' => \$details_after ,
7382' master-only' => \$master_only ,
83+ ' non-master-only' => \$non_master_only ,
7484' post-date' => \$post_date ,
7585' oldest-first' => \$oldest_first ,
7686' since=s' => \$since ) || usage();
@@ -236,10 +246,21 @@ while (1)
236246my $winner =
237247$all_commits_by_branch {$best_branch }-> [$position {$best_branch } ];
238248
239- # check for master-only
240- if (!$master_only
241- || ($winner -> {' commits' }[0]-> {' branch' }eq ' master'
242- && @{$winner -> {' commits' } } == 1))
249+ my $print_it = 1;
250+ if ($master_only )
251+ {
252+ $print_it = (@{$winner -> {' commits' } } == 1)
253+ && ($winner -> {' commits' }[0]-> {' branch' }eq ' master' );
254+ }
255+ elsif ($non_master_only )
256+ {
257+ foreach my $c (@{$winner -> {' commits' } })
258+ {
259+ $print_it = 0if ($c -> {' branch' }eq ' master' );
260+ }
261+ }
262+
263+ if ($print_it )
243264{
244265output_details($winner )if (!$details_after );
245266output_str(" %s " ,$winner -> {' message' } ." \n " );
@@ -375,13 +396,14 @@ sub output_details
375396sub usage
376397{
377398print STDERR <<EOM ;
378- Usage: git_changelog [--brief/-b] [--details-after/-d] [--master-only/-m] [--oldest-first/-o] [--post-date/-p] [--since=SINCE]
399+ Usage: git_changelog [--brief/-b] [--details-after/-d] [--master-only/-m] [--non-master-only/-n] [-- oldest-first/-o] [--post-date/-p] [--since=SINCE]
379400 --brief Shorten commit descriptions, omitting branch identification
380401 --details-after Show branch and author info after the commit description
381- --master-only Show commits made exclusively to the master branch
402+ --master-only Show only commits made just in the master branch
403+ --non-master-only Show only commits made just in back branches
382404 --oldest-first Show oldest commits first
383405 --post-date Show branches made after a commit occurred
384- --sincePrint only commits dated since SINCE
406+ --sinceShow only commits dated since SINCE
385407EOM
386408exit 1;
387409}