Browse Source

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.
maint
Junio C Hamano 19 years ago
parent
commit
64c6f100c4
  1. 7
      Makefile
  2. 2
      apply.c
  3. 9
      diff.c
  4. 2
      git-commit.sh
  5. 48
      git-send-email.perl
  6. 4
      git.spec.in

7
Makefile

@ -131,7 +131,8 @@ SCRIPT_PERL = \
git-archimport.perl git-cvsimport.perl git-relink.perl \ git-archimport.perl git-cvsimport.perl git-relink.perl \
git-shortlog.perl git-fmt-merge-msg.perl git-rerere.perl \ git-shortlog.perl git-fmt-merge-msg.perl git-rerere.perl \
git-annotate.perl git-cvsserver.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 = \ SCRIPT_PYTHON = \
git-merge-recursive.py git-merge-recursive.py
@ -320,10 +321,6 @@ else
endif endif
endif endif


ifdef WITH_SEND_EMAIL
SCRIPT_PERL += git-send-email.perl
endif

ifndef NO_CURL ifndef NO_CURL
ifdef CURLDIR ifdef CURLDIR
# This is still problematic -- gcc does not always want -R. # This is still problematic -- gcc does not always want -R.

2
apply.c

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

9
diff.c

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

2
git-commit.sh

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

48
git-send-email.perl

@ -89,6 +89,41 @@ sub gitvar_ident {
my ($author) = gitvar_ident('GIT_AUTHOR_IDENT'); my ($author) = gitvar_ident('GIT_AUTHOR_IDENT');
my ($committer) = gitvar_ident('GIT_COMMITTER_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; my $prompting = 0;
if (!defined $from) { if (!defined $from) {
$from = $author || $committer; $from = $author || $committer;
@ -112,6 +147,19 @@ if (!@to) {
$prompting++; $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) { if (!defined $initial_subject && $compose) {
do { do {
$_ = $term->readline("What subject should the emails start with? ", $_ = $term->readline("What subject should the emails start with? ",

4
git.spec.in

@ -74,12 +74,12 @@ Git revision tree visualiser ('gitk')
%setup -q %setup -q


%build %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} prefix=%{_prefix} all %{!?_without_docs: doc}


%install %install
rm -rf $RPM_BUILD_ROOT 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} \ prefix=%{_prefix} mandir=%{_mandir} \
install %{!?_without_docs: install-doc} install %{!?_without_docs: install-doc}



Loading…
Cancel
Save