@ 11d698f

191127.9 · 90cbfbf22068b0c3922a8825bdc021cbdb2c07e8

Fixed the behavior of --break and --heading defaults.

Using --break would implicitly set --noheading, and --heading would implicitly set --nobreak.

reading declarations

Changes

@@ -3,6 +3,11 @@ History file for ack 3.  https://beyondgrep.com/  NEXT ========================================+[FIXES]+Fixed the behavior of --break and --heading.  Using --break would+implicitly set --noheading, and --heading would implicitly set --nobreak.++ [FEATURES] Added many new file and directory exclusions to speed up file selection. 

ack

@@ -177,9 +177,8 @@ MAIN: {         }         $opt_color = !App::Ack::output_to_pipe() && $windows_color;     }-    if ( not defined $opt_heading and not defined $opt_break  ) {-        $opt_heading = $opt_break = $opt->{break} = !App::Ack::output_to_pipe();-    }+    $opt_heading //= !App::Ack::output_to_pipe();+    $opt_break //= !App::Ack::output_to_pipe();      if ( defined($opt->{H}) || defined($opt->{h}) ) {         $opt_show_filename = $opt->{show_filename} = $opt->{H} && !$opt->{h};

t/Util.pm

@@ -741,6 +741,9 @@ BEGIN {      if ($has_io_pty) {         no strict 'refs';+        # This function fools ack into thinking it is not writing to a pipe. This lets us test some of ack's default+        # behaviors, like defaulting to --break/--heading in interactive mode, but --nobreak/--noheading when writing+        # to a pipe.         *run_ack_interactive = sub {             my ( @args) = @_; 

t/ack-group.t

@@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 12;+use Test::More tests => 8;  use lib 't'; use Util;@@ -28,7 +28,7 @@ HERE         [qw( --nobreak --noheading --nocolor free )],     );     for my $args ( @cases ) {-        my @results = run_ack( @{$args}, @TEXT_FILES );+        my @results = run_ack_interactive( @{$args}, @TEXT_FILES );         lists_match( \@results, \@expected, 'No grouping' );     } }@@ -52,7 +52,7 @@ HERE         [qw( --heading --break --nocolor free )],     );     for my $args ( @cases ) {-        my @results = run_ack( @{$args}, @TEXT_FILES );+        my @results = run_ack_interactive( @{$args}, @TEXT_FILES );         lists_match( \@results, \@expected, 'Standard grouping' );     } }@@ -70,10 +70,11 @@ HERE      my @arg_sets = (         [qw( --heading --nobreak --nocolor free )],+        [qw( --nobreak --nocolor free )],     );     for my $set ( @arg_sets ) {-        my @results = run_ack( @{$set}, @TEXT_FILES );-        lists_match( \@results, \@expected, 'Standard grouping' );+        my @results = run_ack_interactive( @{$set}, @TEXT_FILES );+        lists_match( \@results, \@expected, 'Heading, no break' );     } } @@ -89,10 +90,11 @@ HERE      my @arg_sets = (         [qw( --break --noheading --nocolor free )],+        [qw( --noheading --nocolor free )],     );     for my $set ( @arg_sets ) {-        my @results = run_ack( @{$set}, @TEXT_FILES );-        lists_match( \@results, \@expected, 'No grouping' );+        my @results = run_ack_interactive( @{$set}, @TEXT_FILES );+        lists_match( \@results, \@expected, 'Break, no heading' );     } } 

t/interactive.t

