Merge branch 'svn-wt' of git://bogomips.org/git-svn
authorJunio C Hamano <gitster@pobox.com>
Thu, 27 Oct 2016 22:03:35 +0000 (15:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Oct 2016 22:03:35 +0000 (15:03 -0700)
* 'svn-wt' of git://bogomips.org/git-svn:
git-svn: "git worktree" awareness
git-svn: reduce scope of input record separator change

1  2 
perl/Git.pm
diff --combined perl/Git.pm
index 864123fe8e61f7469b58fef06a04edeb561edd53,d2c5a8d238b877d6a1b687790e0c3a36494c0694..b2732822af0f34c6f7731df8a1a017d19f3e0508
@@@ -59,7 -59,7 +59,7 @@@ require Exporter
                  command_bidi_pipe command_close_bidi_pipe
                  version exec_path html_path hash_object git_cmd_try
                  remote_refs prompt
-                 get_tz_offset
+                 get_tz_offset get_record
                  credential credential_read credential_write
                  temp_acquire temp_is_locked temp_release temp_reset temp_path);
  
@@@ -538,6 -538,20 +538,20 @@@ sub get_tz_offset 
        return sprintf("%s%02d%02d", $sign, (gmtime(abs($t - $gm)))[2,1]);
  }
  
+ =item get_record ( FILEHANDLE, INPUT_RECORD_SEPARATOR )
+ Read one record from FILEHANDLE delimited by INPUT_RECORD_SEPARATOR,
+ removing any trailing INPUT_RECORD_SEPARATOR.
+ =cut
+ sub get_record {
+       my ($fh, $rs) = @_;
+       local $/ = $rs;
+       my $rec = <$fh>;
+       chomp $rec if defined $rs;
+       $rec;
+ }
  
  =item prompt ( PROMPT , ISPASSWORD  )
  
@@@ -871,8 -885,6 +885,8 @@@ Return an array of mailboxes extracted 
  
  =cut
  
 +# Very close to Mail::Address's parser, but we still have minor
 +# differences in some cases (see t9000 for examples).
  sub parse_mailboxes {
        my $re_comment = qr/\((?:[^)]*)\)/;
        my $re_quote = qr/"(?:[^\"\\]|\\.)*"/;
        # divide the string in tokens of the above form
        my $re_token = qr/(?:$re_quote|$re_word|$re_comment|\S)/;
        my @tokens = map { $_ =~ /\s*($re_token)\s*/g } @_;
 +      my $end_of_addr_seen = 0;
  
        # add a delimiter to simplify treatment for the last mailbox
        push @tokens, ",";
                if ($token =~ /^[,;]$/) {
                        # if buffer still contains undeterminated strings
                        # append it at the end of @address or @phrase
 -                      if (@address) {
 -                              push @address, @buffer;
 -                      } else {
 +                      if ($end_of_addr_seen) {
                                push @phrase, @buffer;
 +                      } else {
 +                              push @address, @buffer;
                        }
  
                        my $str_phrase = join ' ', @phrase;
                        push @addr_list, $str_mailbox if ($str_mailbox);
  
                        @phrase = @address = @comment = @buffer = ();
 +                      $end_of_addr_seen = 0;
                } elsif ($token =~ /^\(/) {
                        push @comment, $token;
                } elsif ($token eq "<") {
                        push @phrase, (splice @address), (splice @buffer);
                } elsif ($token eq ">") {
 +                      $end_of_addr_seen = 1;
                        push @address, (splice @buffer);
 -              } elsif ($token eq "@") {
 +              } elsif ($token eq "@" && !$end_of_addr_seen) {
                        push @address, (splice @buffer), "@";
 -              } elsif ($token eq ".") {
 -                      push @address, (splice @buffer), ".";
                } else {
                        push @buffer, $token;
                }