chiark / gitweb /
Dgit.pm: $negate_harmful_gitattrs: Break out from dgit
[dgit.git] / Debian / Dgit.pm
index dcecbd1a840e7f0c7718b398d585e2e4d4e3fe77..6977ed21d36781d1246e83617f9921cf20d18787 100644 (file)
@@ -45,7 +45,7 @@ BEGIN {
                       fail ensuredir executable_on_path
                       waitstatusmsg failedcmd_waitstatus
                      failedcmd_report_cmd failedcmd
-                      cmdoutput cmdoutput_errok
+                      runcmd cmdoutput cmdoutput_errok
                       git_rev_parse git_cat_file
                      git_get_ref git_for_each_ref
                       git_for_each_tag_referring is_fast_fwd
@@ -55,7 +55,8 @@ BEGIN {
                       initdebug enabledebug enabledebuglevel
                       printdebug debugcmd
                       $debugprefix *debuglevel *DEBUG
-                      shellquote printcmd messagequote);
+                      shellquote printcmd messagequote
+                      $negate_harmful_gitattrs);
     # implicitly uses $main::us
     %EXPORT_TAGS = ( policyflags => [qw(NOFFCHECK FRESHREPO NOCOMMITCHECK)] );
     @EXPORT_OK   = @{ $EXPORT_TAGS{policyflags} };
@@ -82,6 +83,8 @@ sub NOCOMMITCHECK () { return 0x8; }
 our $debugprefix;
 our $debuglevel = 0;
 
+our $negate_harmful_gitattrs = "-text -eol -crlf -ident -filter";
+
 our $forkcheck_mainprocess;
 
 sub forkcheck_setup () {
@@ -276,6 +279,12 @@ sub failedcmd {
     fail failedcmd_waitstatus();
 }
 
+sub runcmd {
+    debugcmd "+",@_;
+    $!=0; $?=-1;
+    failedcmd @_ if system @_;
+}
+
 sub cmdoutput_errok {
     confess Dumper(\@_)." ?" if grep { !defined } @_;
     debugcmd "|",@_;