Merge branch 'jc/apply' into next

* jc/apply:
  apply --numstat: show new name, not old name.
  Ensure author & committer before asking for commit message.
  Install git-send-email by default
  send-email: address expansion for common mailers
  diffstat rename squashing fix.
This commit is contained in:
Junio C Hamano 2006-05-15 00:52:20 -07:00
commit 64c6f100c4
6 changed files with 62 additions and 10 deletions

View File

@ -131,7 +131,8 @@ SCRIPT_PERL = \
git-archimport.perl git-cvsimport.perl git-relink.perl \
git-shortlog.perl git-fmt-merge-msg.perl git-rerere.perl \
git-annotate.perl git-cvsserver.perl \
git-svnimport.perl git-mv.perl git-cvsexportcommit.perl
git-svnimport.perl git-mv.perl git-cvsexportcommit.perl \
git-send-email.perl
SCRIPT_PYTHON = \
git-merge-recursive.py
@ -320,10 +321,6 @@ else
endif
endif
ifdef WITH_SEND_EMAIL
SCRIPT_PERL += git-send-email.perl
endif
ifndef NO_CURL
ifdef CURLDIR
# This is still problematic -- gcc does not always want -R.

View File

@ -1779,7 +1779,7 @@ static void numstat_patch_list(struct patch *patch)
{
for ( ; patch; patch = patch->next) {
const char *name;
name = patch->old_name ? patch->old_name : patch->new_name;
name = patch->new_name ? patch->new_name : patch->old_name;
printf("%d\t%d\t", patch->lines_added, patch->lines_deleted);
if (line_termination && quote_c_style(name, NULL, NULL, 0))
quote_c_style(name, NULL, stdout, 0);

9
diff.c
View File

@ -232,11 +232,16 @@ static char *pprint_rename(const char *a, const char *b)
* name-a => name-b
*/
if (pfx_length + sfx_length) {
int a_midlen = len_a - pfx_length - sfx_length;
int b_midlen = len_b - pfx_length - sfx_length;
if (a_midlen < 0) a_midlen = 0;
if (b_midlen < 0) b_midlen = 0;
name = xmalloc(len_a + len_b - pfx_length - sfx_length + 7);
sprintf(name, "%.*s{%.*s => %.*s}%s",
pfx_length, a,
len_a - pfx_length - sfx_length, a + pfx_length,
len_b - pfx_length - sfx_length, b + pfx_length,
a_midlen, a + pfx_length,
b_midlen, b + pfx_length,
a + len_a - sfx_length);
}
else {

View File

@ -640,6 +640,8 @@ case "$no_edit" in
exit 1
;;
esac
git-var GIT_AUTHOR_IDENT > /dev/null || die
git-var GIT_COMMITTER_IDENT > /dev/null || die
${VISUAL:-${EDITOR:-vi}} "$GIT_DIR/COMMIT_EDITMSG"
;;
esac

View File

@ -89,6 +89,41 @@ sub gitvar_ident {
my ($author) = gitvar_ident('GIT_AUTHOR_IDENT');
my ($committer) = gitvar_ident('GIT_COMMITTER_IDENT');
my %aliases;
chomp(my @alias_files = `git-repo-config --get-all sendemail.aliasesfile`);
chomp(my $aliasfiletype = `git-repo-config sendemail.aliasfiletype`);
my %parse_alias = (
# multiline formats can be supported in the future
mutt => sub { my $fh = shift; while (<$fh>) {
if (/^alias\s+(\S+)\s+(.*)$/) {
my ($alias, $addr) = ($1, $2);
$addr =~ s/#.*$//; # mutt allows # comments
# commas delimit multiple addresses
$aliases{$alias} = [ split(/\s*,\s*/, $addr) ];
}}},
mailrc => sub { my $fh = shift; while (<$fh>) {
if (/^alias\s+(\S+)\s+(.*)$/) {
# spaces delimit multiple addresses
$aliases{$1} = [ split(/\s+/, $2) ];
}}},
pine => sub { my $fh = shift; while (<$fh>) {
if (/^(\S+)\s+(.*)$/) {
$aliases{$1} = [ split(/\s*,\s*/, $2) ];
}}},
gnus => sub { my $fh = shift; while (<$fh>) {
if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) {
$aliases{$1} = [ $2 ];
}}}
);
if (@alias_files && defined $parse_alias{$aliasfiletype}) {
foreach my $file (@alias_files) {
open my $fh, '<', $file or die "opening $file: $!\n";
$parse_alias{$aliasfiletype}->($fh);
close $fh;
}
}
my $prompting = 0;
if (!defined $from) {
$from = $author || $committer;
@ -112,6 +147,19 @@ if (!@to) {
$prompting++;
}
sub expand_aliases {
my @cur = @_;
my @last;
do {
@last = @cur;
@cur = map { $aliases{$_} ? @{$aliases{$_}} : $_ } @last;
} while (join(',',@cur) ne join(',',@last));
return @cur;
}
@to = expand_aliases(@to);
@initial_cc = expand_aliases(@initial_cc);
if (!defined $initial_subject && $compose) {
do {
$_ = $term->readline("What subject should the emails start with? ",

View File

@ -74,12 +74,12 @@ Git revision tree visualiser ('gitk')
%setup -q
%build
make %{_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" WITH_OWN_SUBPROCESS_PY=YesPlease WITH_SEND_EMAIL=1 \
make %{_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" WITH_OWN_SUBPROCESS_PY=YesPlease \
prefix=%{_prefix} all %{!?_without_docs: doc}
%install
rm -rf $RPM_BUILD_ROOT
make %{_smp_mflags} DESTDIR=$RPM_BUILD_ROOT WITH_OWN_SUBPROCESS_PY=YesPlease WITH_SEND_EMAIL=1 \
make %{_smp_mflags} DESTDIR=$RPM_BUILD_ROOT WITH_OWN_SUBPROCESS_PY=YesPlease \
prefix=%{_prefix} mandir=%{_mandir} \
install %{!?_without_docs: install-doc}