Imported Upstream version 2.3.2 upstream/2.3.2
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 3 Mar 2021 06:14:52 +0000 (15:14 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 3 Mar 2021 06:14:52 +0000 (15:14 +0900)
50 files changed:
Documentation/CodingGuidelines
Documentation/RelNotes/2.3.2.txt [new file with mode: 0644]
Documentation/config.txt
Documentation/git-am.txt
Documentation/git-remote.txt
Documentation/git.txt
GIT-VERSION-GEN
Makefile
RelNotes
builtin/blame.c
builtin/fetch.c
builtin/for-each-ref.c
builtin/merge-file.c
cache.h
config.c
connect.c
contrib/credential/wincred/git-credential-wincred.c
ewah/ewok.h
fast-import.c
git-compat-util.h
git-rebase--interactive.sh
git-remote-testgit.sh
git-send-email.perl
git-submodule.sh
hex.c
pager.c
perl/Git.pm
perl/Git/SVN.pm
perl/Git/SVN/Fetcher.pm
perl/Git/SVN/Ra.pm
pretty.c
read-cache.c
sha1_file.c
sha1_name.c
t/lib-gpg.sh
t/lib-gpg/keyring.gpg
t/lib-httpd.sh
t/t0061-run-command.sh
t/t1307-config-blob.sh
t/t1509-root-worktree.sh
t/t3404-rebase-interactive.sh
t/t5304-prune.sh
t/t5801-remote-helpers.sh
t/t6023-merge-file.sh
t/t7400-submodule-basic.sh
t/t9001-send-email.sh
t/test-lib.sh
trailer.c
transport-helper.c
userdiff.c

index 894546d..0f8cccf 100644 (file)
@@ -413,6 +413,29 @@ Error Messages
  - Say what the error is first ("cannot open %s", not "%s: cannot open")
 
 
+Externally Visible Names
+
+ - For configuration variable names, follow the existing convention:
+
+   . The section name indicates the affected subsystem.
+
+   . The subsection name, if any, indicates which of an unbounded set
+     of things to set the value for.
+
+   . The variable name describes the effect of tweaking this knob.
+
+   The section and variable names that consist of multiple words are
+   formed by concatenating the words without punctuations (e.g. `-`),
+   and are broken using bumpyCaps in documentation as a hint to the
+   reader.
+
+   When choosing the variable namespace, do not use variable name for
+   specifying possibly unbounded set of things, most notably anything
+   an end user can freely come up with (e.g. branch names).  Instead,
+   use subsection names or variable values, like the existing variable
+   branch.<name>.description does.
+
+
 Writing Documentation:
 
  Most (if not all) of the documentation pages are written in the
diff --git a/Documentation/RelNotes/2.3.2.txt b/Documentation/RelNotes/2.3.2.txt
new file mode 100644 (file)
index 0000000..f4caf54
--- /dev/null
@@ -0,0 +1,79 @@
+Git v2.3.2 Release Notes
+========================
+
+Fixes since v2.3.1
+------------------
+
+ * "update-index --refresh" used to leak when an entry cannot be
+   refreshed for whatever reason.
+
+ * "git fast-import" used to crash when it could not close and
+   conclude the resulting packfile cleanly.
+
+ * "git blame" died, trying to free an uninitialized piece of memory.
+
+ * "git merge-file" did not work correctly in a subdirectory.
+
+ * "git submodule add" failed to squash "path/to/././submodule" to
+   "path/to/submodule".
+
+ * In v2.2.0, we broke "git prune" that runs in a repository that
+   borrows from an alternate object store.
+
+ * Certain older vintages of cURL give irregular output from
+   "curl-config --vernum", which confused our build system.
+
+ * An earlier workaround to squelch unhelpful deprecation warnings
+   from the complier on Mac OSX unnecessarily set minimum required
+   version of the OS, which the user might want to raise (or lower)
+   for other reasons.
+
+ * Longstanding configuration variable naming rules has been added to
+   the documentation.
+
+ * The credential helper for Windows (in contrib/) used to mishandle
+   a user name with an at-sign in it.
+
+ * Older GnuPG implementations may not correctly import the keyring
+   material we prepare for the tests to use.
+
+ * Clarify in the documentation that "remote.<nick>.pushURL" and
+   "remote.<nick>.URL" are there to name the same repository accessed
+   via different transports, not two separate repositories.
+
+ * The pack bitmap support did not build with older versions of GCC.
+
+ * Reading configuration from a blob object, when it ends with a lone
+   CR, use to confuse the configuration parser.
+
+ * We didn't format an integer that wouldn't fit in "int" but in
+   "uintmax_t" correctly.
+
+ * "git push --signed" gave an incorrectly worded error message when
+   the other side did not support the capability.
+
+ * "git fetch" over a remote-helper that cannot respond to "list"
+   command could not fetch from a symbolic reference e.g. HEAD.
+
+ * The insn sheet "git rebase -i" creates did not fully honor
+   core.abbrev settings.
+
+ * The tests that wanted to see that file becomes unreadable after
+   running "chmod a-r file", and the tests that wanted to make sure it
+   is not run as root, we used "can we write into the / directory?" as
+   a cheap substitute, but on some platforms that is not a good
+   heuristics.  The tests and their prerequisites have been updated to
+   check what they really require.
+
+ * The configuration variable 'mailinfo.scissors' was hard to
+   discover in the documentation.
+
+ * Correct a breakage to git-svn around v2.2 era that triggers
+   premature closing of FileHandle.
+
+ * Even though we officially haven't dropped Perl 5.8 support, the
+   Getopt::Long package that came with it does not support "--no-"
+   prefix to negate a boolean option; manually add support to help
+   people with older Getopt::Long package.
+
+Also contains typofixes, documentation updates and trivial code clean-ups.
index 04e2a71..9307c98 100644 (file)
@@ -683,14 +683,13 @@ core.abbrev::
        for abbreviated object names to stay unique for sufficiently long
        time.
 
-add.ignore-errors::
 add.ignoreErrors::
+add.ignore-errors (deprecated)::
        Tells 'git add' to continue adding files when some files cannot be
        added due to indexing errors. Equivalent to the '--ignore-errors'
-       option of linkgit:git-add[1].  Older versions of Git accept only
-       `add.ignore-errors`, which does not follow the usual naming
-       convention for configuration variables.  Newer versions of Git
-       honor `add.ignoreErrors` as well.
+       option of linkgit:git-add[1].  `add.ignore-errors` is deprecated,
+       as it does not follow the usual naming convention for configuration
+       variables.
 
 alias.*::
        Command aliases for the linkgit:git[1] command wrapper - e.g.
@@ -1740,6 +1739,13 @@ log.mailmap::
        If true, makes linkgit:git-log[1], linkgit:git-show[1], and
        linkgit:git-whatchanged[1] assume `--use-mailmap`.
 
+mailinfo.scissors::
+       If true, makes linkgit:git-mailinfo[1] (and therefore
+       linkgit:git-am[1]) act by default as if the --scissors option
+       was provided on the command-line. When active, this features
+       removes everything from the message body before a scissors
+       line (i.e. consisting mainly of ">8", "8<" and "-").
+
 mailmap.file::
        The location of an augmenting mailmap file. The default
        mailmap, located in the root of the repository, is loaded
@@ -1960,7 +1966,7 @@ pack.useBitmaps::
        true. You should not generally need to turn this off unless
        you are debugging pack bitmaps.
 
-pack.writebitmaps::
+pack.writebitmaps (deprecated)::
        This is a deprecated synonym for `repack.writeBitmaps`.
 
 pack.writeBitmapHashCache::
@@ -2297,7 +2303,7 @@ sendemail.smtpencryption::
        See linkgit:git-send-email[1] for description.  Note that this
        setting is not subject to the 'identity' mechanism.
 
-sendemail.smtpssl::
+sendemail.smtpssl (deprecated)::
        Deprecated alias for 'sendemail.smtpencryption = ssl'.
 
 sendemail.smtpsslcertpath::
@@ -2337,7 +2343,7 @@ sendemail.validate::
 sendemail.xmailer::
        See linkgit:git-send-email[1] for description.
 
-sendemail.signedoffcc::
+sendemail.signedoffcc (deprecated)::
        Deprecated alias for 'sendemail.signedoffbycc'.
 
 showbranch.default::
index f4eea28..0d8ba48 100644 (file)
@@ -52,7 +52,8 @@ OPTIONS
 -c::
 --scissors::
        Remove everything in body before a scissors line (see
-       linkgit:git-mailinfo[1]).
+       linkgit:git-mailinfo[1]). Can be activated by default using
+       the `mailinfo.scissors` configuration variable.
 
 --no-scissors::
        Ignore scissors lines (see linkgit:git-mailinfo[1]).
