chiark / gitweb /
dgit: gitattributes: Defuse working-tree-encoding
[dgit.git] / Debian / Dgit.pm
index 3202180587105a7f039278379978b0acd33e0741..aec5a23980ed0bb72450834df43840dd31aaf7d6 100644 (file)
@@ -64,6 +64,7 @@ BEGIN {
                       shellquote printcmd messagequote
                       $negate_harmful_gitattrs
                      changedir git_slurp_config_src
+                     gdr_ffq_prev_branchinfo
                      playtree_setup);
     # implicitly uses $main::us
     %EXPORT_TAGS = ( policyflags => [qw(NOFFCHECK FRESHREPO NOCOMMITCHECK)],
@@ -100,7 +101,9 @@ sub NOCOMMITCHECK () { return 0x8; }
 our $debugprefix;
 our $debuglevel = 0;
 
-our $negate_harmful_gitattrs = "-text -eol -crlf -ident -filter";
+our $negate_harmful_gitattrs =
+    "-text -eol -crlf -ident -filter -working-tree-encoding";
+    # ^ when updating this, alter the regexp in dgit:is_gitattrs_setup
 
 our $forkcheck_mainprocess;
 
@@ -514,6 +517,22 @@ sub git_slurp_config_src ($) {
     return $r;
 }
 
+sub gdr_ffq_prev_branchinfo ($) {
+    my ($symref) = @_;
+    # => ('status', "message", [$symref, $ffq_prev, $gdrlast])
+    # 'status' may be
+    #    branch         message is undef
+    #    weird-symref   } no $symref,
+    #    notbranch      }  no $ffq_prev
+    return ('detached', 'detached HEAD') unless defined $symref;
+    return ('weird-symref', 'HEAD symref is not to refs/')
+       unless $symref =~ m{^refs/};
+    my $ffq_prev = "refs/$ffq_refprefix/$'";
+    my $gdrlast = "refs/$gdrlast_refprefix/$'";
+    printdebug "ffq_prev_branchinfo branch current $symref\n";
+    return ('branch', undef, $symref, $ffq_prev, $gdrlast);
+}
+
 # ========== playground handling ==========
 
 # terminology: