Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
  git svn: Doc update for multiple branch and tag paths
  git svn: cleanup t9138-multiple-branches
  git-svn: Canonicalize svn urls to prevent libsvn assertion
  t9138: remove stray dot in test which broke bash
  git-svn: convert globs to regexps for branch destinations
  git svn: Support multiple branch and tag paths in the svn repository.
  Add 'git svn reset' to unwind 'git svn fetch'
  git-svn: speed up find_rev_before
  Add 'git svn help [cmd]' which works outside a repo.
  git-svn: let 'dcommit $rev' work on $rev instead of HEAD
diff --git a/builtin-remote.c b/builtin-remote.c
index 658d578..2fb76d3 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -1276,15 +1276,14 @@
 static int get_one_entry(struct remote *remote, void *priv)
 {
 	struct string_list *list = priv;
+	struct strbuf url_buf = STRBUF_INIT;
 	const char **url;
 	int i, url_nr;
-	void **utilp;
 
 	if (remote->url_nr > 0) {
-		utilp = &(string_list_append(remote->name, list)->util);
-		*utilp = xmalloc(strlen(remote->url[0])+strlen(" (fetch)")+1);
-		strcpy((char *) *utilp, remote->url[0]);
-		strcat((char *) *utilp, " (fetch)");
+		strbuf_addf(&url_buf, "%s (fetch)", remote->url[0]);
+		string_list_append(remote->name, list)->util =
+				strbuf_detach(&url_buf, NULL);
 	} else
 		string_list_append(remote->name, list)->util = NULL;
 	if (remote->pushurl_nr) {
@@ -1296,10 +1295,9 @@
 	}
 	for (i = 0; i < url_nr; i++)
 	{
-		utilp = &(string_list_append(remote->name, list)->util);
-		*utilp = xmalloc(strlen(url[i])+strlen(" (push)")+1);
-		strcpy((char *) *utilp, url[i]);
-		strcat((char *) *utilp, " (push)");
+		strbuf_addf(&url_buf, "%s (push)", url[i]);
+		string_list_append(remote->name, list)->util =
+				strbuf_detach(&url_buf, NULL);
 	}
 
 	return 0;
diff --git a/gitweb/README b/gitweb/README
index ccda890..9056d1e 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -377,7 +377,7 @@
 
 	DocumentRoot /var/www/gitweb
 
-	AliasMatch ^(/.*?)(\.git)(/.*)? /pub/git$1$3
+	AliasMatch ^(/.*?)(\.git)(/.*)?$ /pub/git$1$3
 	<Directory /var/www/gitweb>
 		Options ExecCGI
 		AddHandler cgi-script cgi
@@ -402,6 +402,14 @@
 
 will provide human-friendly gitweb access.
 
+This solution is not 100% bulletproof, in the sense that if some project
+has a named ref (branch, tag) starting with 'git/', then paths such as
+
+http://git.example.com/project/command/abranch..git/abranch
+
+will fail with a 404 error.
+
+
 
 Originally written by:
   Kay Sievers <kay.sievers@vrfy.org>
diff --git a/strbuf.c b/strbuf.c
index a884960..f03d117 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -260,7 +260,7 @@
 	res = fread(sb->buf + sb->len, 1, size, f);
 	if (res > 0)
 		strbuf_setlen(sb, sb->len + res);
-	else if (res < 0 && oldalloc == 0)
+	else if (oldalloc == 0)
 		strbuf_release(sb);
 	return res;
 }
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index abb41b0..5f84b18 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -94,6 +94,10 @@
     'git archive --output=b4.tar HEAD &&
     test_cmp b.tar b4.tar'
 
+test_expect_success 'git archive --remote' \
+    'git archive --remote=. HEAD >b5.tar &&
+    test_cmp b.tar b5.tar'
+
 test_expect_success \
     'validate file modification time' \
     'mkdir extract &&
diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh
index f275af8..7868af8 100755
--- a/t/t7002-grep.sh
+++ b/t/t7002-grep.sh
@@ -125,6 +125,36 @@
 
 done
 
+cat >expected <<EOF
+file:foo mmap bar_mmap
+EOF
+
+test_expect_success 'grep -e A --and -e B' '
+	git grep -e "foo mmap" --and -e bar_mmap >actual &&
+	test_cmp expected actual
+'
+
+cat >expected <<EOF
+file:foo_mmap bar mmap
+file:foo_mmap bar mmap baz
+EOF
+
+
+test_expect_success 'grep ( -e A --or -e B ) --and -e B' '
+	git grep \( -e foo_ --or -e baz \) \
+		--and -e " mmap" >actual &&
+	test_cmp expected actual
+'
+
+cat >expected <<EOF
+file:foo mmap bar
+EOF
+
+test_expect_success 'grep -e A --and --not -e B' '
+	git grep -e "foo mmap" --and --not -e bar_mmap >actual &&
+	test_cmp expected actual
+'
+
 test_expect_success 'log grep setup' '
 	echo a >>file &&
 	test_tick &&
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index fb7d9f3..fb606a9 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -152,7 +152,10 @@
 	clean_fake_sendmail &&
 	cp $patches cccmd.patch &&
 	echo cccmd--cccmd@example.com >>cccmd.patch &&
-	echo sed -n s/^cccmd--//p \"\$1\" > cccmd-sed &&
+	{
+	  echo "#!$SHELL_PATH"
+	  echo sed -n -e s/^cccmd--//p \"\$1\"
+	} > cccmd-sed &&
 	chmod +x cccmd-sed &&
 	git send-email \
 		--from="Example <nobody@example.com>" \