Browse Source

Merge branch 'master' into next

* master:
  send-email: do not pass bogus address to local sendmail binary
  Add a basic test case for git send-email, and fix some real bugs discovered.
  Fix a bug in email extraction used in git-send-email.
  Add support for --bcc to git-send-email.
  git-send-email: Add References: headers to emails, in addition to In-Reply-To:
  git-clean fails on files beginning with a dash
  git-svn: remove assertion that broke with older versions of svn
  git-svn: t0001: workaround a heredoc bug in old versions of dash
  Documentation: fix a tutorial-2 typo
  Documentation: retitle the git-core tutorial
  documentation: add brief mention of cat-file to tutorial part I
  documentation: mention gitk font adjustment in tutorial
  Fix some documentation typoes
maint
Junio C Hamano 19 years ago
parent
commit
62b693a070
  1. 4
      Documentation/core-tutorial.txt
  2. 6
      Documentation/everyday.txt
  3. 2
      Documentation/tutorial-2.txt
  4. 12
      Documentation/tutorial.txt
  5. 1
      contrib/git-svn/git-svn.perl
  6. 3
      contrib/git-svn/t/t0001-contrib-git-svn-props.sh
  7. 4
      git-clean.sh
  8. 34
      git-send-email.perl
  9. 41
      t/t9001-send-email.sh

4
Documentation/core-tutorial.txt

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
A short git tutorial
====================
A git core tutorial for developers
==================================

Introduction
------------

6
Documentation/everyday.txt

@ -66,7 +66,7 @@ $ git prune <4> @@ -66,7 +66,7 @@ $ git prune <4>
<1> running without "--full" is usually cheap and assures the
repository health reasonably well.
<2> check how many loose objects there are and how much
diskspace is wasted by not repacking.
disk space is wasted by not repacking.
<3> without "-a" repacks incrementally. repacking every 4-5MB
of loose objects accumulation may be a good rule of thumb.
<4> after repack, prune removes the duplicate loose objects.
@ -86,7 +86,7 @@ Individual Developer (Standalone)[[Individual Developer (Standalone)]] @@ -86,7 +86,7 @@ Individual Developer (Standalone)[[Individual Developer (Standalone)]]
----------------------------------------------------------------------

A standalone individual developer does not exchange patches with
other poeple, and works alone in a single repository, using the
other people, and works alone in a single repository, using the
following commands.

* gitlink:git-show-branch[1] to see where you are.
@ -370,7 +370,7 @@ Examples @@ -370,7 +370,7 @@ Examples
Run git-daemon to serve /pub/scm from inetd.::
+
------------
$ grep git /etc/inet.conf
$ grep git /etc/inetd.conf
git stream tcp nowait nobody \
/usr/bin/git-daemon git-daemon --inetd --syslog --export-all /pub/scm
------------

2
Documentation/tutorial-2.txt

@ -377,7 +377,7 @@ At this point you should know everything necessary to read the man @@ -377,7 +377,7 @@ At this point you should know everything necessary to read the man
pages for any of the git commands; one good place to start would be
with the commands mentioned in link:everyday.html[Everyday git]. You
should be able to find any unknown jargon in the
link:glossary.html[Glosssay].
link:glossary.html[Glossary].

The link:cvs-migration.html[CVS migration] document explains how to
import a CVS repository into git, and shows how to use git in a

12
Documentation/tutorial.txt

@ -429,16 +429,24 @@ $ gitk --since="2 weeks ago" drivers/ @@ -429,16 +429,24 @@ $ gitk --since="2 weeks ago" drivers/
-------------------------------------

allows you to browse any commits from the last 2 weeks of commits
that modified files under the "drivers" directory.
that modified files under the "drivers" directory. (Note: you can
adjust gitk's fonts by holding down the control key while pressing
"-" or "+".)

Finally, most commands that take filenames will optionally allow you
to precede any filename by a commit, to specify a particular version
fo the file:
of the file:

-------------------------------------
$ git diff v2.5:Makefile HEAD:Makefile.in
-------------------------------------

You can also use "git cat-file -p" to see any such file:

-------------------------------------
$ git cat-file -p v2.5:Makefile
-------------------------------------

Next Steps
----------


1
contrib/git-svn/git-svn.perl