index cb103c8..a77607b 100644 (file)
@@ -130,17 +130,25 @@ branches, adds to that list.
 
 'set-url'::
 
-Changes URL remote points to. Sets first URL remote points to matching
+Changes URLs for the remote. Sets first URL for remote <name> that matches
 regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If
-<oldurl> doesn't match any URL, error occurs and nothing is changed.
+<oldurl> doesn't match any URL, an error occurs and nothing is changed.
 +
 With '--push', push URLs are manipulated instead of fetch URLs.
 +
-With '--add', instead of changing some URL, new URL is added.
+With '--add', instead of changing existing URLs, new URL is added.
 +
-With '--delete', instead of changing some URL, all URLs matching
-regex <url> are deleted. Trying to delete all non-push URLs is an
-error.
+With '--delete', instead of changing existing URLs, all URLs matching
+regex <url> are deleted for remote <name>.  Trying to delete all
+non-push URLs is an error.
++
+Note that the push URL and the fetch URL, even though they can
+be set differently, must still refer to the same place.  What you
+pushed to the push URL should be what you would see if you
+immediately fetched from the fetch URL.  If you are trying to
+fetch from one place (e.g. your upstream) and push to another (e.g.
+your publishing repository), use two separate remotes.
+
 
 'show'::
 
index b37f1ab..52c4d2a 100644 (file)
@@ -43,9 +43,10 @@ unreleased) version of Git, that is available from the 'master'
 branch of the `git.git` repository.
 Documentation for older releases are available here:
 
-* link:v2.3.1/git.html[documentation for release 2.3.1]
+* link:v2.3.2/git.html[documentation for release 2.3.2]
 
 * release notes for
+  link:RelNotes/2.3.2.txt[2.3.2],
   link:RelNotes/2.3.1.txt[2.3.1],
   link:RelNotes/2.3.0.txt[2.3].
 
index 0407788..5007865 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.3.1
+DEF_VER=v2.3.2
 
 LF='
 '
index c44eb3a..20058f1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1035,13 +1035,13 @@ else
        REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
        PROGRAM_OBJS += http-fetch.o
        PROGRAMS += $(REMOTE_CURL_NAMES)
