From 7872b1889550ce8c1cd452fb18445bd6ea6e8fed Mon Sep 17 00:00:00 2001 From: Horst von Brand Date: Mon, 29 May 2006 17:11:28 -0400 Subject: [PATCH 01/13] Fix some documentation typoes Fix some typoes in Documentation/everyday.txt Signed-off-by: Horst H. von Brand Signed-off-by: Junio C Hamano --- Documentation/everyday.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/everyday.txt b/Documentation/everyday.txt index 4b56370937..2ad2d61300 100644 --- a/Documentation/everyday.txt +++ b/Documentation/everyday.txt @@ -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)]] ---------------------------------------------------------------------- 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 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 ------------ From 2be1bc48ffe04d97ca61e2b7988e6870cd37766b Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Mon, 29 May 2006 19:31:32 -0400 Subject: [PATCH 02/13] documentation: mention gitk font adjustment in tutorial Kind of silly, but the font I get by default in gitk makes it mostly unusable for me, so this is the first thing I'd want to know about. (But maybe there's a better suggestion than just Ctrl-='ing until satisfied.) Signed-off-by: J. Bruce Fields Signed-off-by: Junio C Hamano --- Documentation/tutorial.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt index 79781adf4f..5fdeab9833 100644 --- a/Documentation/tutorial.txt +++ b/Documentation/tutorial.txt @@ -429,7 +429,9 @@ $ 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 From 38573864f893653be012dd77c2da77f9ecbb1e02 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Mon, 29 May 2006 19:31:33 -0400 Subject: [PATCH 03/13] documentation: add brief mention of cat-file to tutorial part I I'd rather avoid git cat-file so early on, but the git-cat-file -p old-commit:/path/to/file trick is too useful.... Also fix a nearby typo while we're at it. Signed-off-by: J. Bruce Fields Signed-off-by: Junio C Hamano --- Documentation/tutorial.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt index 5fdeab9833..039a8598e3 100644 --- a/Documentation/tutorial.txt +++ b/Documentation/tutorial.txt @@ -435,12 +435,18 @@ adjust gitk's fonts by holding down the control key while pressing 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 ---------- From 62109cd3a8b5fd0a4ea3b7267e633ca713f33fa6 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Mon, 29 May 2006 19:31:34 -0400 Subject: [PATCH 04/13] Documentation: retitle the git-core tutorial Give the git-core tutorial a name that better reflects its intended audience. Signed-off-by: J. Bruce Fields Signed-off-by: Junio C Hamano --- Documentation/core-tutorial.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/core-tutorial.txt b/Documentation/core-tutorial.txt index d1360ecde2..5a831adf43 100644 --- a/Documentation/core-tutorial.txt +++ b/Documentation/core-tutorial.txt @@ -1,5 +1,5 @@ -A short git tutorial -==================== +A git core tutorial for developers +================================== Introduction ------------ From a746f688f130ea56a6a01dcfd8c51ac42ef1b633 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Mon, 29 May 2006 19:31:36 -0400 Subject: [PATCH 05/13] Documentation: fix a tutorial-2 typo Fix a typo. Signed-off-by: J. Bruce Fields Signed-off-by: Junio C Hamano --- Documentation/tutorial-2.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/tutorial-2.txt b/Documentation/tutorial-2.txt index 08d3453e5c..9c9500c1f1 100644 --- a/Documentation/tutorial-2.txt +++ b/Documentation/tutorial-2.txt @@ -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 From 3c4c7351c030a18fa94076ffe62f534f890e9602 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 29 May 2006 19:03:45 -0700 Subject: [PATCH 06/13] git-svn: t0001: workaround a heredoc bug in old versions of dash The dash installed on my Debian Sarge boxes don't seem to like <<'' as a heredoc starter. Recent versions of dash do not need this fix. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- contrib/git-svn/t/t0001-contrib-git-svn-props.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/git-svn/t/t0001-contrib-git-svn-props.sh b/contrib/git-svn/t/t0001-contrib-git-svn-props.sh index 6fa7889e9a..23a5a2a223 100644 --- a/contrib/git-svn/t/t0001-contrib-git-svn-props.sh +++ b/contrib/git-svn/t/t0001-contrib-git-svn-props.sh @@ -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` From 037b048eceafa129903d6327d3565c543f5895bb Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 29 May 2006 19:03:46 -0700 Subject: [PATCH 07/13] git-svn: remove assertion that broke with older versions of svn svn < 1.3.x would display changes to keywords lines as modified if they aren't expanded in the working copy. We already check for changes against the git tree here, so checking against the svn one is probably excessive. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- contrib/git-svn/git-svn.perl | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl index b3e0684c44..aac877974d 100755 --- a/contrib/git-svn/git-svn.perl +++ b/contrib/git-svn/git-svn.perl @@ -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, '-|'; From 7484529d7f17d5bff1faefb007d604aba12a0e1b Mon Sep 17 00:00:00 2001 From: Dennis Stosberg Date: Mon, 29 May 2006 17:06:32 +0200 Subject: [PATCH 08/13] git-clean fails on files beginning with a dash Reproducible with: $ git init-db $ echo "some text" >-file $ git clean Removing -file rm: invalid option -- l Try `rm --help' for more information. Signed-off-by: Dennis Stosberg Signed-off-by: Junio C Hamano --- git-clean.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-clean.sh b/git-clean.sh index bb56264e04..3834323bcf 100755 --- a/git-clean.sh +++ b/git-clean.sh @@ -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" From 7ccf79274c03971b8884223b1950077582a7bf8a Mon Sep 17 00:00:00 2001 From: Ryan Anderson Date: Mon, 29 May 2006 12:30:12 -0700 Subject: [PATCH 09/13] git-send-email: Add References: headers to emails, in addition to In-Reply-To: Signed-off-by: Ryan Anderson Signed-off-by: Junio C Hamano --- git-send-email.perl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 312a4ea2aa..ad8944dffc 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -303,7 +303,7 @@ sub expand_aliases { } # 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; @@ -367,7 +367,11 @@ sub send_message 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, '|-'; @@ -482,6 +486,11 @@ sub send_message # 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(); } From 580632458902b440cba41f0a5a1d27192221e1b9 Mon Sep 17 00:00:00 2001 From: Ryan Anderson Date: Mon, 29 May 2006 12:30:13 -0700 Subject: [PATCH 10/13] Add support for --bcc to git-send-email. Signed-off-by: Ryan Anderson Signed-off-by: Junio C Hamano --- git-send-email.perl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index ad8944dffc..85ec5df13a 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -37,7 +37,8 @@ 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 @@ "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 { @to = expand_aliases(@to); @initial_cc = expand_aliases(@initial_cc); +@bcclist = expand_aliases(@bcclist); if (!defined $initial_subject && $compose) { do { @@ -269,6 +272,9 @@ sub expand_aliases { --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. @@ -348,7 +354,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../) { From 8baf06a03aa2a4554079a2f722af1751f1654ce8 Mon Sep 17 00:00:00 2001 From: Ryan Anderson Date: Mon, 29 May 2006 12:30:14 -0700 Subject: [PATCH 11/13] Fix a bug in email extraction used in git-send-email. (Also, kill off an accidentally created warning.) Signed-off-by: Ryan Anderson Signed-off-by: Junio C Hamano --- git-send-email.perl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git-send-email.perl b/git-send-email.perl index 85ec5df13a..d418d6c5d2 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -322,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; } } @@ -416,6 +420,7 @@ sub send_message } $reply_to = $initial_reply_to; +$references = $initial_reply_to; make_message_id(); $subject = $initial_subject; From ce903018f1ed0283fdaa3de1ec3ad29fccf25c96 Mon Sep 17 00:00:00 2001 From: Ryan Anderson Date: Mon, 29 May 2006 12:30:15 -0700 Subject: [PATCH 12/13] Add a basic test case for git send-email, and fix some real bugs discovered. Signed-off-by: Ryan Anderson Signed-off-by: Junio C Hamano --- t/t9001-send-email.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 t/t9001-send-email.sh diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh new file mode 100755 index 0000000000..276cbac3ba --- /dev/null +++ b/t/t9001-send-email.sh @@ -0,0 +1,34 @@ +#!/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" > fake.sendmail + echo "shift" >> fake.sendmail + echo "echo \"\$*\" > commandline" >> fake.sendmail + 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 " --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt' + +test_expect_success \ + 'Verify commandline' \ + 'cline=$(cat commandline) + [ "$cline" == "nobody@example.com author@example.com" ]' + +test_done From 2186d566a6c2dfb2f168ae608bbb2e0e77122d7e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 29 May 2006 23:53:13 -0700 Subject: [PATCH 13/13] send-email: do not pass bogus address to local sendmail binary This makes t9001 test happy. Also fixes the warning on uninitialized $references variable again. Signed-off-by: Junio C Hamano --- git-send-email.perl | 6 ++++-- t/t9001-send-email.sh | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index d418d6c5d2..0e368fff0c 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -387,7 +387,9 @@ sub send_message 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 $?; @@ -420,7 +422,7 @@ sub send_message } $reply_to = $initial_reply_to; -$references = $initial_reply_to; +$references = $initial_reply_to || ''; make_message_id(); $subject = $initial_subject; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 276cbac3ba..a61da1efbd 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -13,10 +13,14 @@ test_expect_success \ test_expect_success \ 'Setup helper tool' \ - 'echo "#!/bin/sh" > fake.sendmail - echo "shift" >> fake.sendmail - echo "echo \"\$*\" > commandline" >> fake.sendmail - echo "cat > msgtxt" >> fake.sendmail + '(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."' @@ -26,9 +30,12 @@ test_expect_success \ 'git format-patch -n HEAD^1 git send-email -from="Example " --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' \ - 'cline=$(cat commandline) - [ "$cline" == "nobody@example.com author@example.com" ]' + 'diff commandline expected' test_done