From ec4e69c06af3ecc38b9660b924e460689653487f Mon Sep 17 00:00:00 2001 From: Sean Date: Sat, 13 May 2006 23:09:32 -0400 Subject: Ensure author & committer before asking for commit message. It's better to find out you need to fix your author and committer information before you enter a long commit message. Signed-off-by: Sean Estabrooks Signed-off-by: Junio C Hamano --- git-commit.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git-commit.sh b/git-commit.sh index 26cd7ca54d..6ef1a9dedc 100755 --- a/git-commit.sh +++ b/git-commit.sh @@ -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 -- cgit v1.2.3 From cc908b82a4a09df555fbc4c32cfbe8b8cffae865 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 14 May 2006 22:07:28 -0700 Subject: diffstat rename squashing fix. When renaming leading/a/filename to leading/b/filename (and "filename" is sufficiently long), we tried to squash the rename to "leading/{a => b}/filename". However, when "/a" or "/b" part is empty, we underflowed and tried to print a substring of length -1. Signed-off-by: Junio C Hamano --- diff.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/diff.c b/diff.c index 7a7b839e56..5285c03667 100644 --- a/diff.c +++ b/diff.c @@ -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 { -- cgit v1.2.3 From 994d6c66d360198c16eb483e4f33d412358f30a1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 14 May 2006 19:13:44 -0700 Subject: send-email: address expansion for common mailers mutt, gnus, pine, mailrc formats should be supported. Testing and feedback for correctness and completeness of all formats and support for additional formats would be good. Nested expansions are also supported. More than one alias file to be used. All alias file formats must still of be the same type, though. Two git repo-config keys are required for this (as suggested by Ryan Anderson): sendemail.aliasesfile = sendemail.aliasfiletype = (mutt|gnus|pine|mailrc) Signed-off-by: Eric Wong Acked-by: Ryan Anderson Signed-off-by: Junio C Hamano --- git-send-email.perl | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/git-send-email.perl b/git-send-email.perl index 703dd1ff9e..d8c4b1f892 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -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? ", -- cgit v1.2.3 From 15739c89fbf508c453da854ec50f313505bbe78f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 14 May 2006 19:26:56 -0700 Subject: Install git-send-email by default After 567ffeb7722eefab3991cb894c96548b92b57cc2 and 4bc87a28be020a6bf7387161c65ea3d8e4a0228b, git-send-email no longer requires any non-standard Perl modules, so there's no reason to special-case it. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- Makefile | 7 ++----- git.spec.in | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 37fbe789d3..93918a0377 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -319,10 +320,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. diff --git a/git.spec.in b/git.spec.in index 96dfc1de55..8ccd2564e7 100644 --- a/git.spec.in +++ b/git.spec.in @@ -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} -- cgit v1.2.3 From 49e3343c9fe0e134e0a8c1ec0ddeb64ae18ee9fd Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 14 May 2006 21:59:04 -0700 Subject: apply --numstat: show new name, not old name. Somehow --stat showed the new name but --numstat showed the old name for renamed/copied paths. Signed-off-by: Junio C Hamano --- apply.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apply.c b/apply.c index 7c8146a7f3..2151c96c2a 100644 --- a/apply.c +++ b/apply.c @@ -1778,7 +1778,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); -- cgit v1.2.3