[PATCH] fix alias expansion with new Git::config_path()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri 14 Oct 2011 14:29:27 +0200, Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> wrote:

> cec5dae (use new Git::config_path() for aliasesfile, 2011-09-30)
> 
> broke the expansion of aliases for me:
> 
> ./git-send-email --cc=junio  --dry-run
> 0001-t7800-avoid-arithmetic-expansion-notation.patch
> 0001-t7800-avoid-arithmetic-expansion-notation.patch
> Who should the emails appear to be from? [Michael J Gruber
> <git@xxxxxxxxxxxxxxxxxxxx>]
> Emails will be sent from: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx>
> Dry-OK. Log says:
> Sendmail: /home/mjg/bin/msmtp-fastmail-git -i git@xxxxxxxxxxxxxxx junio
> git@xxxxxxxxxxxxxxxxxxxx
> From: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx>
> To: git@xxxxxxxxxxxxxxx
> Cc: junio
> ...
> 
> Happens with both "--cc junio" and "--cc=junio".
> 
> Reverting cec5dae brings my aliases back. Relevant config:
> 
> git config --get-regexp sendemail.alias\*
> sendemail.aliasesfile /home/mjg/git/gitauthors
> sendemail.aliasfiletype mutt
> 
> Can I please have alias expansion back?

The following patch fixes it for me, please give it a try.

Since this fix is simply copy&pasting some code from the config_settings path
someone with better perl understanding might wnat to refactor it
(Junio/Jacob)?

-- Cord


Signed-off-by: Cord Seele <cowose@xxxxxxxxx>
---
 git-send-email.perl |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 91607c5..6885dfa 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -337,8 +337,16 @@ sub read_config {
 	}
 
 	foreach my $setting (keys %config_path_settings) {
-		my $target = $config_path_settings{$setting}->[0];
-		$$target = Git::config_path(@repo, "$prefix.$setting") unless (defined $$target);
+		my $target = $config_path_settings{$setting};
+		if (ref($target) eq "ARRAY") {
+			unless (@$target) {
+				my @values = Git::config_path(@repo, "$prefix.$setting");
+				@$target = @values if (@values && defined $values[0]);
+			}
+		}
+		else {
+			$$target = Git::config_path(@repo, "$prefix.$setting") unless (defined $$target);
+		}
 	}
 
 	foreach my $setting (keys %config_settings) {
-- 
1.7.6.4
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]