*** commit-email.pl.in.orig	2007-06-20 11:08:41.000000000 +0200
--- commit-email.pl.in	2007-06-20 11:14:11.000000000 +0200
***************
*** 109,115 ****
  # Each value in this array holds a hash reference which contains the
  # associated email information for one project.  Start with an
  # implicit rule that matches all paths.
! my @project_settings_list = (&new_project);
  
  # Process the command line arguments till there are none left.
  # In commit mode: The first two arguments that are not used by a command line
--- 109,128 ----
  # Each value in this array holds a hash reference which contains the
  # associated email information for one project.  Start with an
  # implicit rule that matches all paths.
! my @project_settings_list = ();
! 
! sub current_project
! {
!   if (@project_settings_list == 0) {
!     push(@project_settings_list, &new_project);
!   }
!   return $project_settings_list[-1];
! }
! 
! sub add_project
! {
!   push(@project_settings_list, &new_project);
! }
  
  # Process the command line arguments till there are none left.
  # In commit mode: The first two arguments that are not used by a command line
***************
*** 128,136 ****
  my $date;
  my $diff_file;
  
- # Use the reference to the first project to populate.
- my $current_project = $project_settings_list[0];
- 
  # This hash matches the command line option to the hash key in the
  # project.  If a key exists but has a false value (''), then the
  # command line option is allowed but requires special handling.
--- 141,146 ----
***************
*** 168,182 ****
  
          if ($hash_key)
            {
!             $current_project->{$hash_key} = $value;
            }
          else
            {
              if ($arg eq '-m')
                {
!                 $current_project                = &new_project;
!                 $current_project->{match_regex} = $value;
!                 push(@project_settings_list, $current_project);
                }
              elsif ($arg eq '-d')
                {
--- 178,191 ----
  
          if ($hash_key)
            {
!             current_project()->{$hash_key} = $value;
            }
          else
            {
              if ($arg eq '-m')
                {
!                 add_project();
!                 current_project()->{match_regex} = $value;
                }
              elsif ($arg eq '-d')
                {
***************
*** 203,213 ****
                }
              elsif ($arg eq '--diff')
                {
!                 $current_project->{show_diff} = parse_boolean($value);
                }
              elsif ($arg eq '--stdout')
                {
!                 $current_project->{stdout} = 1;
                }
              else
                {
--- 212,222 ----
                }
              elsif ($arg eq '--diff')
                {
!                 current_project()->{show_diff} = parse_boolean($value);
                }
              elsif ($arg eq '--stdout')
                {
!                 current_project()->{stdout} = 1;
                }
              else
                {
***************
*** 236,242 ****
            }
          else
            {
!             push(@{$current_project->{email_addresses}}, $arg);
            }
        }
    }
--- 245,251 ----
            }
          else
            {
!             push(@{current_project()->{email_addresses}}, $arg);
            }
        }
    }