@ -567,7 +567,6 @@ sub precommit_check { @@ -567,7 +567,6 @@ sub precommit_check {
sub svn_checkout_tree {
my ($svn_rev, $treeish) = @_;
my $from = file_to_s("$REV_DIR/$svn_rev");
assert_svn_wc_clean($svn_rev);
assert_tree($from);
print "diff-tree $from $treeish\n";
my $pid = open my $diff_fh, '-|';

3
contrib/git-svn/t/t0001-contrib-git-svn-props.sh

@ -20,9 +20,10 @@ a_empty_cr= @@ -20,9 +20,10 @@ a_empty_cr=
a_empty_crlf=

cd import
cat >> kw.c <<''
cat >> kw.c <<\EOF
/* Make it look like somebody copied a file from CVS into SVN: */
/* $Id: kw.c,v 1.1.1.1 1994/03/06 00:00:00 eric Exp $ */
EOF

printf "Hello\r\nWorld\r\n" > crlf
a_crlf=`git-hash-object -w crlf`

4
git-clean.sh

@ -19,8 +19,8 @@ ignored= @@ -19,8 +19,8 @@ ignored=
ignoredonly=
cleandir=
quiet=
rmf="rm -f"
rmrf="rm -rf"
rmf="rm -f --"
rmrf="rm -rf --"
rm_refuse="echo Not removing"
echo1="echo"


34
git-send-email.perl

@ -37,7 +37,8 @@ sub cleanup_compose_files(); @@ -37,7 +37,8 @@ sub cleanup_compose_files();
my $compose_filename = ".msg.$$";

# Variables we fill in automatically, or via prompting:
my (@to,@cc,@initial_cc,$initial_reply_to,$initial_subject,@files,$from,$compose,$time);
my (@to,@cc,@initial_cc,@bcclist,
$initial_reply_to,$initial_subject,@files,$from,$compose,$time);

# Behavior modification variables
my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc) = (1, 0, 0, 0);
@ -56,6 +57,7 @@ my $rc = GetOptions("from=s" => \$from, @@ -56,6 +57,7 @@ my $rc = GetOptions("from=s" => \$from,
"subject=s" => \$initial_subject,
"to=s" => \@to,
"cc=s" => \@initial_cc,
"bcc=s" => \@bcclist,
"chain-reply-to!" => \$chain_reply_to,
"smtp-server=s" => \$smtp_server,
"compose" => \$compose,
@ -160,6 +162,7 @@ sub expand_aliases { @@ -160,6 +162,7 @@ sub expand_aliases {

@to = expand_aliases(@to);
@initial_cc = expand_aliases(@initial_cc);
@bcclist = expand_aliases(@bcclist);

if (!defined $initial_subject && $compose) {
do {
@ -269,6 +272,9 @@ Options: @@ -269,6 +272,9 @@ Options:
--cc Specify an initial "Cc:" list for the entire series
of emails.

--bcc Specify a list of email addresses that should be Bcc:
on all the emails.

--compose Use \$EDITOR to edit an introductory message for the
patch series.

@ -303,7 +309,7 @@ EOT @@ -303,7 +309,7 @@ EOT
}

# Variables we set as part of the loop over files
our ($message_id, $cc, %mail, $subject, $reply_to, $message);
our ($message_id, $cc, %mail, $subject, $reply_to, $references, $message);

sub extract_valid_address {
my $address = shift;
@ -316,7 +322,11 @@ sub extract_valid_address { @@ -316,7 +322,11 @@ sub extract_valid_address {
} else {
# less robust/correct than the monster regexp in Email::Valid,
# but still does a 99% job, and one less dependency
return ($address =~ /([^\"<>\s]+@[^<>\s]+)/);
my $cleaned_address;
if ($address =~ /([^\"<>\s]+@[^<>\s]+)/) {
$cleaned_address = $1;
}
return $cleaned_address;
}
}

@ -348,7 +358,7 @@ sub send_message @@ -348,7 +358,7 @@ sub send_message
{
my @recipients = unique_email_list(@to);
my $to = join (",\n\t", @recipients);
@recipients = unique_email_list(@recipients,@cc);
@recipients = unique_email_list(@recipients,@cc,@bcclist);
my $date = strftime('%a, %d %b %Y %H:%M:%S %z', localtime($time++));
my $gitversion = '@@GIT_VERSION@@';
if ($gitversion =~ m/..GIT_VERSION../) {
@ -367,13 +377,19 @@ Date: $date @@ -367,13 +377,19 @@ Date: $date
Message-Id: $message_id
X-Mailer: git-send-email $gitversion
";
$header .= "In-Reply-To: $reply_to\n" if $reply_to;
if ($reply_to) {

$header .= "In-Reply-To: $reply_to\n";
$header .= "References: $references\n";
}

if ($smtp_server =~ m#^/#) {
my $pid = open my $sm, '|-';
defined $pid or die $!;
if (!$pid) {
exec($smtp_server,'-i',@recipients) or die $!;
exec($smtp_server,'-i',
map { scalar extract_valid_address($_) }
@recipients) or die $!;
}
print $sm "$header\n$message";
close $sm or die $?;
@ -406,6 +422,7 @@ X-Mailer: git-send-email $gitversion @@ -406,6 +422,7 @@ X-Mailer: git-send-email $gitversion
}

$reply_to = $initial_reply_to;
$references = $initial_reply_to || '';
make_message_id();
$subject = $initial_subject;

@ -482,6 +499,11 @@ foreach my $t (@files) { @@ -482,6 +499,11 @@ foreach my $t (@files) {
# set up for the next message
if ($chain_reply_to || length($reply_to) == 0) {
$reply_to = $message_id;
if (length $references > 0) {
$references .= " $message_id";
} else {
$references = "$message_id";
}
}
make_message_id();
}

41
t/t9001-send-email.sh

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
#!/bin/sh

test_description='git-send-email'
. ./test-lib.sh

PROG='git send-email'
test_expect_success \
'prepare reference tree' \
'echo "1A quick brown fox jumps over the" >file &&
echo "lazy dog" >>file &&
git add file
GIT_AUTHOR_NAME="A" git commit -a -m "Initial."'

test_expect_success \
'Setup helper tool' \
'(echo "#!/bin/sh"
echo shift
echo for a
echo do
echo " echo \"!\$a!\""
echo "done >commandline"
echo "cat > msgtxt"
) >fake.sendmail
chmod +x ./fake.sendmail
git add fake.sendmail
GIT_AUTHOR_NAME="A" git commit -a -m "Second."'

test_expect_success \
'Extract patches and send' \
'git format-patch -n HEAD^1
git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt'

cat >expected <<\EOF
!nobody@example.com!
!author@example.com!
EOF
test_expect_success \
'Verify commandline' \
'diff commandline expected'

test_done
Loading…
Cancel
Save