@@ -38,7 +38,7 @@ HERE }  INTERACTIVE_NOHEADING_NOCOLOR: {-    my @args  = qw( free --nocolor --noheading --sort-files );+    my @args  = qw( free --nocolor --noheading --sort-files ); # But will still default to --break     my @files = qw( t/text );      my $output = run_ack_interactive(@args, @files);@@ -46,7 +46,9 @@ INTERACTIVE_NOHEADING_NOCOLOR: {     is( $output, <<'HERE' ); t/text/bill-of-rights.txt:4:or prohibiting the free exercise thereof; or abridging the freedom of t/text/bill-of-rights.txt:10:A well regulated Militia, being necessary to the security of a free State,+ t/text/constitution.txt:32:Number of free Persons, including those bound to Service for a Term+ t/text/gettysburg.txt:23:shall have a new birth of freedom -- and that government of the people, HERE }

tags

@@ -75,11 +75,10 @@ DASH_NOIGNORE_DIR	t/ack-ignore-dir.t	/^DASH_NOIGNORE_DIR: {$/;"	l DASH_NOIGNORE_DIR_MULTIPLE_TIMES	t/ack-ignore-dir.t	/^DASH_NOIGNORE_DIR_MULTIPLE_TIMES: {$/;"	l DASH_V	t/ack-1.t	/^DASH_V: {$/;"	l DEFAULT_DIR_EXCLUSIONS	t/ack-f.t	/^DEFAULT_DIR_EXCLUSIONS: {$/;"	l-DUMP	t/ack-dump.t	/^DUMP: {$/;"	l DUMP	t/ack-type-del.t	/^DUMP: {$/;"	l+DUMP	t/internals/ack-dump.t	/^DUMP: {$/;"	l EXCLUDE_ONLY	t/inverted-file-filter.t	/^EXCLUDE_ONLY: {$/;"	l EXIT_CODE	t/ack-f.t	/^EXIT_CODE: {$/;"	l-Example	lib/App/Ack.pm	/^Example: ack -i select$/;"	l FILENAME_SUBSTITUTION_1	t/ack-output.t	/^FILENAME_SUBSTITUTION_1 : {$/;"	l FILENAME_SUBSTITUTION_2	t/ack-output.t	/^FILENAME_SUBSTITUTION_2 : {$/;"	l FILENAME_SUBSTITUTION_3	t/ack-output.t	/^FILENAME_SUBSTITUTION_3 : {$/;"	l@@ -87,7 +86,7 @@ FILE_NOT_THERE	t/command-line-files.t	/^FILE_NOT_THERE: {$/;"	l FORCE_NO_PAGER	t/ack-pager.t	/^FORCE_NO_PAGER: {$/;"	l FRONT_ANCHORED	t/anchored.t	/^FRONT_ANCHORED: {$/;"	l F_PRINT0	t/ack-print0.t	/^F_PRINT0: {$/;"	l-FilterTest	t/FilterTest.pm	/^package FilterTest;$/;"	p+FilterTest	t/internals/FilterTest.pm	/^package FilterTest;$/;"	p GROUPING_MULTIPLE_FILES	t/context.t	/^GROUPING_MULTIPLE_FILES: {$/;"	l GROUPING_SINGLE_FILE	t/context.t	/^GROUPING_SINGLE_FILE: {$/;"	l G_NO_PRINT0	t/ack-print0.t	/^G_NO_PRINT0: {$/;"	l@@ -124,6 +123,9 @@ MATCH_VIA_CONTENT	t/filetypes.t	/^MATCH_VIA_CONTENT: {$/;"	l MATCH_WITH_BACKREF	t/ack-color.t	/^MATCH_WITH_BACKREF: {$/;"	l METACHARACTERS	t/highlighting.t	/^METACHARACTERS: {$/;"	l MULTIPLE_MATCHES	t/ack-color.t	/^MULTIPLE_MATCHES: {$/;"	l+MY	Makefile.PL	/^package MY;$/;"	p+MY	Makefile.PL	/^sub MY::postamble {$/;"	s+MY	Makefile.PL	/^sub MY::test {$/;"	s Miscellaneous	lib/App/Ack.pm	/^Miscellaneous:$/;"	l NEEDS_LINE_SCAN	t/needs-line-scan.t	/^NEEDS_LINE_SCAN: {$/;"	l NOIGNORE_DIR_RELATIVE_PATHS	t/ack-ignore-dir.t	/^NOIGNORE_DIR_RELATIVE_PATHS: {$/;"	l@@ -136,6 +138,7 @@ NO_PAGER	t/ack-pager.t	/^NO_PAGER: {$/;"	l NO_SPECIALS_IN_OUTPUT_EXPRESSION	t/ack-output.t	/^NO_SPECIALS_IN_OUTPUT_EXPRESSION : {$/;"	l NO_SWITCHES_MULTIPLE_FILES	t/ack-h.t	/^NO_SWITCHES_MULTIPLE_FILES: {$/;"	l NO_SWITCHES_MULTIPLE_FILES	t/basic.t	/^NO_SWITCHES_MULTIPLE_FILES: {$/;"	l+NO_SWITCHES_ONE_DIRECTORY	t/basic.t	/^NO_SWITCHES_ONE_DIRECTORY: {$/;"	l NO_SWITCHES_ONE_FILE	t/ack-h.t	/^NO_SWITCHES_ONE_FILE: {$/;"	l NO_SWITCHES_ONE_FILE	t/basic.t	/^NO_SWITCHES_ONE_FILE: {$/;"	l NTESTS	t/file-permission.t	/^use constant NTESTS => 5;$/;"	c@@ -153,6 +156,8 @@ POSTMATCH	t/ack-output.t	/^POSTMATCH: {$/;"	l POSTMATCH_MULTIPLE_FILES	t/ack-output.t	/^POSTMATCH_MULTIPLE_FILES: {$/;"	l PREMATCH	t/ack-output.t	/^PREMATCH: {$/;"	l PREMATCH_MULTIPLE_FILES	t/ack-output.t	/^PREMATCH_MULTIPLE_FILES: {$/;"	l+REQUIRE_F_OR_G	t/ack-show-types.t	/^REQUIRE_F_OR_G: {$/;"	l+RUBY_AND_RAKE	t/ack-show-types.t	/^RUBY_AND_RAKE: {$/;"	l RangeFile	t/range.t	/^package RangeFile;$/;"	p RangeFile	t/range/rangefile.pm	/^package RangeFile;$/;"	p SINGLE_FILE_COUNT	t/ack-c.t	/^SINGLE_FILE_COUNT: {$/;"	l@@ -174,7 +179,7 @@ TEST_TYPE	t/ack-type.t	/^TEST_TYPE: {$/;"	l TEST_TYPE_ACKRC_CMD_LINE_OVERRIDE	t/ack-type.t	/^TEST_TYPE_ACKRC_CMD_LINE_OVERRIDE: {$/;"	l TEST_TYPE_OVERRIDE	t/ack-type.t	/^TEST_TYPE_OVERRIDE: {$/;"	l TEST_UNKNOWN_TYPE	t/ack-type.t	/^TEST_UNKNOWN_TYPE: {$/;"	l-TestFilter	t/filter.t	/^package TestFilter;$/;"	p+TestFilter	t/internals/filter.t	/^package TestFilter;$/;"	p UNANCHORED	t/anchored.t	/^UNANCHORED: {$/;"	l UNFILTERED	t/file-iterator.t	/^UNFILTERED: {$/;"	l Usage	lib/App/Ack.pm	/^Usage: ack [OPTION]... PATTERN [FILES OR DIRECTORIES]$/;"	l@@ -191,7 +196,7 @@ WITH_SWITCHES_MULTIPLE_FILES	t/ack-h.t	/^WITH_SWITCHES_MULTIPLE_FILES: {$/;"	l WITH_SWITCHES_MULTIPLE_FILES	t/basic.t	/^WITH_SWITCHES_MULTIPLE_FILES: {$/;"	l WITH_SWITCHES_ONE_FILE	t/ack-h.t	/^WITH_SWITCHES_ONE_FILE: {$/;"	l WITH_SWITCHES_ONE_FILE	t/basic.t	/^WITH_SWITCHES_ONE_FILE: {$/;"	l-_big_split	t/lowercase.t	/^sub _big_split {$/;"	s+_big_split	t/internals/lowercase.t	/^sub _big_split {$/;"	s _check_command_for_taintedness	t/Util.pm	/^sub _check_command_for_taintedness {$/;"	s _check_for_ackrc	lib/App/Ack/ConfigFinder.pm	/^sub _check_for_ackrc {$/;"	s _check_for_mutually_exclusive_options	lib/App/Ack/ConfigLoader.pm	/^sub _check_for_mutually_exclusive_options {$/;"	s@@ -228,6 +233,7 @@ _show_hue_sat_grid	dev/generate-rgb-codes.pl	/^sub _show_hue_sat_grid {$/;"	s _show_rgb_grid	lib/App/Ack.pm	/^sub _show_rgb_grid {$/;"	s _test_home_ackrc	t/forbidden-options.t	/^sub _test_home_ackrc {$/;"	s _test_project_ackrc	t/forbidden-options.t	/^sub _test_project_ackrc {$/;"	s+_type_handler	lib/App/Ack/ConfigLoader.pm	/^    sub _type_handler {$/;"	s _uninvert_filter	lib/App/Ack/ConfigLoader.pm	/^sub _uninvert_filter {$/;"	s _untaint	t/Barfly.pm	/^sub _untaint {$/;"	s _where	dev/generate-rgb-codes.pl	/^sub _where {$/;"	s@@ -243,11 +249,13 @@ add	lib/App/Ack/Filter/IsGroup.pm	/^sub add {$/;"	s add	lib/App/Ack/Filter/IsPathGroup.pm	/^sub add {$/;"	s add	lib/App/Ack/Filter/MatchGroup.pm	/^sub add {$/;"	s add_line	t/Barfly.pm	/^sub add_line {$/;"	s+adjust_executable	t/Util.pm	/^sub adjust_executable {$/;"	s append_file	t/Util.pm	/^sub append_file {$/;"	s are_mutually_exclusive	t/mutex-options.t	/^sub are_mutually_exclusive {$/;"	s bar	t/range.t	/^sub bar {$/;"	s bar	t/range/rangefile.pm	/^sub bar {$/;"	s basename	lib/App/Ack/File.pm	/^sub basename {$/;"	s+bininst	Makefile.PL	/^bininst : $(ACK)$/;"	l bisect	dev/find-minimum-dep-versions.pl	/^sub bisect (&@) {$/;"	s build_ack_invocation	t/Util.pm	/^sub build_ack_invocation {$/;"	s build_regex	ack	/^sub build_regex {$/;"	s@@ -271,12 +279,13 @@ create_group	lib/App/Ack/Filter/Is.pm	/^sub create_group {$/;"	s create_group	lib/App/Ack/Filter/IsPath.pm	/^sub create_group {$/;"	s create_group	lib/App/Ack/Filter/Match.pm	/^sub create_group {$/;"	s create_tempfile	t/Util.pm	/^sub create_tempfile {$/;"	s+critic	Makefile.PL	/^critic:$/;"	l die	lib/App/Ack.pm	/^sub die {$/;"	s dir_cleanup	t/named-pipes.t	/^sub dir_cleanup {$/;"	s display_invocation	dev/timings.pl	/^sub display_invocation {$/;"	s-do_test	t/ack-show-types.t	/^sub do_test {$/;"	s+do_ruby_test	t/ack-show-types.t	/^sub do_ruby_test {$/;"	s exit_from_ack	lib/App/Ack.pm	/^sub exit_from_ack {$/;"	s-expect_ackrcs	t/config-finder.t	/^sub expect_ackrcs {$/;"	s+expect_ackrcs	t/internals/config-finder.t	/^sub expect_ackrcs {$/;"	s file_loop_c	ack	/^sub file_loop_c {$/;"	s file_loop_fg	ack	/^sub file_loop_fg {$/;"	s file_loop_lL	ack	/^sub file_loop_lL {$/;"	s@@ -296,7 +305,7 @@ filter	lib/App/Ack/Filter/IsPathGroup.pm	/^sub filter {$/;"	s filter	lib/App/Ack/Filter/Match.pm	/^sub filter {$/;"	s filter	lib/App/Ack/Filter/MatchGroup.pm	/^sub filter {$/;"	s filter_out_perldoc_noise	t/Util.pm	/^sub filter_out_perldoc_noise {$/;"	s-filter_test	t/FilterTest.pm	/^sub filter_test {$/;"	s+filter_test	t/internals/FilterTest.pm	/^sub filter_test {$/;"	s find_config_files	lib/App/Ack/ConfigFinder.pm	/^sub find_config_files {$/;"	s first_line_like	t/Util.pm	/^sub first_line_like {$/;"	s firstliney	lib/App/Ack/File.pm	/^sub firstliney {$/;"	s@@ -305,6 +314,7 @@ foo	t/range/rangefile.pm	/^sub foo {$/;"	s from_argv	lib/App/Ack/Files.pm	/^sub from_argv {$/;"	s from_file	lib/App/Ack/Files.pm	/^sub from_file {$/;"	s from_stdin	lib/App/Ack/Files.pm	/^sub from_stdin {$/;"	s+fulltest	Makefile.PL	/^fulltest: test_classic test_standalone test_xt$/;"	l get_arg_spec	lib/App/Ack/ConfigLoader.pm	/^sub get_arg_spec {$/;"	s get_expected_options	t/Util.pm	/^sub get_expected_options {$/;"	s get_file_id	ack	/^sub get_file_id {$/;"	s@@ -335,7 +345,7 @@ invert	lib/App/Ack/Filter/Inverse.pm	/^sub invert {$/;"	s is_cygwin	t/Util.pm	/^sub is_cygwin {$/;"	s is_empty_array	t/Util.pm	/^sub is_empty_array {$/;"	s is_filetype	t/filetypes.t	/^sub is_filetype {$/;"	s-is_global_file	t/noenv.t	/^sub is_global_file {$/;"	s+is_global_file	t/internals/noenv.t	/^sub is_global_file {$/;"	s is_inverted	lib/App/Ack/Filter.pm	/^sub is_inverted {$/;"	s is_inverted	lib/App/Ack/Filter/Inverse.pm	/^sub is_inverted {$/;"	s is_lowercase	lib/App/Ack.pm	/^sub is_lowercase {$/;"	s@@ -343,6 +353,7 @@ is_nonempty_array	t/Util.pm	/^sub is_nonempty_array {$/;"	s is_windows	t/Util.pm	/^sub is_windows {$/;"	s line_split	t/Util.pm	/^sub line_split {$/;"	s lists_match	t/Util.pm	/^sub lists_match {$/;"	s+main	Makefile.PL	/^package main;$/;"	p make_unreadable	t/Util.pm	/^sub make_unreadable {$/;"	s may_be_present	lib/App/Ack/File.pm	/^sub may_be_present {$/;"	s msg	t/Util.pm	/^sub msg {$/;"	s@@ -363,9 +374,10 @@ new	lib/App/Ack/Filter/IsPathGroup.pm	/^sub new {$/;"	s new	lib/App/Ack/Filter/Match.pm	/^sub new {$/;"	s new	lib/App/Ack/Filter/MatchGroup.pm	/^sub new {$/;"	s new	t/Barfly.pm	/^sub new {$/;"	s-new	t/filter.t	/^sub new {$/;"	s+new	t/internals/filter.t	/^sub new {$/;"	s next	lib/App/Ack/Files.pm	/^sub next {$/;"	s-no_home	t/config-finder.t	/^sub no_home {$/;"	s+no_home	t/internals/config-finder.t	/^sub no_home {$/;"	s+nytprof	Makefile.PL	/^nytprof: all$/;"	l o	t/file-permission.t	/^sub o { return sprintf '%o', shift }$/;"	s open	lib/App/Ack/File.pm	/^sub open {$/;"	s opt_parser	lib/App/Ack/ConfigLoader.pm	/^sub opt_parser {$/;"	s@@ -387,7 +399,7 @@ range_setup	ack	/^sub range_setup {$/;"	s read_file	t/Util.pm	/^sub read_file {$/;"	s read_rcfile	lib/App/Ack/ConfigLoader.pm	/^sub read_rcfile {$/;"	s register_filter	lib/App/Ack/Filter.pm	/^sub register_filter {$/;"	s-remove_defaults_and_globals	t/noenv.t	/^sub remove_defaults_and_globals {$/;"	s+remove_defaults_and_globals	t/internals/noenv.t	/^sub remove_defaults_and_globals {$/;"	s reset	lib/App/Ack/File.pm	/^sub reset {$/;"	s reslash	t/Util.pm	/^sub reslash {$/;"	s reslash_all	t/Util.pm	/^sub reslash_all {$/;"	s@@ -414,12 +426,18 @@ show_types	lib/App/Ack.pm	/^sub show_types {$/;"	s slurp	t/file-iterator.t	/^sub slurp {$/;"	s strip_special_chars	xt/man.t	/^sub strip_special_chars {$/;"	s subtest_name	t/Util.pm	/^sub subtest_name {$/;"	s-swamp_files	t/FilterTest.pm	/^sub swamp_files {$/;"	s+swamp_files	t/internals/FilterTest.pm	/^sub swamp_files {$/;"	s+tags	Makefile.PL	/^tags:$/;"	l+test	Makefile.PL	/^test: test_classic test_standalone$/;"	l test_ack_with	t/illegal-regex.t	/^sub test_ack_with {$/;"	s-test_loader	t/config-loader.t	/^sub test_loader {$/;"	s+test_classic	Makefile.PL	/^test_classic: all$/;"	l+test_loader	t/internals/config-loader.t	/^sub test_loader {$/;"	s test_match	t/ack-match.t	/^sub test_match {$/;"	s+test_standalone	Makefile.PL	/^test_standalone: all ack-standalone$/;"	l+test_xt	Makefile.PL	/^test_xt: all$/;"	l thpppt	lib/App/Ack.pm	/^sub thpppt {$/;"	s time_ack	dev/timings.pl	/^sub time_ack {$/;"	s+timings	Makefile.PL	/^timings: ack-standalone$/;"	l to_string	lib/App/Ack/Filter.pm	/^sub to_string {$/;"	s to_string	lib/App/Ack/Filter/Collection.pm	/^sub to_string {$/;"	s to_string	lib/App/Ack/Filter/Extension.pm	/^sub to_string {$/;"	s@@ -435,5 +453,5 @@ touch_ackrc	t/Util.pm	/^sub touch_ackrc {$/;"	s untaint	t/Util.pm	/^sub untaint {$/;"	s warn	lib/App/Ack.pm	/^sub warn {$/;"	s windows_slashify	t/Util.pm	/^sub windows_slashify {$/;"	s-with_home	t/config-finder.t	/^sub with_home {$/;"	s+with_home	t/internals/config-finder.t	/^sub with_home {$/;"	s write_file	t/Util.pm	/^sub write_file {$/;"	s