public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Cord Seele <cowose@googlemail•com>
To: Michael J Gruber <git@drmicha•warpmail.net>
Cc: Git Mailing List <git@vger•kernel.org>,
	Junio C Hamano <gitster@pobox•com>,
	Jakub Narebski <jnareb@gmail•com>
Subject: [PATCH] fix alias expansion with new Git::config_path()
Date: Fri, 14 Oct 2011 16:25:57 +0200	[thread overview]
Message-ID: <20111014142557.GB13680@laptop> (raw)
In-Reply-To: <4E982B27.8050807@drmicha.warpmail.net>

On Fri 14 Oct 2011 14:29:27 +0200, Michael J Gruber <git@drmicha•warpmail.net> 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@drmicha•warpmail.net>]
> Emails will be sent from: Michael J Gruber <git@drmicha•warpmail.net>
> Dry-OK. Log says:
> Sendmail: /home/mjg/bin/msmtp-fastmail-git -i git@vger•kernel.org junio
> git@drmicha•warpmail.net
> From: Michael J Gruber <git@drmicha•warpmail.net>
> To: git@vger•kernel.org
> 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@gmail•com>
---
 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

  reply	other threads:[~2011-10-14 14:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-14 12:29 [BUG] send-email: alias expansion broken Michael J Gruber
2011-10-14 14:25 ` Cord Seele [this message]
2011-10-14 14:30   ` [PATCH] fix alias expansion with new Git::config_path() Michael J Gruber
2011-10-14 14:42     ` Cord Seele
2011-10-14 15:05       ` Junio C Hamano
2011-10-14 16:38     ` Jakub Narebski
2011-10-14 18:13       ` Junio C Hamano
2011-10-14 18:49         ` [PATCH] send-email: Fix %config_path_settings handling Jakub Narebski
2011-10-14 19:26           ` Junio C Hamano
2011-10-14 20:53             ` Jakub Narebski
2011-10-14 23:23               ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111014142557.GB13680@laptop \
    --to=cowose@googlemail$(echo .)com \
    --cc=git@drmicha$(echo .)warpmail.net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=jnareb@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox