Code

Merge commit 'jc/maint' into gfi-maint
authorShawn O. Pearce <spearce@spearce.org>
Sun, 29 Apr 2007 00:05:20 +0000 (20:05 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Sun, 29 Apr 2007 00:05:20 +0000 (20:05 -0400)
* commit 'jc/maint': (35 commits)
  Update git-http-fetch documentation
  Update git-local-fetch documentation
  Update git-http-push documentation
  Update -L documentation for git-blame/git-annotate
  Update git-grep documentation
  Update git-fmt-merge documentation
  Document additional options for git-fetch
  Removing -n option from git-diff-files documentation
  Start preparing for 1.5.1.3
  Sanitize @to recipients.
  git-svn: Ignore usernames in URLs in find_by_url
  Document --dry-run and envelope-sender for git-send-email.
  Allow users to optionally specify their envelope sender.
  Ensure clean addresses are always used with Net::SMTP
  Validate @recipients before using it for sendmail and Net::SMTP.
  Perform correct quoting of recipient names.
  Change the scope of the $cc variable as it is not needed outside of send_message.
  Debugging cleanup improvements
  Prefix Dry- to the message status to denote dry-runs.
  Document --dry-run parameter to send-email.
  ...

31 files changed:
Documentation/.gitignore
Documentation/RelNotes-1.5.1.2.txt
Documentation/RelNotes-1.5.1.3.txt [new file with mode: 0644]
Documentation/blame-options.txt
Documentation/fetch-options.txt
Documentation/git-checkout.txt
Documentation/git-diff-files.txt
Documentation/git-fmt-merge-msg.txt
Documentation/git-grep.txt
Documentation/git-http-fetch.txt
Documentation/git-http-push.txt
Documentation/git-local-fetch.txt
Documentation/git-reset.txt
Documentation/git-send-email.txt
GIT-VERSION-GEN
Makefile
RelNotes
builtin-diff-files.c
builtin-write-tree.c
dir.c
git-am.sh
git-applymbox.sh
git-clone.sh
git-compat-util.h
git-quiltimport.sh
git-send-email.perl
git-svn.perl
git.spec.in
perl/Makefile.PL
sha1_file.c
t/t3700-add.sh

index b98d21e98e008c79d2598c6aa9213826d26f5b0d..a37b2152bd26be2c2289e1f57a292534a51a93c7 100644 (file)
@@ -1,7 +1,6 @@
 *.xml
 *.html
-*.1
-*.7
+*.[1-8]
 *.made
 howto-index.txt
 doc.dep
index f58268f6be37d0de6dbc4e34de1dd539a7504e84..d88456306c503d9e604ffbb699fb7cadacb2e733 100644 (file)
@@ -1,4 +1,4 @@
-GIT v1.5.1.2 Release Notes (draft)
+GIT v1.5.1.2 Release Notes
 ==========================
 
 Fixes since v1.5.1.1
@@ -6,6 +6,11 @@ Fixes since v1.5.1.1
 
 * Bugfixes
 
+  - "git clone" over http from a repository that has lost the
+    loose refs by running "git pack-refs" were broken (a code to
+    deal with this was added to "git fetch" in v1.5.0, but it
+    was missing from "git clone").
+
   - "git diff a/ b/" incorrectly fell in "diff between two
     filesystem objects" codepath, when the user most likely
     wanted to limit the extent of output to two tracked
@@ -24,14 +29,22 @@ Fixes since v1.5.1.1
   - git-blame on a very long working tree path had buffer
     overrun problem.
 
+  - git-apply did not like to be fed two patches in a row that created
+    and then modified the same file.
+
+  - git-svn was confused when a non-project was stored directly under
+    trunk/, branches/ and tags/.
+
+  - git-svn wants the Error.pm module that was at least as new
+    as what we ship as part of git; install ours in our private
+    installation location if the one on the system is older.
+
+  - An earlier update to command line integer parameter parser was
+    botched and made 'update-index --cacheinfo' completely useless.
+
+
 * Documentation updates
 
   - Various documentation updates from J. Bruce Fields, Frank
     Lichtenheld, Alex Riesen and others.  Andrew Ruder started a
     war on undocumented options.
-
----
-exec >/var/tmp/1
-O=v1.5.1.1-31-g0220f1e
-echo O=`git describe refs/heads/maint`
-git shortlog --no-merges $O..refs/heads/maint
diff --git a/Documentation/RelNotes-1.5.1.3.txt b/Documentation/RelNotes-1.5.1.3.txt
new file mode 100644 (file)
index 0000000..9a4b069
--- /dev/null
@@ -0,0 +1,38 @@
+GIT v1.5.1.3 Release Notes (draft)
+==========================
+
+Fixes since v1.5.1.2
+--------------------
+
+* Bugfixes
+
+  - git-add tried to optimize by finding common leading
+    directories across its arguments but botched, causing very
+    confused behaviour.
+
+  - unofficial rpm.spec file shipped with git was letting
+    ETC_GITCONFIG set to /usr/etc/gitconfig.  Tweak the official
+    Makefile to make it harder for distro people to make the
+    same mistake, by setting the variable to /etc/gitconfig if
+    prefix is set to /usr.
+
+  - git-svn inconsistently stripped away username from the URL
+    only when svnsync_props was in use.
+
+  - git-send-email was not quoting recipient names that have
+    period '.' in them.  Also it did not allow overriding
+    envelope sender, which made it impossible to send patches to
+    certain subscriber-only lists.
+
+  - built-in write_tree() routine had a sequence that renamed a
+    file that is still open, which some systems did not like.
+
+  - when memory is very tight, sliding mmap code to read
+    packfiles incorrectly closed the fd that was still being
+    used to read the pack.
+
+---
+exec >/var/tmp/1
+O=v1.5.1.2-23-gbf7af11
+echo O=`git describe refs/heads/maint`
+git shortlog --no-merges $O..refs/heads/maint
index 331f161c7769dfe5678bb79d11e72427a21f7bec..a46bf6ce703f4bcf8b5f8066a7d7d2c3f21b4ec2 100644 (file)
@@ -9,8 +9,28 @@
 --show-stats::
        Include additional statistics at the end of blame output.
 
--L n,m::
-       Annotate only the specified line range (lines count from 1).
+-L <start>,<end>::
+       Annotate only the given line range.  <start> and <end> can take
+       one of these forms:
+
+       - number
++
+If <start> or <end> is a number, it specifies an
+absolute line number (lines count from 1).
++
+
+- /regex/
++
+This form will use the first line matching the given
+POSIX regex.  If <end> is a regex, it will search
+starting at the line given by <start>.
++
+
+- +offset or -offset
++
+This is only valid for <end> and will specify a number
+of lines before or after the line given by <start>.
++
 
 -l::
        Show long rev (Default: off).
index 5b4d184a73d013b8da11db3adb08905c0101bf88..bdc7332c7b11c25957ee170b0582f9fe182755eb 100644 (file)
@@ -1,13 +1,20 @@
+-q, \--quiet::
+       Pass --quiet to git-fetch-pack and silence any other internally
+       used programs.
+
+-v, \--verbose::
+       Be verbose.
+
 -a, \--append::
        Append ref names and object names of fetched refs to the
        existing contents of `.git/FETCH_HEAD`.  Without this
        option old data in `.git/FETCH_HEAD` will be overwritten.
 
 \--upload-pack <upload-pack>::
-        When given, and the repository to fetch from is handled
-        by 'git-fetch-pack', '--exec=<upload-pack>' is passed to
-        the command to specify non-default path for the command
-        run on the other end.
+       When given, and the repository to fetch from is handled
+       by 'git-fetch-pack', '--exec=<upload-pack>' is passed to
+       the command to specify non-default path for the command
+       run on the other end.
 
 -f, \--force::
        When `git-fetch` is used with `<rbranch>:<lbranch>`
@@ -16,7 +23,7 @@
        fetches is a descendant of `<lbranch>`.  This option
        overrides that check.
 
-\--no-tags::
+-n, \--no-tags::
        By default, `git-fetch` fetches tags that point at
        objects that are downloaded from the remote repository
        and stores them locally.  This option disables this
index 4f2e847dc3fe44f503a578fc79496179c21ac11a..918d8ee720a573f91ec6efa654da5c2cdc05d7b0 100644 (file)
@@ -8,7 +8,7 @@ git-checkout - Checkout and switch to a branch
 SYNOPSIS
 --------
 [verse]
-'git-checkout' [-q] [-f] [-b [--track | --no-track] <new_branch> [-l]] [-m] [<branch>]
+'git-checkout' [-q] [-f] [[--track | --no-track] -b <new_branch> [-l]] [-m] [<branch>]
 'git-checkout' [<tree-ish>] <paths>...
 
 DESCRIPTION
index b78c4c64f1b2638b8be42072a0f9a4eab1362f7f..2e1e29ef5ae633a005e35f656f30ce66e343de7a 100644 (file)
@@ -8,7 +8,7 @@ git-diff-files - Compares files in the working tree and the index
 
 SYNOPSIS
 --------
-'git-diff-files' [-q] [-0|-1|-2|-3|-c|--cc|-n|--no-index] [<common diff options>] [<path>...]
+'git-diff-files' [-q] [-0|-1|-2|-3|-c|--cc|--no-index] [<common diff options>] [<path>...]
 
 DESCRIPTION
 -----------
@@ -36,7 +36,7 @@ omit diff output for unmerged entries and just show "Unmerged".
        diff, similar to the way 'diff-tree' shows a merge
        commit with these flags.
 
-\-n,\--no-index::
+--no-index::
        Compare the two given files / directories.
 
 -q::
index a70eb3994afd866fd6cee6b2aaed8670ef26e2e5..e560b30c571c793bff428ec32ca510bec7595155 100644 (file)
@@ -8,7 +8,8 @@ git-fmt-merge-msg - Produce a merge commit message
 
 SYNOPSIS
 --------
-'git-fmt-merge-msg' <$GIT_DIR/FETCH_HEAD
+git-fmt-merge-msg [--summary | --no-summary] <$GIT_DIR/FETCH_HEAD
+git-fmt-merge-msg [--summary | --no-summray] -F <file>
 
 DESCRIPTION
 -----------
@@ -19,6 +20,28 @@ passed as the '<merge-message>' argument of `git-merge`.
 This script is intended mostly for internal use by scripts
 automatically invoking `git-merge`.
 
+OPTIONS
+-------
+
+--summary::
+       In addition to branch names, populate the log message with
+       one-line descriptions from the actual commits that are being
+       merged.
+
+--no-summary::
+       Do not list one-line descriptions from the actual commits being
+       merged.
+
+--file <file>, -F <file>::
+       Take the list of merged objects from <file> instead of
+       stdin.
+
+CONFIGURATION
+-------------
+
+merge.summary::
+       Whether to include summaries of merged commits in newly
+       merge commit messages. False by default.
 
 SEE ALSO
 --------
index 0140c8e3580c7be90648f5ea0186a5c925ee1584..c5a5dad1ce27dde6c3846beaf7ab2f7aa8ed81c8 100644 (file)
@@ -12,12 +12,13 @@ SYNOPSIS
 'git-grep' [--cached]
           [-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
           [-v | --invert-match] [-h|-H] [--full-name]
-          [-E | --extended-regexp] [-G | --basic-regexp] [-F | --fixed-strings]
-          [-n] [-l | --files-with-matches] [-L | --files-without-match]
+          [-E | --extended-regexp] [-G | --basic-regexp]
+          [-F | --fixed-strings] [-n]
+          [-l | --files-with-matches] [-L | --files-without-match]
           [-c | --count] [--all-match]
           [-A <post-context>] [-B <pre-context>] [-C <context>]
-          [-f <file>] [-e] <pattern> [--and|--or|--not|(|)|-e <pattern>...]
-          [<tree>...]
+          [-f <file>] [-e] <pattern>
+          [--and|--or|--not|(|)|-e <pattern>...] [<tree>...]
           [--] [<path>...]
 
 DESCRIPTION
@@ -39,6 +40,9 @@ OPTIONS
        Ignore case differences between the patterns and the
        files.
 
+-I::
+       Don't match the pattern in binary files.
+
 -w | --word-regexp::
        Match the pattern only at word boundary (either begin at the
        beginning of a line, or preceded by a non-word character; end at
@@ -64,6 +68,10 @@ OPTIONS
        Use POSIX extended/basic regexp for patterns.  Default
        is to use basic regexp.
 
+-F | --fixed-strings::
+       Use fixed strings for patterns (don't interpret pattern
+       as a regex).
+
 -n::
        Prefix the line number to matching lines.
 
@@ -81,6 +89,9 @@ OPTIONS
        line containing `--` between contiguous groups of
        matches.
 
+-<num>::
+       A shortcut for specifying -C<num>.
+
 -f <file>::
        Read patterns from <file>, one per line.
 
index 7dc2df3044e82e20fbb99ae86f0a150c08cd027d..4deabc376c6698408bee032409434bd7e32740a4 100644 (file)
@@ -39,6 +39,10 @@ commit-id::
 
                <commit-id>['\t'<filename-as-in--w>]
 
+--recover::
+       Verify that everything reachable from target is fetched.  Used after
+       an earlier fetch is interrupted.
+
 Author
 ------
 Written by Linus Torvalds <torvalds@osdl.org>
index 4b4a46169c79b90e22f5bde0b26888761c28c9c4..a15cf5b2a30a6ed2c207622c767d131346936a06 100644 (file)
@@ -8,7 +8,7 @@ git-http-push - Push objects over HTTP/DAV to another repository
 
 SYNOPSIS
 --------
-'git-http-push' [--complete] [--force] [--verbose] <url> <ref> [<ref>...]
+'git-http-push' [--all] [--force] [--verbose] <url> <ref> [<ref>...]
 
 DESCRIPTION
 -----------
@@ -18,7 +18,7 @@ remote branch.
 
 OPTIONS
 -------
---complete::
+--all::
        Do not assume that the remote repository is complete in its
        current state, and verify all objects in the entire local
        ref's history exist in the remote repository.
@@ -34,6 +34,15 @@ OPTIONS
        Report the list of objects being walked locally and the
        list of objects successfully sent to the remote repository.
 
+-d, -D::
+       Remove <ref> from remote repository.  The specified branch
+       cannot be the remote HEAD.  If -d is specified the following
+       other conditions must also be met:
+
+       - Remote HEAD must resolve to an object that exists locally
+       - Specified branch resolves to an object that exists locally
+       - Specified branch is an ancestor of the remote HEAD
+
 <ref>...::
        The remote refs to update.
 
index 22048d82bdbff1f8a9d5f9ba312ad15b719afc03..dd9e2387fcca205b2ec80d7f6207ce84c53a7377 100644 (file)
@@ -24,6 +24,16 @@ OPTIONS
        Get all the objects.
 -v::
        Report what is downloaded.
+-s::
+       Instead of regular file-to-file copying use symbolic links to the objects
+       in the remote repository.
+-l::
+       Before attempting symlinks (if -s is specified) or file-to-file copying the
+       remote objects, try to hardlink the remote objects into the local
+       repository.
+-n::
+       Never attempt to file-to-file copy remote objects.  Only useful with
+       -s or -l command-line options.
 
 -w <filename>::
         Writes the commit-id into the filename under $GIT_DIR/refs/<filename> on
@@ -35,6 +45,10 @@ OPTIONS
 
                <commit-id>['\t'<filename-as-in--w>]
 
+--recover::
+       Verify that everything reachable from target is fetched.  Used after
+       an earlier fetch is interrupted.
+
 Author
 ------
 Written by Junio C Hamano <junkio@cox.net>
index 5b55cda512bbdb507486ac5d0db0d28e32b1dcb1..19c5b9bbda60744723e453dceaa209c47a49cb60 100644 (file)
@@ -67,6 +67,8 @@ message, or both.  Leaves working tree as it was before "reset".
 <3> "reset" copies the old head to .git/ORIG_HEAD; redo the
 commit by starting with its log message.  If you do not need to
 edit the message further, you can give -C option instead.
++
+See also the --amend option to gitlink:git-commit[1].
 
 Undo commits permanently::
 +
index 682313e95dc9b96d3cc14f33554ad82bcede9a56..795db873fcda3b9248e56b3662a95f726b7a20cd 100644 (file)
@@ -85,6 +85,15 @@ The --cc option must be repeated for each user you want on the cc list.
        Do not add the From: address to the cc: list, if it shows up in a From:
        line.
 
+--dry-run::
+       Do everything except actually send the emails.
+
+--envelope-sender::
+       Specify the envelope sender used to send the emails.
+       This is useful if your default address is not the address that is
+       subscribed to a list. If you use the sendmail binary, you must have
+       suitable privileges for the -f parameter.
+
 --to::
        Specify the primary recipient of the emails generated.
        Generally, this will be the upstream maintainer of the
index 2325660ff42bf7f6e1c998723fd72f150c347c7d..41ee8b4ea2af9e25f7ac2ad56c083108080de49e 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.5.1.1.GIT
+DEF_VER=v1.5.1.2.GIT
 
 LF='
 '
index dcdaa02e473710810993ea8d08de444ec4332620..b61c5d4cd25395207096c0bc415847e43379eef1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -133,7 +133,12 @@ prefix = $(HOME)
 bindir = $(prefix)/bin
 gitexecdir = $(bindir)
 template_dir = $(prefix)/share/git-core/templates/
-ETC_GITCONFIG = $(prefix)/etc/gitconfig
+ifeq ($(prefix),/usr)
+sysconfdir = /etc
+else
+sysconfdir = $(prefix)/etc
+endif
+ETC_GITCONFIG = $(sysconfdir)/gitconfig
 # DESTDIR=
 
 # default configuration for gitweb
@@ -152,7 +157,7 @@ GITWEB_FAVICON = git-favicon.png
 GITWEB_SITE_HEADER =
 GITWEB_SITE_FOOTER =
 
-export prefix bindir gitexecdir template_dir
+export prefix bindir gitexecdir template_dir sysconfdir
 
 CC = gcc
 AR = ar
index 09f5a7413c933a5778796a7b6b04499ac2c1a9f1..b630faa0c0f46c5650668a014e2734b0bfe0f8a5 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes-1.5.1.2.txt
\ No newline at end of file
+Documentation/RelNotes-1.5.1.3.txt
\ No newline at end of file
index 6ba5077a2be6619f110280622cf46a7f4cfb8b01..6cb30c8e12488f42521df71a844a86a2e9a968c7 100644 (file)
@@ -10,7 +10,7 @@
 #include "builtin.h"
 
 static const char diff_files_usage[] =
-"git-diff-files [-q] [-0/-1/2/3 |-c|--cc|-n|--no-index] [<common diff options>] [<path>...]"
+"git-diff-files [-q] [-0/-1/2/3 |-c|--cc|--no-index] [<common diff options>] [<path>...]"
 COMMON_DIFF_OPTIONS_HELP;
 
 int cmd_diff_files(int argc, const char **argv, const char *prefix)
index 90fc1cfcf40d057cd654edd1454f56cd823efd66..a1894814f7356e5689416560aa6cda868583ce2b 100644 (file)
@@ -36,8 +36,10 @@ int write_tree(unsigned char *sha1, int missing_ok, const char *prefix)
                        die("git-write-tree: error building trees");
                if (0 <= newfd) {
                        if (!write_cache(newfd, active_cache, active_nr)
-                                       && !close(newfd))
+                                       && !close(newfd)) {
                                commit_lock_file(lock_file);
+                               newfd = -1;
+                       }
                }
                /* Not being able to write is fine -- we are only interested
                 * in updating the cache-tree part, and if the next caller
@@ -55,6 +57,8 @@ int write_tree(unsigned char *sha1, int missing_ok, const char *prefix)
        else
                hashcpy(sha1, active_cache_tree->sha1);
 
+       if (0 <= newfd)
+               close(newfd);
        rollback_lock_file(lock_file);
 
        return 0;
diff --git a/dir.c b/dir.c
index b48e19dc09fff7d7fb1d5b48673fe4448b69a7c3..602282bd1b198a7a0cef0707c738b4eda0d3ccef 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -24,8 +24,9 @@ int common_prefix(const char **pathspec)
        prefix = slash - path + 1;
        while ((next = *++pathspec) != NULL) {
                int len = strlen(next);
-               if (len >= prefix && !memcmp(path, next, len))
+               if (len >= prefix && !memcmp(path, next, prefix))
                        continue;
+               len = prefix - 1;
                for (;;) {
                        if (!len)
                                return 0;
index e69ecbfdb1a817b477aff8618f284a4c921e00e5..c9f66e278454374714794477be7ff8b93cd05a0f 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -291,7 +291,7 @@ do
                        <"$dotest/$msgnum" >"$dotest/info" ||
                        stop_here $this
                test -s $dotest/patch || {
-                       echo "Patch is empty.  Was is split wrong?"
+                       echo "Patch is empty.  Was it split wrong?"
                        stop_here $this
                }
                git-stripspace < "$dotest/msg" > "$dotest/msg-clean"
index 3efd6a746407bdc38ba9d251332427c508e5ee40..c18e80ff8cd5a66a64e22cf96e77fad519d33b5d 100755 (executable)
@@ -78,7 +78,7 @@ do
            git-mailinfo $keep_subject $utf8 \
                .dotest/msg .dotest/patch <$i >.dotest/info || exit 1
            test -s .dotest/patch || {
-               echo "Patch is empty.  Was is split wrong?"
+               echo "Patch is empty.  Was it split wrong?"
                exit 1
            }
            git-stripspace < .dotest/msg > .dotest/msg-clean
index 513b574d13858f1a81e6f66251890d81bf0e55ce..cad5c0c088fa997c6f8f36c44e8888a5cb19515e 100755 (executable)
@@ -60,7 +60,7 @@ Perhaps git-update-server-info needs to be run there?"
                else
                        tname=$name
                fi
-               git-http-fetch $v -a -w "$tname" "$name" "$1" || exit 1
+               git-http-fetch $v -a -w "$tname" "$sha1" "$1" || exit 1
        done <"$clone_tmp/refs"
        rm -fr "$clone_tmp"
        http_fetch "$1/HEAD" "$GIT_DIR/REMOTE_HEAD" ||
index 5f6a281b78245bbb4e1e480d81cfb8c1b4cfa6ac..e3cf3703bbb896067f4c2d5b5e1f3ce898d8b6fc 100644 (file)
@@ -156,13 +156,13 @@ extern size_t gitstrlcpy(char *, const char *, size_t);
 extern uintmax_t gitstrtoumax(const char *, char **, int);
 #endif
 
-extern void release_pack_memory(size_t);
+extern void release_pack_memory(size_t, int);
 
 static inline char* xstrdup(const char *str)
 {
        char *ret = strdup(str);
        if (!ret) {
-               release_pack_memory(strlen(str) + 1);
+               release_pack_memory(strlen(str) + 1, -1);
                ret = strdup(str);
                if (!ret)
                        die("Out of memory, strdup failed");
@@ -176,7 +176,7 @@ static inline void *xmalloc(size_t size)
        if (!ret && !size)
                ret = malloc(1);
        if (!ret) {
-               release_pack_memory(size);
+               release_pack_memory(size, -1);
                ret = malloc(size);
                if (!ret && !size)
                        ret = malloc(1);
@@ -195,7 +195,7 @@ static inline void *xrealloc(void *ptr, size_t size)
        if (!ret && !size)
                ret = realloc(ptr, 1);
        if (!ret) {
-               release_pack_memory(size);
+               release_pack_memory(size, -1);
                ret = realloc(ptr, size);
                if (!ret && !size)
                        ret = realloc(ptr, 1);
@@ -211,7 +211,7 @@ static inline void *xcalloc(size_t nmemb, size_t size)
        if (!ret && (!nmemb || !size))
                ret = calloc(1, 1);
        if (!ret) {
-               release_pack_memory(nmemb * size);
+               release_pack_memory(nmemb * size, -1);
                ret = calloc(nmemb, size);
                if (!ret && (!nmemb || !size))
                        ret = calloc(1, 1);
@@ -228,7 +228,7 @@ static inline void *xmmap(void *start, size_t length,
        if (ret == MAP_FAILED) {
                if (!length)
                        return NULL;
-               release_pack_memory(length);
+               release_pack_memory(length, fd);
                ret = mmap(start, length, prot, flags, fd, offset);
                if (ret == MAP_FAILED)
                        die("Out of memory? mmap failed: %s", strerror(errno));
index 018cc75bd032fd337b559c14b85f51f0418447ff..a7a6757dd8a3e0ff2635537a83591169c259986f 100755 (executable)
@@ -74,7 +74,7 @@ for patch_name in $(cat "$QUILT_PATCHES/series" | grep -v '^#'); do
        echo $patch_name
        (cat $QUILT_PATCHES/$patch_name | git-mailinfo "$tmp_msg" "$tmp_patch" > "$tmp_info") || exit 3
        test -s .dotest/patch || {
-               echo "Patch is empty.  Was is split wrong?"
+               echo "Patch is empty.  Was it split wrong?"
                exit 1
        }
 
index 1278fcba462f632a3687742f74cc15c0498874e2..12ced288857c7531f964d2e08e9a7c3cc1136dbd 100755 (executable)
@@ -77,6 +77,10 @@ Options:
    --quiet       Make git-send-email less verbose.  One line per email
                   should be all that is output.
 
+   --dry-run     Do everything except actually send the emails.
+
+   --envelope-sender   Specify the envelope sender used to send the emails.
+
 EOT
        exit(1);
 }
@@ -137,6 +141,7 @@ my (@to,@cc,@initial_cc,@bcclist,@xh,
 my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
        $dry_run) = (1, 0, 0, 0, 0);
 my $smtp_server;
+my $envelope_sender;
 
 # Example reply to:
 #$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
@@ -175,6 +180,7 @@ my $rc = GetOptions("from=s" => \$from,
                    "suppress-from" => \$suppress_from,
                    "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
                    "dry-run" => \$dry_run,
+                   "envelope-sender=s" => \$envelope_sender,
         );
 
 unless ($rc) {
@@ -268,6 +274,7 @@ sub expand_aliases {
 }
 
 @to = expand_aliases(@to);
+@to = (map { sanitize_address_rfc822($_) } @to);
 @initial_cc = expand_aliases(@initial_cc);
 @bcclist = expand_aliases(@bcclist);
 
@@ -377,7 +384,7 @@ if (@files) {
 }
 
 # Variables we set as part of the loop over files
-our ($message_id, $cc, %mail, $subject, $reply_to, $references, $message);
+our ($message_id, %mail, $subject, $reply_to, $references, $message);
 
 sub extract_valid_address {
        my $address = shift;
@@ -418,7 +425,6 @@ sub make_message_id
 
 
 
-$cc = "";
 $time = time - scalar $#files;
 
 sub unquote_rfc2047 {
@@ -430,22 +436,33 @@ sub unquote_rfc2047 {
        return "$_";
 }
 
+# If an address contains a . in the name portion, the name must be quoted.
+sub sanitize_address_rfc822
+{
+       my ($recipient) = @_;
+       my ($recipient_name) = ($recipient =~ /^(.*?)\s+</);
+       if ($recipient_name && $recipient_name =~ /\./ && $recipient_name !~ /^".*"$/) {
+               my ($name, $addr) = ($recipient =~ /^(.*?)(\s+<.*)/);
+               $recipient = "\"$name\"$addr";
+       }
+       return $recipient;
+}
+
 sub send_message
 {
        my @recipients = unique_email_list(@to);
+       @cc = (map { sanitize_address_rfc822($_) } @cc);
        my $to = join (",\n\t", @recipients);
        @recipients = unique_email_list(@recipients,@cc,@bcclist);
+       @recipients = (map { extract_valid_address($_) } @recipients);
        my $date = format_2822_time($time++);
        my $gitversion = '@@GIT_VERSION@@';
        if ($gitversion =~ m/..GIT_VERSION../) {
            $gitversion = Git::version();
        }
 
-       my ($author_name) = ($from =~ /^(.*?)\s+</);
-       if ($author_name && $author_name =~ /\./ && $author_name !~ /^".*"$/) {
-               my ($name, $addr) = ($from =~ /^(.*?)(\s+<.*)/);
-               $from = "\"$name\"$addr";
-       }
+       my $cc = join(", ", unique_email_list(@cc));
+       $from = sanitize_address_rfc822($from);
        my $header = "From: $from
 To: $to
 Cc: $cc
@@ -463,22 +480,27 @@ X-Mailer: git-send-email $gitversion
                $header .= join("\n", @xh) . "\n";
        }
 
+       my @sendmail_parameters = ('-i', @recipients);
+       my $raw_from = $from;
+       $raw_from = $envelope_sender if (defined $envelope_sender);
+       $raw_from = extract_valid_address($raw_from);
+       unshift (@sendmail_parameters,
+                       '-f', $raw_from) if(defined $envelope_sender);
+
        if ($dry_run) {
                # We don't want to send the email.
        } elsif ($smtp_server =~ m#^/#) {
                my $pid = open my $sm, '|-';
                defined $pid or die $!;
                if (!$pid) {
-                       exec($smtp_server,'-i',
-                            map { extract_valid_address($_) }
-                            @recipients) or die $!;
+                       exec($smtp_server, @sendmail_parameters) or die $!;
                }
                print $sm "$header\n$message";
                close $sm or die $?;
        } else {
                require Net::SMTP;
                $smtp ||= Net::SMTP->new( $smtp_server );
-               $smtp->mail( $from ) or die $smtp->message;
+               $smtp->mail( $raw_from ) or die $smtp->message;
                $smtp->to( @recipients ) or die $smtp->message;
                $smtp->data or die $smtp->message;
                $smtp->datasend("$header\n$message") or die $smtp->message;
@@ -486,13 +508,15 @@ X-Mailer: git-send-email $gitversion
                $smtp->ok or die "Failed to send $subject\n".$smtp->message;
        }
        if ($quiet) {
-               printf "Sent %s\n", $subject;
+               printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject);
        } else {
-               print "OK. Log says:\nDate: $date\n";
-               if ($smtp) {
+               print (($dry_run ? "Dry-" : "")."OK. Log says:\nDate: $date\n");
+               if ($smtp_server !~ m#^/#) {
                        print "Server: $smtp_server\n";
+                       print "MAIL FROM:<$raw_from>\n";
+                       print "RCPT TO:".join(',',(map { "<$_>" } @recipients))."\n";
                } else {
-                       print "Sendmail: $smtp_server\n";
+                       print "Sendmail: $smtp_server ".join(' ',@sendmail_parameters)."\n";
                }
                print "From: $from\nSubject: $subject\nCc: $cc\nTo: $to\n\n";
                if ($smtp) {
@@ -587,7 +611,6 @@ foreach my $t (@files) {
                $message = "From: $author_not_sender\n\n$message";
        }
 
-       $cc = join(", ", unique_email_list(@cc));
 
        send_message();
 
index efc4c88a4ea158bd630a6f53a8346e344b360ed6..7b5f8ab3be6639e682dc6b0d5a53412f1078ba54 100755 (executable)
@@ -771,19 +771,19 @@ sub cmt_metadata {
 sub working_head_info {
        my ($head, $refs) = @_;
        my ($fh, $ctx) = command_output_pipe('rev-list', $head);
-       while (<$fh>) {
-               chomp;
-               my ($url, $rev, $uuid) = cmt_metadata($_);
+       while (my $hash = <$fh>) {
+               chomp($hash);
+               my ($url, $rev, $uuid) = cmt_metadata($hash);
                if (defined $url && defined $rev) {
                        if (my $gs = Git::SVN->find_by_url($url)) {
                                my $c = $gs->rev_db_get($rev);
-                               if ($c && $c eq $_) {
+                               if ($c && $c eq $hash) {
                                        close $fh; # break the pipe
                                        return ($url, $rev, $uuid, $gs);
                                }
                        }
                }
-               unshift @$refs, $_ if $refs;
+               unshift @$refs, $hash if $refs;
        }
        command_close_pipe($fh, $ctx);
        (undef, undef, undef, undef);
@@ -1064,7 +1064,10 @@ sub init_remote_config {
 
 sub find_by_url { # repos_root and, path are optional
        my ($class, $full_url, $repos_root, $path) = @_;
+
        return undef unless defined $full_url;
+       remove_username($full_url);
+       remove_username($repos_root) if defined $repos_root;
        my $remotes = read_all_remotes();
        if (defined $full_url && defined $repos_root && !defined $path) {
                $path = $full_url;
@@ -1072,6 +1075,7 @@ sub find_by_url { # repos_root and, path are optional
        }
        foreach my $repo_id (keys %$remotes) {
                my $u = $remotes->{$repo_id}->{url} or next;
+               remove_username($u);
                next if defined $repos_root && $repos_root ne $u;
 
                my $fetch = $remotes->{$repo_id}->{fetch} || {};
@@ -1866,11 +1870,14 @@ sub make_log_entry {
        } elsif ($self->use_svnsync_props) {
                my $full_url = $self->svnsync->{url};
                $full_url .= "/$self->{path}" if length $self->{path};
+               remove_username($full_url);
                my $uuid = $self->svnsync->{uuid};
                $log_entry{metadata} = "$full_url\@$rev $uuid";
                $email ||= "$author\@$uuid"
        } else {
-               $log_entry{metadata} = $self->metadata_url. "\@$rev " .
+               my $url = $self->metadata_url;
+               remove_username($url);
+               $log_entry{metadata} = "$url\@$rev " .
                                       $self->ra->get_uuid;
                $email ||= "$author\@" . $self->ra->get_uuid;
        }
index 46aee88fd15d934dd84783981f2be3ed086c9cf3..87197d10e19107883716e3ced5b4eb38c3d933be 100644 (file)
@@ -86,12 +86,14 @@ Perl interface to Git
 
 %build
 make %{_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" WITH_OWN_SUBPROCESS_PY=YesPlease \
+     ETC_GITCONFIG=/etc/gitconfig \
      prefix=%{_prefix} all %{!?_without_docs: doc}
 
 %install
 rm -rf $RPM_BUILD_ROOT
 make %{_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" DESTDIR=$RPM_BUILD_ROOT \
      WITH_OWN_SUBPROCESS_PY=YesPlease \
+     ETC_GITCONFIG=/etc/gitconfig \
      prefix=%{_prefix} mandir=%{_mandir} INSTALLDIRS=vendor \
      install %{!?_without_docs: install-doc}
 find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} ';'
index 9b117fd0d736615a8c4aeda742384956373d295a..437516142cb6c14f197dc5821635a6ff8bc91adf 100644 (file)
@@ -13,7 +13,7 @@ my %pm = ('Git.pm' => '$(INST_LIBDIR)/Git.pm');
 # We come with our own bundled Error.pm. It's not in the set of default
 # Perl modules so install it if it's not available on the system yet.
 eval { require Error };
-if ($@) {
+if ($@ || $Error::VERSION < 0.15009) {
        $pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';
 }
 
index 9c260384201857eb32d07c87e1178fd3947968ee..523417027a1785d4ab5b729d03ba794efc1bb4d4 100644 (file)
@@ -516,7 +516,7 @@ static void scan_windows(struct packed_git *p,
        }
 }
 
-static int unuse_one_window(struct packed_git *current)
+static int unuse_one_window(struct packed_git *current, int keep_fd)
 {
        struct packed_git *p, *lru_p = NULL;
        struct pack_window *lru_w = NULL, *lru_l = NULL;
@@ -532,7 +532,7 @@ static int unuse_one_window(struct packed_git *current)
                        lru_l->next = lru_w->next;
                else {
                        lru_p->windows = lru_w->next;
-                       if (!lru_p->windows && lru_p != current) {
+                       if (!lru_p->windows && lru_p->pack_fd != keep_fd) {
                                close(lru_p->pack_fd);
                                lru_p->pack_fd = -1;
                        }
@@ -544,10 +544,10 @@ static int unuse_one_window(struct packed_git *current)
        return 0;
 }
 
-void release_pack_memory(size_t need)
+void release_pack_memory(size_t need, int fd)
 {
        size_t cur = pack_mapped;
-       while (need >= (cur - pack_mapped) && unuse_one_window(NULL))
+       while (need >= (cur - pack_mapped) && unuse_one_window(NULL, fd))
                ; /* nothing */
 }
 
@@ -680,7 +680,7 @@ unsigned char* use_pack(struct packed_git *p,
                        win->len = (size_t)len;
                        pack_mapped += win->len;
                        while (packed_git_limit < pack_mapped
-                               && unuse_one_window(p))
+                               && unuse_one_window(p, p->pack_fd))
                                ; /* nothing */
                        win->base = xmmap(NULL, win->len,
                                PROT_READ, MAP_PRIVATE,
index 08e035220cfd5c2da0798eba84c779981f185b4a..ad8cc7d4ae88e2066d2f51b6a6a5a192780d5e9a 100755 (executable)
@@ -104,4 +104,10 @@ test_expect_success 'add ignored ones with -f' '
        git-ls-files --error-unmatch d.ig/d.if d.ig/d.ig
 '
 
+mkdir 1 1/2 1/3
+touch 1/2/a 1/3/b 1/2/c
+test_expect_success 'check correct prefix detection' '
+       git add 1/2/a 1/3/b 1/2/c
+'
+
 test_done