-       curl_check := $(shell (echo 070908; curl-config --vernum) 2>/dev/null | sort -r | sed -ne 2p)
+       curl_check := $(shell (echo 070908; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
        ifeq "$(curl_check)" "070908"
                ifndef NO_EXPAT
                        PROGRAM_OBJS += http-push.o
                endif
        endif
-       curl_check := $(shell (echo 072200; curl-config --vernum) 2>/dev/null | sort -r | sed -ne 2p)
+       curl_check := $(shell (echo 072200; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
        ifeq "$(curl_check)" "072200"
                USE_CURL_FOR_IMAP_SEND = YesPlease
        endif
index f57e70d..689db12 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/2.3.1.txt
\ No newline at end of file
+Documentation/RelNotes/2.3.2.txt
\ No newline at end of file
index 0374fe8..2b1f9dd 100644 (file)
@@ -2085,7 +2085,6 @@ static void find_alignment(struct scoreboard *sb, int *option)
 
        for (e = sb->ent; e; e = e->next) {
                struct origin *suspect = e->suspect;
-               struct commit_info ci;
                int num;
 
                if (compute_auto_abbrev)
@@ -2096,6 +2095,7 @@ static void find_alignment(struct scoreboard *sb, int *option)
                if (longest_file < num)
                        longest_file = num;
                if (!(suspect->commit->object.flags & METAINFO_SHOWN)) {
+                       struct commit_info ci;
                        suspect->commit->object.flags |= METAINFO_SHOWN;
                        get_commit_info(suspect->commit, &ci, 1);
                        if (*option & OUTPUT_SHOW_EMAIL)
@@ -2104,6 +2104,7 @@ static void find_alignment(struct scoreboard *sb, int *option)
                                num = utf8_strwidth(ci.author.buf);
                        if (longest_author < num)
                                longest_author = num;
+                       commit_info_destroy(&ci);
                }
                num = e->s_lno + e->num_lines;
                if (longest_src_lines < num)
@@ -2113,8 +2114,6 @@ static void find_alignment(struct scoreboard *sb, int *option)
                        longest_dst_lines = num;
                if (largest_score < ent_score(sb, e))
                        largest_score = ent_score(sb, e);
-
-               commit_info_destroy(&ci);
        }
        max_orig_digits = decimal_width(longest_src_lines);
        max_digits = decimal_width(longest_dst_lines);
index 7b84d35..75a55e5 100644 (file)
@@ -11,7 +11,6 @@
 #include "run-command.h"
 #include "parse-options.h"
 #include "sigchain.h"
-#include "transport.h"
 #include "submodule.h"
 #include "connected.h"
 #include "argv-array.h"
index a0123f6..008513c 100644 (file)
@@ -178,11 +178,10 @@ static const char *find_next(const char *cp)
 static int verify_format(const char *format)
 {
        const char *cp, *sp;
-       static const char color_reset[] = "color:reset";
 
        need_color_reset_at_eol = 0;
        for (cp = format; *cp && (sp = find_next(cp)); ) {
-               const char *ep = strchr(sp, ')');
+               const char *color, *ep = strchr(sp, ')');
                int at;
 
                if (!ep)
@@ -191,8 +190,8 @@ static int verify_format(const char *format)
                at = parse_atom(sp + 2, ep);
                cp = ep + 1;
 
-               if (starts_with(used_atom[at], "color:"))
-                       need_color_reset_at_eol = !!strcmp(used_atom[at], color_reset);
+               if (skip_prefix(used_atom[at], "color:", &color))
+                       need_color_reset_at_eol = !!strcmp(color, "reset");
        }
        return 0;
 }
index 844f84f..232b768 100644 (file)
@@ -90,7 +90,8 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
 
        if (ret >= 0) {
                const char *filename = argv[0];
-               FILE *f = to_stdout ? stdout : fopen(filename, "wb");
+               const char *fpath = prefix_filename(prefix, prefixlen, argv[0]);
+               FILE *f = to_stdout ? stdout : fopen(fpath, "wb");
 
                if (!f)
                        ret = error("Could not open %s for writing", filename);
diff --git a/cache.h b/cache.h
index f704af5..4d02efc 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1254,6 +1254,10 @@ extern int unpack_object_header(struct packed_git *, struct pack_window **, off_
  *
  * Any callback that is NULL will be ignored. Callbacks returning non-zero
  * will end the iteration.
+ *
+ * In the "buf" variant, "path" is a strbuf which will also be used as a
+ * scratch buffer, but restored to its original contents before
+ * the function returns.
  */
 typedef int each_loose_object_fn(const unsigned char *sha1,
                                 const char *path,
@@ -1269,6 +1273,11 @@ int for_each_loose_file_in_objdir(const char *path,
                                  each_loose_cruft_fn cruft_cb,
                                  each_loose_subdir_fn subdir_cb,
                                  void *data);
+int for_each_loose_file_in_objdir_buf(struct strbuf *path,
+                                     each_loose_object_fn obj_cb,
+                                     each_loose_cruft_fn cruft_cb,
+                                     each_loose_subdir_fn subdir_cb,
+                                     void *data);
 
 /*
  * Iterate over loose and packed objects in both the local
@@ -1498,7 +1507,7 @@ extern const char *pager_program;
 extern int pager_in_use(void);
 extern int pager_use_color;
 extern int term_columns(void);
-extern int decimal_width(int);
+extern int decimal_width(uintmax_t);
 extern int check_pager_config(const char *cmd);
 
 extern const char *editor_program;
index e5e64dc..66c0a51 100644 (file)
--- a/config.c
+++ b/config.c
@@ -73,8 +73,12 @@ static int config_buf_fgetc(struct config_source *conf)
 
 static int config_buf_ungetc(int c, struct config_source *conf)
 {
-       if (conf->u.buf.pos > 0)
-               return conf->u.buf.buf[--conf->u.buf.pos];
+       if (conf->u.buf.pos > 0) {
+               conf->u.buf.pos--;
+               if (conf->u.buf.buf[conf->u.buf.pos] != c)
+                       die("BUG: config_buf can only ungetc the same character");
+               return c;
+       }
 
        return EOF;
 }
@@ -235,7 +239,8 @@ static int get_next_char(void)
                /* DOS like systems */
                c = cf->do_fgetc(cf);
                if (c != '\n') {
-                       cf->do_ungetc(c, cf);
+                       if (c != EOF)
+                               cf->do_ungetc(c, cf);
                        c = '\r';
                }
        }
index 062e133..2a5c400 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -157,8 +157,7 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
                        server_capabilities = xstrdup(name + name_len + 1);
                }
 
-               if (extra_have &&
-                   name_len == 5 && !memcmp(".have", name, 5)) {
+               if (extra_have && !strcmp(name, ".have")) {
                        sha1_array_append(extra_have, old_sha1);
                        continue;
                }
index a1d38f0..0061340 100644 (file)
@@ -111,14 +111,23 @@ static void write_item(const char *what, LPCWSTR wbuf, int wlen)
  * Match an (optional) expected string and a delimiter in the target string,
  * consuming the matched text by updating the target pointer.
  */
-static int match_part(LPCWSTR *ptarget, LPCWSTR want, LPCWSTR delim)
+
+static LPCWSTR wcsstr_last(LPCWSTR str, LPCWSTR find)
+{
+       LPCWSTR res = NULL, pos;
+       for (pos = wcsstr(str, find); pos; pos = wcsstr(pos + 1, find))
+               res = pos;
+       return res;
+}
+
+static int match_part_with_last(LPCWSTR *ptarget, LPCWSTR want, LPCWSTR delim, int last)
 {
        LPCWSTR delim_pos, start = *ptarget;
        int len;
 
        /* find start of delimiter (or end-of-string if delim is empty) */
        if (*delim)
-               delim_pos = wcsstr(start, delim);
+               delim_pos = last ? wcsstr_last(start, delim) : wcsstr(start, delim);
        else
                delim_pos = start + wcslen(start);
 
@@ -138,6 +147,16 @@ static int match_part(LPCWSTR *ptarget, LPCWSTR want, LPCWSTR delim)
        return !want || (!wcsncmp(want, start, len) && !want[len]);
 }
 
+static int match_part(LPCWSTR *ptarget, LPCWSTR want, LPCWSTR delim)
+{
+       return match_part_with_last(ptarget, want, delim, 0);
+}
+
+static int match_part_last(LPCWSTR *ptarget, LPCWSTR want, LPCWSTR delim)
+{
+       return match_part_with_last(ptarget, want, delim, 1);
+}
+
 static int match_cred(const CREDENTIALW *cred)
 {
        LPCWSTR target = cred->TargetName;
@@ -146,7 +165,7 @@ static int match_cred(const CREDENTIALW *cred)
 
        return match_part(&target, L"git", L":") &&
                match_part(&target, protocol, L"://") &&
-               match_part(&target, wusername, L"@") &&
+               match_part_last(&target, wusername, L"@") &&
                match_part(&target, host, L"/") &&
                match_part(&target, path, L"");
 }
index f6ad190..13c6e20 100644 (file)
@@ -47,7 +47,8 @@ static inline uint32_t ewah_bit_popcount64(uint64_t x)
        return (x * 0x0101010101010101ULL) >> 56;
 }
 
-#ifdef __GNUC__
+/* __builtin_ctzll was not available until 3.4.0 */
+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3  && __GNUC_MINOR > 3))
 #define ewah_bit_ctz64(x) __builtin_ctzll(x)
 #else
 static inline int ewah_bit_ctz64(uint64_t x)
index d0bd285..aac2c24 100644 (file)
@@ -947,9 +947,12 @@ static void unkeep_all_packs(void)
 
 static void end_packfile(void)
 {
-       if (!pack_data)
+       static int running;
+
+       if (running || !pack_data)
                return;
 
+       running = 1;
        clear_delta_base_cache();
        if (object_count) {
                struct packed_git *new_p;
@@ -999,6 +1002,7 @@ static void end_packfile(void)
        }
        free(pack_data);
        pack_data = NULL;
+       running = 0;
 
        /* We can't carry a delta across packfiles. */
        strbuf_release(&last_blob.data);
index 553fc01..8b72e2a 100644 (file)
 typedef long intptr_t;
 typedef unsigned long uintptr_t;
 #endif
-#if defined(__CYGWIN__)
-#undef _XOPEN_SOURCE
-#include <grp.h>
-#define _XOPEN_SOURCE 600
-#else
 #undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */
 #include <grp.h>
 #define _ALL_SOURCE 1
 #endif
-#endif
 
 /* used on Mac OS X */
 #ifdef PRECOMPOSE_UNICODE
@@ -212,12 +206,15 @@ extern char *gitbasename(char *);
 #endif
 
 #ifndef NO_OPENSSL
+#ifdef __APPLE__
 #define __AVAILABILITY_MACROS_USES_AVAILABILITY 0
-#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6
+#include <AvailabilityMacros.h>
+#undef DEPRECATED_ATTRIBUTE
+#define DEPRECATED_ATTRIBUTE
+#undef __AVAILABILITY_MACROS_USES_AVAILABILITY
+#endif
 #include <openssl/ssl.h>
 #include <openssl/err.h>
-#undef MAC_OS_X_VERSION_MIN_REQUIRED
-#undef __AVAILABILITY_MACROS_USES_AVAILABILITY
 #ifdef NO_HMAC_CTX_CLEANUP
 #define HMAC_CTX_cleanup HMAC_cleanup
 #endif
index c6a4629..c96b984 100644 (file)
@@ -961,14 +961,13 @@ else
        revisions=$onto...$orig_head
        shortrevisions=$shorthead
 fi
-git rev-list $merges_option --pretty=oneline --abbrev-commit \
-       --abbrev=7 --reverse --left-right --topo-order \
+git rev-list $merges_option --pretty=oneline --reverse --left-right --topo-order \
        $revisions ${restrict_revision+^$restrict_revision} | \
        sed -n "s/^>//p" |
-while read -r shortsha1 rest
+while read -r sha1 rest
 do
 
-       if test -z "$keep_empty" && is_empty_commit $shortsha1 && ! is_merge_commit $shortsha1
+       if test -z "$keep_empty" && is_empty_commit $sha1 && ! is_merge_commit $sha1
        then
                comment_out="$comment_char "
        else
@@ -977,9 +976,8 @@ do
 
        if test t != "$preserve_merges"
        then
-               printf '%s\n' "${comment_out}pick $shortsha1 $rest" >>"$todo"
+               printf '%s\n' "${comment_out}pick $sha1 $rest" >>"$todo"
        else
-               sha1=$(git rev-parse $shortsha1)
                if test -z "$rebase_root"
                then
                        preserve=t
@@ -996,7 +994,7 @@ do
                if test f = "$preserve"
                then
                        touch "$rewritten"/$sha1
-                       printf '%s\n' "${comment_out}pick $shortsha1 $rest" >>"$todo"
+                       printf '%s\n' "${comment_out}pick $sha1 $rest" >>"$todo"
                fi
        fi
 done
@@ -1020,8 +1018,8 @@ then
                        # just the history of its first-parent for others that will
                        # be rebasing on top of it
                        git rev-list --parents -1 $rev | cut -d' ' -s -f2 > "$dropped"/$rev
-                       short=$(git rev-list -1 --abbrev-commit --abbrev=7 $rev)
-                       sane_grep -v "^[a-z][a-z]* $short" <"$todo" > "${todo}2" ; mv "${todo}2" "$todo"
+                       sha1=$(git rev-list -1 $rev)
+                       sane_grep -v "^[a-z][a-z]* $sha1" <"$todo" > "${todo}2" ; mv "${todo}2" "$todo"
                        rm "$rewritten"/$rev
                fi
        done
@@ -1054,6 +1052,7 @@ has_action "$todo" ||
        return 2
 
 cp "$todo" "$todo".backup
+collapse_todo_ids
 git_sequence_editor "$todo" ||
        die_abort "Could not execute editor"
 
index a9c75a2..752c763 100755 (executable)
@@ -1,7 +1,13 @@
 #!/bin/sh
 # Copyright (c) 2012 Felipe Contreras
 
-alias=$1
+# The first argument can be a url when the fetch/push command was a url
+# instead of a configured remote. In this case, use a generic alias.
+if test "$1" = "testgit::$2"; then
+       alias=_
+else
+       alias=$1
+fi
 url=$2
 
 dir="$GIT_DIR/testgit/$alias"
index 3092ab3..a18a795 100755 (executable)
@@ -299,6 +299,7 @@ my $rc = GetOptions("h" => \$help,
                    "bcc=s" => \@bcclist,
                    "no-bcc" => \$no_bcc,
                    "chain-reply-to!" => \$chain_reply_to,
+                   "no-chain-reply-to" => sub {$chain_reply_to = 0},
                    "smtp-server=s" => \$smtp_server,
                    "smtp-server-option=s" => \@smtp_server_options,
                    "smtp-server-port=s" => \$smtp_server_port,
@@ -311,25 +312,34 @@ my $rc = GetOptions("h" => \$help,
                    "smtp-domain:s" => \$smtp_domain,
                    "identity=s" => \$identity,
                    "annotate!" => \$annotate,
+                   "no-annotate" => sub {$annotate = 0},
                    "compose" => \$compose,
                    "quiet" => \$quiet,
                    "cc-cmd=s" => \$cc_cmd,
                    "suppress-from!" => \$suppress_from,
+                   "no-suppress-from" => sub {$suppress_from = 0},
                    "suppress-cc=s" => \@suppress_cc,
                    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
+                   "no-signed-off-cc|no-signed-off-by-cc" => sub {$signed_off_by_cc = 0},
                    "cc-cover|cc-cover!" => \$cover_cc,
+                   "no-cc-cover" => sub {$cover_cc = 0},
                    "to-cover|to-cover!" => \$cover_to,
+                   "no-to-cover" => sub {$cover_to = 0},
                    "confirm=s" => \$confirm,
                    "dry-run" => \$dry_run,
                    "envelope-sender=s" => \$envelope_sender,
                    "thread!" => \$thread,
+                   "no-thread" => sub {$thread = 0},
                    "validate!" => \$validate,
+                   "no-validate" => sub {$validate = 0},
                    "transfer-encoding=s" => \$target_xfer_encoding,
                    "format-patch!" => \$format_patch,
+                   "no-format-patch" => sub {$format_patch = 0},
                    "8bit-encoding=s" => \$auto_8bit_encoding,
                    "compose-encoding=s" => \$compose_encoding,
                    "force" => \$force,
                    "xmailer!" => \$use_xmailer,
+                   "no-xmailer" => sub {$use_xmailer = 0},
         );
 
 usage() if $help;
index 9245abf..36797c3 100755 (executable)
@@ -423,7 +423,7 @@ cmd_add()
                sed -e '
                        s|//*|/|g
                        s|^\(\./\)*||
-                       s|/\./|/|g
+                       s|/\(\./\)*|/|g
                        :start
                        s|\([^/]*\)/\.\./||
                        tstart
diff --git a/hex.c b/hex.c
index 9ebc050..cfd9d72 100644 (file)
--- a/hex.c
+++ b/hex.c
@@ -59,7 +59,7 @@ int get_sha1_hex(const char *hex, unsigned char *sha1)
 char *sha1_to_hex(const unsigned char *sha1)
 {
        static int bufno;
-       static char hexbuffer[4][50];
+       static char hexbuffer[4][41];
        static const char hex[] = "0123456789abcdef";
        char *buffer = hexbuffer[3 & ++bufno], *buf = buffer;
        int i;
diff --git a/pager.c b/pager.c
index f6e8c33..98b2682 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -133,12 +133,12 @@ int term_columns(void)
 /*
  * How many columns do we need to show this number in decimal?
  */
-int decimal_width(int number)
+int decimal_width(uintmax_t number)
 {
-       int i, width;
+       int width;
 
-       for (width = 1, i = 10; i <= number; width++)
-               i *= 10;
+       for (width = 1; number >= 10; width++)
+               number /= 10;
        return width;
 }
 
index b5905ee..9026a7b 100644 (file)
@@ -695,7 +695,7 @@ Retrieve the integer configuration C<VARIABLE>. The return value
 is simple decimal number.  An optional value suffix of 'k', 'm',
 or 'g' in the config file will cause the value to be multiplied
 by 1024, 1048576 (1024^2), or 1073741824 (1024^3) prior to output.
-It would return C<undef> if configuration variable is not defined,
+It would return C<undef> if configuration variable is not defined.
 
 =cut
 
@@ -704,7 +704,7 @@ sub config_int {
 }
 
 # Common subroutine to implement bulk of what the config* family of methods
-# do. This curently wraps command('config') so it is not so fast.
+# do. This currently wraps command('config') so it is not so fast.
 sub _config_common {
        my ($opts) = shift @_;
        my ($self, $var) = _maybe_self(@_);
index 8e4af71..f243726 100644 (file)
@@ -14,6 +14,7 @@ use IPC::Open3;
 use Memoize;  # core since 5.8.0, Jul 2002
 use Memoize::Storable;
 use POSIX qw(:signal_h);
+use Time::Local;
 
 use Git qw(
     command
@@ -1332,7 +1333,7 @@ sub parse_svn_date {
                $ENV{TZ} = 'UTC';
 
                my $epoch_in_UTC =
-                   POSIX::strftime('%s', $S, $M, $H, $d, $m - 1, $Y - 1900);
+                   Time::Local::timelocal($S, $M, $H, $d, $m - 1, $Y - 1900);
 
                # Determine our local timezone (including DST) at the
                # time of $epoch_in_UTC.  $Git::SVN::Log::TZ stored the
index 10edb27..613055a 100644 (file)
@@ -322,6 +322,14 @@ sub apply_textdelta {
        # (but $base does not,) so dup() it for reading in close_file
        open my $dup, '<&', $fh or croak $!;
        my $base = $::_repository->temp_acquire("git_blob_${$}_$suffix");
+       # close_file may call temp_acquire on 'svn_hash', but because of the
+       # call chain, if the temp_acquire call from close_file ends up being the
+       # call that first creates the 'svn_hash' temp file, then the FileHandle
+       # that's created as a result will end up in an SVN::Pool that we clear
+       # in SVN::Ra::gs_fetch_loop_common.  Avoid that by making sure the
+       # 'svn_hash' FileHandle is already created before close_file is called.
+       my $tmp_fh = $::_repository->temp_acquire('svn_hash');
+       $::_repository->temp_release($tmp_fh, 1);
 
        if ($fb->{blob}) {
                my ($base_is_link, $size);
index 622535e..32e2f19 100644 (file)
@@ -391,6 +391,9 @@ sub longest_common_path {
 sub gs_fetch_loop_common {
        my ($self, $base, $head, $gsv, $globs) = @_;
        return if ($base > $head);
+       # Make sure the cat_blob open2 FileHandle is created before calling
+       # SVN::Pool::new_default so that it does not incorrectly end up in the pool.
+       $::_repository->_open_cat_blob_if_needed;
        my $gpool = SVN::Pool->new_default;
        my $ra_url = $self->url;
        my $reload_ra = sub {
index 9d34d02..7b49304 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -567,7 +567,7 @@ static char *replace_encoding_header(char *buf, const char *encoding)
        char *cp = buf;
 
        /* guess if there is an encoding header before a \n\n */
-       while (strncmp(cp, "encoding ", strlen("encoding "))) {
+       while (!starts_with(cp, "encoding ")) {
                cp = strchr(cp, '\n');
                if (!cp || *++cp == '\n')
                        return buf;
index 9cff715..8d71860 100644 (file)
@@ -725,7 +725,7 @@ struct cache_entry *make_cache_entry(unsigned int mode,
                unsigned int refresh_options)
 {
        int size, len;
-       struct cache_entry *ce;
+       struct cache_entry *ce, *ret;
 
        if (!verify_path(path)) {
                error("Invalid path '%s'", path);
@@ -742,7 +742,13 @@ struct cache_entry *make_cache_entry(unsigned int mode,
        ce->ce_namelen = len;
        ce->ce_mode = create_ce_mode(mode);
 
-       return refresh_cache_entry(ce, refresh_options);
+       ret = refresh_cache_entry(ce, refresh_options);
+       if (!ret) {
+               free(ce);
+               return NULL;
+       } else {
+               return ret;
+       }
 }
 
 int ce_same_name(const struct cache_entry *a, const struct cache_entry *b)
index 30995e6..69a60ec 100644 (file)
@@ -3359,31 +3359,42 @@ static int for_each_file_in_obj_subdir(int subdir_nr,
        return r;
 }
 
-int for_each_loose_file_in_objdir(const char *path,
+int for_each_loose_file_in_objdir_buf(struct strbuf *path,
                            each_loose_object_fn obj_cb,
                            each_loose_cruft_fn cruft_cb,
                            each_loose_subdir_fn subdir_cb,
                            void *data)
 {
-       struct strbuf buf = STRBUF_INIT;
-       size_t baselen;
+       size_t baselen = path->len;
        int r = 0;
        int i;
 
-       strbuf_addstr(&buf, path);
-       strbuf_addch(&buf, '/');
-       baselen = buf.len;
-
        for (i = 0; i < 256; i++) {
-               strbuf_addf(&buf, "%02x", i);
-               r = for_each_file_in_obj_subdir(i, &buf, obj_cb, cruft_cb,
+               strbuf_addf(path, "/%02x", i);
+               r = for_each_file_in_obj_subdir(i, path, obj_cb, cruft_cb,
                                                subdir_cb, data);
-               strbuf_setlen(&buf, baselen);
+               strbuf_setlen(path, baselen);
                if (r)
                        break;
        }
 
+       return r;
+}
+
+int for_each_loose_file_in_objdir(const char *path,
+                                 each_loose_object_fn obj_cb,
+                                 each_loose_cruft_fn cruft_cb,
+                                 each_loose_subdir_fn subdir_cb,
+                                 void *data)
+{
+       struct strbuf buf = STRBUF_INIT;
+       int r;
+
+       strbuf_addstr(&buf, path);
+       r = for_each_loose_file_in_objdir_buf(&buf, obj_cb, cruft_cb,
+                                             subdir_cb, data);
        strbuf_release(&buf);
+
        return r;
 }
 
@@ -3396,9 +3407,16 @@ static int loose_from_alt_odb(struct alternate_object_database *alt,
                              void *vdata)
 {
        struct loose_alt_odb_data *data = vdata;
-       return for_each_loose_file_in_objdir(alt->base,
-                                            data->cb, NULL, NULL,
-                                            data->data);
+       struct strbuf buf = STRBUF_INIT;
+       int r;
+
+       /* copy base not including trailing '/' */
+       strbuf_add(&buf, alt->base, alt->name - alt->base - 1);
+       r = for_each_loose_file_in_objdir_buf(&buf,
+                                             data->cb, NULL, NULL,
+                                             data->data);
+       strbuf_release(&buf);
+       return r;
 }
 
 int for_each_loose_object(each_loose_object_fn cb, void *data)
index cf2a83b..95f9f8f 100644 (file)
@@ -1391,9 +1391,7 @@ static int get_sha1_with_context_1(const char *name,
                        namelen = strlen(cp);
                }
 
-               strncpy(oc->path, cp,
-                       sizeof(oc->path));
-               oc->path[sizeof(oc->path)-1] = '\0';
+               strlcpy(oc->path, cp, sizeof(oc->path));
 
                if (!active_cache)
                        read_cache();
@@ -1443,9 +1441,7 @@ static int get_sha1_with_context_1(const char *name,
                                                           name, len);
                        }
                        hashcpy(oc->tree, tree_sha1);
-                       strncpy(oc->path, filename,
-                               sizeof(oc->path));
-                       oc->path[sizeof(oc->path)-1] = '\0';
+                       strlcpy(oc->path, filename, sizeof(oc->path));
 
                        free(new_filename);
                        return ret;
index d88da29..db2ef22 100755 (executable)
@@ -23,6 +23,8 @@ else
                # To write armored exported key to keyring:
                #       gpg --homedir /tmp/gpghome --export-secret-keys \
                #               --armor 0xDEADBEEF >> lib-gpg/keyring.gpg
+               #       gpg --homedir /tmp/gpghome --export \
+               #               --armor 0xDEADBEEF >> lib-gpg/keyring.gpg
                # To export ownertrust:
                #       gpg --homedir /tmp/gpghome --export-ownertrust \
                #               > lib-gpg/ownertrust
@@ -34,6 +36,8 @@ else
                        "$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
                gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \
                        "$TEST_DIRECTORY"/lib-gpg/ownertrust &&
+               gpg --homedir "${GNUPGHOME}" </dev/null >/dev/null 2>&1 \
+                       --sign -u committer@example.com &&
                test_set_prereq GPG
                ;;
        esac
index fb1f048..d4754a1 100644 (file)
@@ -86,3 +86,57 @@ Z9Ei+zj6JD5Pcdi3BJhQo9WOLOVEJ0NHmewTYqk9QVXH/0v1Hdl4LMJtgcbdbDWk
 BOW78WUxzhu0YJTLKy+iKCjg5HS5dx6OC+e4aEEgfhNPCMkbvDsJjtQ=
 =hieJ
 -----END PGP PRIVATE KEY BLOCK-----
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1
+
+mQGiBEZnyykRBACzCPjIpTYNL7Y2tQqlEGTTDlvZcWNLjF5f7ZzuyOqNOidLUgFD
+36qch1LZLSZkShdR3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done
 fi
 
-if ! test_have_prereq SANITY; then
+if ! test_have_prereq NOT_ROOT; then
        test_skip_or_die $GIT_TEST_HTTPD \
                "Cannot run httpd tests as root"
 fi
index 17e969d..9acf628 100755 (executable)
@@ -34,7 +34,7 @@ test_expect_success POSIXPERM 'run_command reports EACCES' '
        grep "fatal: cannot exec.*hello.sh" err
 '
 
-test_expect_success POSIXPERM 'unreadable directory in PATH' '
+test_expect_success POSIXPERM,SANITY 'unreadable directory in PATH' '
        mkdir local-command &&
        test_when_finished "chmod u+rwx local-command && rm -fr local-command" &&
        git config alias.nitfol "!echo frotz" &&
index fdc257e..3c6791e 100755 (executable)
@@ -67,4 +67,13 @@ test_expect_success 'parse errors in blobs are properly attributed' '
        grep "HEAD:config" err
 '
 
+test_expect_success 'can parse blob ending with CR' '
+       printf "[some]key = value\\r" >config &&
+       git add config &&
+       git commit -m CR &&
+       echo value >expect &&
+       git config --blob=HEAD:config some.key >actual &&
+       test_cmp expect actual
+'
+
 test_done
index 335420f..b6977d4 100755 (executable)
@@ -98,8 +98,16 @@ test_foobar_foobar() {
        '
 }
 
-if ! test_have_prereq POSIXPERM || ! [ -w / ]; then
-       skip_all="Dangerous test skipped. Read this test if you want to execute it"
+if ! test -w /
+then
+       skip_all="Test requiring writable / skipped. Read this test if you want to run it"
+       test_done
+fi
+
+if  test -e /refs || test -e /objects || test -e /info || test -e /hooks ||
+    test -e /.git || test -e /foo || test -e /me
+then
+       skip_all="Skip test that clobbers existing files in /"
        test_done
 fi
 
@@ -108,8 +116,9 @@ if [ "$IKNOWWHATIAMDOING" != "YES" ]; then
        test_done
 fi
 
-if [ "$UID" = 0 ]; then
-       skip_all="No you can't run this with root"
+if ! test_have_prereq NOT_ROOT
+then
+       skip_all="No you can't run this as root"
        test_done
 fi
 
index 8197ed2..a31f7e0 100755 (executable)
@@ -1039,4 +1039,11 @@ test_expect_success 'short SHA-1 collide' '
        )
 '
 
+test_expect_success 'respect core.abbrev' '
+       git config core.abbrev 12 &&
+       set_cat_todo_editor &&
+       test_must_fail git rebase -i HEAD~4 >todo-list &&
+       test 4 = $(grep -c "pick [0-9a-f]\{12,\}" todo-list)
+'
+
 test_done
index e32e46d..0794d33 100755 (executable)
@@ -253,4 +253,12 @@ test_expect_success 'prune .git/shallow' '
        test_path_is_missing .git/shallow
 '
 
+test_expect_success 'prune: handle alternate object database' '
+       test_create_repo A &&
+       git -C A commit --allow-empty -m "initial commit" &&
+       git clone --shared A B &&
+       git -C B commit --allow-empty -m "next commit" &&
+       git -C B prune
+'
+
 test_done
index 2419407..c9d3ed1 100755 (executable)
@@ -281,4 +281,28 @@ test_expect_success 'push messages' '
        )
 '
 
+test_expect_success 'fetch HEAD' '
+       (cd server &&
+       git checkout master &&
+       echo more >>file &&
+       git commit -a -m more
+       ) &&
+       (cd local &&
+       git fetch origin HEAD
+       ) &&
+       compare_refs server HEAD local FETCH_HEAD
+'
+
+test_expect_success 'fetch url' '
+       (cd server &&
+       git checkout master &&
+       echo more >>file &&
+       git commit -a -m more
+       ) &&
+       (cd local &&
+       git fetch "testgit::${PWD}/../server"
+       ) &&
+       compare_refs server HEAD local FETCH_HEAD
+'
+
 test_done
index 3758961..190ee90 100755 (executable)
@@ -69,7 +69,8 @@ test_expect_success 'works in subdirectory' '
        cp new1.txt dir/a.txt &&
        cp orig.txt dir/o.txt &&
        cp new2.txt dir/b.txt &&
-       ( cd dir && git merge-file a.txt o.txt b.txt )
+       ( cd dir && git merge-file a.txt o.txt b.txt ) &&
+       test_path_is_missing a.txt
 '
 
 cp new1.txt test.txt
index 7c88245..5811a98 100755 (executable)
@@ -171,6 +171,23 @@ test_expect_success 'submodule add with ./ in path' '
        test_cmp empty untracked
 '
 
+test_expect_success 'submodule add with /././ in path' '
+       echo "refs/heads/master" >expect &&
+       >empty &&
+
+       (
+               cd addtest &&
+               git submodule add "$submodurl" dotslashdotsubmod/././frotz/./ &&
+               git submodule init
+       ) &&
+
+       rm -f heads head untracked &&
+       inspect addtest/dotslashdotsubmod/frotz ../../.. &&
+       test_cmp expect heads &&
+       test_cmp expect head &&
+       test_cmp empty untracked
+'
+
 test_expect_success 'submodule add with // in path' '
        echo "refs/heads/master" >expect &&
        >empty &&
index af6a3e8..0513055 100755 (executable)
@@ -392,7 +392,7 @@ test_expect_success $PREREQ 'allow long lines with --no-validate' '
                --from="Example <nobody@example.com>" \
                --to=nobody@example.com \
                --smtp-server="$(pwd)/fake.sendmail" \
-               --novalidate \
+               --no-validate \
                $patches longline.patch \
                2>errors
 '
@@ -426,7 +426,7 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
        git send-email \
                --from="Example <nobody@example.com>" \
                --to=nobody@example.com \
-               --nochain-reply-to \
+               --no-chain-reply-to \
                --in-reply-to="$(cat expect)" \
                --smtp-server="$(pwd)/fake.sendmail" \
                $patches $patches $patches \
@@ -1067,7 +1067,7 @@ test_expect_success $PREREQ 'in-reply-to but no threading' '
                --from="Example <nobody@example.com>" \
                --to=nobody@example.com \
                --in-reply-to="<in-reply-id@example.com>" \
-               --nothread \
+               --no-thread \
                $patches |
        grep "In-Reply-To: <in-reply-id@example.com>"
 '
@@ -1077,7 +1077,7 @@ test_expect_success $PREREQ 'no in-reply-to and no threading' '
                --dry-run \
                --from="Example <nobody@example.com>" \
                --to=nobody@example.com \
-               --nothread \
+               --no-thread \
                $patches $patches >stdout &&
        ! grep "In-Reply-To: " stdout
 '
@@ -1088,7 +1088,7 @@ test_expect_success $PREREQ 'threading but no chain-reply-to' '
                --from="Example <nobody@example.com>" \
                --to=nobody@example.com \
                --thread \
-               --nochain-reply-to \
+               --no-chain-reply-to \
                $patches $patches >stdout &&
        grep "In-Reply-To: " stdout
 '
index bb1402d..c096778 100644 (file)
@@ -1031,9 +1031,33 @@ test_lazy_prereq USR_BIN_TIME '
        test -x /usr/bin/time
 '
 
-# When the tests are run as root, permission tests will report that
-# things are writable when they shouldn't be.
-test -w / || test_set_prereq SANITY
+test_lazy_prereq NOT_ROOT '
+       uid=$(id -u) &&
+       test "$uid" != 0
+'
+
+# On a filesystem that lacks SANITY, a file can be deleted even if
+# the containing directory doesn't have write permissions, or a file
+# can be accessed even if the containing directory doesn't have read
+# or execute permissions, causing our tests that validate that Git
+# works sensibly in such situations.
+test_lazy_prereq SANITY '
+       mkdir SANETESTD.1 SANETESTD.2 &&
+
+       chmod +w SANETESTD.1 SANETESTD.2 &&
+       >SANETESTD.1/x 2>SANETESTD.2/x &&
+       chmod -w SANETESTD.1 &&
+       chmod -rx SANETESTD.2 ||
+       error "bug in test sript: cannot prepare SANETESTD"
+
+       ! rm SANETESTD.1/x && ! test -f SANETESTD.2/x
+       status=$?
+
+       chmod +rwx SANETESTD.1 SANETESTD.2 &&
+       rm -rf SANETESTD.1 SANETESTD.2 ||
+       error "bug in test sript: cannot clean SANETESTD"
+       return $status
+'
 
 GIT_UNZIP=${GIT_UNZIP:-unzip}
 test_lazy_prereq UNZIP '
index 623adeb..05b3859 100644 (file)
--- a/trailer.c
+++ b/trailer.c
@@ -1,7 +1,6 @@
 #include "cache.h"
 #include "string-list.h"
 #include "run-command.h"
-#include "string-list.h"
 #include "commit.h"
 #include "trailer.h"
 /*
index 0224687..7dc4a44 100644 (file)
@@ -5,7 +5,6 @@
 #include "commit.h"
 #include "diff.h"
 #include "revision.h"
-#include "quote.h"
 #include "remote.h"
 #include "string-list.h"
 #include "thread-utils.h"
@@ -356,7 +355,8 @@ static int fetch_with_fetch(struct transport *transport,
                        continue;
 
                strbuf_addf(&buf, "fetch %s %s\n",
-                           sha1_to_hex(posn->old_sha1), posn->name);
+                           sha1_to_hex(posn->old_sha1),
+                           posn->symref ? posn->symref : posn->name);
        }
 
        strbuf_addch(&buf, '\n');
@@ -454,7 +454,8 @@ static int fetch_with_import(struct transport *transport,
                if (posn->status & REF_STATUS_UPTODATE)
                        continue;
 
-               strbuf_addf(&buf, "import %s\n", posn->name);
+               strbuf_addf(&buf, "import %s\n",
+                           posn->symref ? posn->symref : posn->name);
                sendline(data, &buf);
                strbuf_reset(&buf);
        }
@@ -487,14 +488,15 @@ static int fetch_with_import(struct transport *transport,
         * fast-forward or this is a forced update.
         */
        for (i = 0; i < nr_heads; i++) {
-               char *private;
+               char *private, *name;
                posn = to_fetch[i];
                if (posn->status & REF_STATUS_UPTODATE)
                        continue;
+               name = posn->symref ? posn->symref : posn->name;
                if (data->refspecs)
-                       private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name);
+                       private = apply_refspecs(data->refspecs, data->refspec_nr, name);
                else
-                       private = xstrdup(posn->name);
+                       private = xstrdup(name);
                if (private) {
                        read_ref(private, posn->old_sha1);
                        free(private);
@@ -860,7 +862,7 @@ static int push_refs_with_export(struct transport *transport,
                        die("helper %s does not support dry-run", data->name);
        } else if (flags & TRANSPORT_PUSH_CERT) {
                if (set_helper_option(transport, TRANS_OPT_PUSH_CERT, "true") != 0)
-                       die("helper %s does not support dry-run", data->name);
+                       die("helper %s does not support --signed", data->name);
        }
 
        if (flags & TRANSPORT_PUSH_FORCE) {
index fad52d6..2ccbee5 100644 (file)
@@ -1,6 +1,5 @@
 #include "cache.h"
 #include "userdiff.h"
-#include "cache.h"
 #include "attr.h"
 
 static struct userdiff_driver *drivers;