Merge branch 'tc/curl-vernum-output-broken-in-7.11' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 5 Mar 2015 21:13:07 +0000 (13:13 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Mar 2015 21:13:07 +0000 (13:13 -0800)
Certain older vintages of cURL give irregular output from
"curl-config --vernum", which confused our build system.

* tc/curl-vernum-output-broken-in-7.11:
Makefile: handle broken curl version number in version check

53 files changed:
Documentation/CodingGuidelines
Documentation/RelNotes/2.3.0.txt
Documentation/RelNotes/2.3.1.txt [new file with mode: 0644]
Documentation/config.txt
Documentation/diff-format.txt
Documentation/git-push.txt
Documentation/git-remote.txt
Documentation/git.txt
Documentation/rev-list-options.txt
GIT-VERSION-GEN
RelNotes
builtin/apply.c
builtin/blame.c
builtin/commit.c
builtin/fetch.c
builtin/log.c
cache.h
config.c
contrib/credential/wincred/git-credential-wincred.c
ewah/ewok.h
git-add--interactive.perl
git-compat-util.h
git-rebase--interactive.sh
git-remote-testgit.sh
grep.c
hex.c
http.c
notes.c
pager.c
perl/Git.pm
po/ca.po
refs.c
remote-curl.c
remote.c
rerere.c
shallow.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/t4138-apply-ws-expansion.sh [new file with mode: 0755]
t/t4255-am-submodule.sh
t/t5550-http-fetch-dumb.sh
t/t5801-remote-helpers.sh
t/test-lib.sh
trailer.c
transport-helper.c
userdiff.c
walker.c
wt-status.c
index 894546dd75416fcf09542096a67b2f22a7d0de7a..0f8cccf52da4882377a56042a4de3ff754d357b9 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
index 11dc73c383bf35db349dda7a7fee1dcdc6b616f1..e3c639c8407f99dd1887ba4cef7d1a96a7242516 100644 (file)
@@ -1,6 +1,12 @@
 Git v2.3 Release Notes
 ======================
 
+This one ended up to be a release with lots of small corrections and
+improvements without big uncomfortably exciting features.  The recent
+security fix that went to 2.2.1 and older maintenance tracks is also
+contained in this update.
+
+
 Updates since v2.2
 ------------------
 
diff --git a/Documentation/RelNotes/2.3.1.txt b/Documentation/RelNotes/2.3.1.txt
new file mode 100644 (file)
index 0000000..cf96186
--- /dev/null
@@ -0,0 +1,52 @@
+Git v2.3.1 Release Notes
+========================
+
+Fixes since v2.3
+----------------
+
+ * The interactive "show a list and let the user choose from it"
+   interface "add -i" used showed and prompted to the user even when
+   the candidate list was empty, against which the only "choice" the
+   user could have made was to choose nothing.
+
+ * "git apply --whitespace=fix" used to under-allocate the memory
+   when the fix resulted in a longer text than the original patch.
+
+ * "git log --help" used to show rev-list options that are irrelevant
+   to the "log" command.
+
+ * The error message from "git commit", when a non-existing author
+   name was given as value to the "--author=" parameter, has been
+   reworded to avoid misunderstanding.
+
+ * A broken pack .idx file in the receiving repository prevented the
+   dumb http transport from fetching a good copy of it from the other
+   side.
+
+ * The documentation incorrectly said that C(opy) and R(ename) are the
+   only ones that can be followed by the score number in the output in
+   the --raw format.
+
+ * Fix a misspelled conditional that is always true.
+
+ * Code to read branch name from various files in .git/ directory
+   would have misbehaved if the code to write them left an empty file.
+
+ * The "git push" documentation made the "--repo=<there>" option
+   easily misunderstood.
+
+ * After attempting and failing a password-less authentication
+   (e.g. kerberos), libcURL refuses to fall back to password based
+   Basic authentication without a bit of help/encouragement.
+
+ * Setting diff.submodule to 'log' made "git format-patch" produce
+   broken patches.
+
+ * "git rerere" (invoked internally from many mergy operations) did
+   not correctly signal errors when told to update the working tree
+   files and failed to do so for whatever reason.
+
+ * "git blame HEAD -- missing" failed to correctly say "HEAD" when it
+   tried to say "No such path 'missing' in HEAD".
+
+Also contains typofixes, documentation updates and trivial code clean-ups.
index 04e2a71687922bbf78a493df6ca6dc5730359eb1..b22a7a7ff52f124dce2e2cb16040bffaeee391cb 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.
@@ -1960,7 +1959,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 +2296,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 +2336,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 15c7e794f4adaccb8885683946a9f4e7e4dc92c2..85b08909ce25acc5f9deae9a3e0ade2bd679bc94 100644 (file)
@@ -66,7 +66,8 @@ be committed)
 
 Status letters C and R are always followed by a score (denoting the
 percentage of similarity between the source and target of the move or
-copy), and are the only ones to be so.
+copy).  Status letter M may be followed by a score (denoting the
+percentage of dissimilarity) for file rewrites.
 
 <sha1> is shown as all 0's if a file is new on the filesystem
 and it is out of sync with the index.
index b17283ab7a1cc73c5ec741e0da1128bea2a57a65..58cc59f20cc5a3338f782e09639b8ae8bdc97ae3 100644 (file)
@@ -214,22 +214,8 @@ origin +master` to force a push to the `master` branch). See the
 `<refspec>...` section above for details.
 
 --repo=<repository>::
-       This option is only relevant if no <repository> argument is
-       passed in the invocation. In this case, 'git push' derives the
-       remote name from the current branch: If it tracks a remote
-       branch, then that remote repository is pushed to. Otherwise,
-       the name "origin" is used. For this latter case, this option
-       can be used to override the name "origin". In other words,
-       the difference between these two commands
-+
---------------------------
-git push public         #1
-git push --repo=public  #2
---------------------------
-+
-is that #1 always pushes to "public" whereas #2 pushes to "public"
-only if the current branch does not track a remote branch. This is
-useful if you write an alias or script around 'git push'.
+       This option is equivalent to the <repository> argument. If both
+       are specified, the command-line argument takes precedence.
 
 -u::
 --set-upstream::
index cb103c8b6f8fe4fd89ad5e1a37b551f9f54d75c7..a77607b852c1f9cbcea7b9d1a359e5c467933aa0 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 9d334314270003d4ce54ef233691506dd4f10197..b37f1abe8c72cac5a8bfb2fca05fc6ff3f7335c4 100644 (file)
@@ -43,6 +43,12 @@ 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]
+
+* release notes for
+  link:RelNotes/2.3.1.txt[2.3.1],
+  link:RelNotes/2.3.0.txt[2.3].
+
 * link:v2.2.2/git.html[documentation for release 2.2.2]
 
 * release notes for
index 2984f407a9f3084235fd0207a82ea44a424942ed..97ef2e8e71c1f8898453df4ed81877434097f7a1 100644 (file)
@@ -172,11 +172,6 @@ explicitly.
        Pretend as if all objects mentioned by reflogs are listed on the
        command line as `<commit>`.
 
---indexed-objects::
-       Pretend as if all trees and blobs used by the index are listed
-       on the command line.  Note that you probably want to use
-       `--objects`, too.
-
 --ignore-missing::
        Upon seeing an invalid object name in the input, pretend as if
        the bad input was not given.
@@ -644,6 +639,7 @@ Object Traversal
 
 These options are mostly targeted for packing of Git repositories.
 
+ifdef::git-rev-list[]
 --objects::
        Print the object IDs of any object referenced by the listed
        commits.  `--objects foo ^bar` thus means ``send me
@@ -662,9 +658,15 @@ These options are mostly targeted for packing of Git repositories.
        commits at the cost of increased time.  This is used instead of
        `--objects-edge` to build ``thin'' packs for shallow repositories.
 
+--indexed-objects::
+       Pretend as if all trees and blobs used by the index are listed
+       on the command line.  Note that you probably want to use
+       `--objects`, too.
+
 --unpacked::
        Only useful with `--objects`; print the object IDs that are not
        in packs.
+endif::git-rev-list[]
 
 --no-walk[=(sorted|unsorted)]::
        Only show the given commits, but do not traverse their ancestors.
index 068eae29d6fefb9f5fa0780de0d4418fbe9e11fa..04077889761666d454cefb3fb8e38255a35efede 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.3.0-rc2
+DEF_VER=v2.3.1
 
 LF='
 '
index 9257c74b5cff52da962e55a4f96d0b9d974cf362..f57e70dfd2669e0b30e1cca2a12b9bbd9b33630e 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/2.3.0.txt
\ No newline at end of file
+Documentation/RelNotes/2.3.1.txt
\ No newline at end of file
index 0aad91283959bce51aba596c6f3d2d0925e5ba92..c484b53f551edb72b1230fd25e9bff9af979d688 100644 (file)
@@ -657,11 +657,6 @@ static size_t diff_timestamp_len(const char *line, size_t len)
        return line + len - end;
 }
 
-static char *null_strdup(const char *s)
-{
-       return s ? xstrdup(s) : NULL;
-}
-
 static char *find_name_common(const char *line, const char *def,
                              int p_value, const char *end, int terminate)
 {
@@ -684,10 +679,10 @@ static char *find_name_common(const char *line, const char *def,
                        start = line;
        }
        if (!start)
-               return squash_slash(null_strdup(def));
+               return squash_slash(xstrdup_or_null(def));
        len = line - start;
        if (!len)
-               return squash_slash(null_strdup(def));
+               return squash_slash(xstrdup_or_null(def));
 
        /*
         * Generally we prefer the shorter name, especially
@@ -909,7 +904,7 @@ static void parse_traditional_patch(const char *first, const char *second, struc
                        patch->old_name = name;
                } else {
                        patch->old_name = name;
-                       patch->new_name = null_strdup(name);
+                       patch->new_name = xstrdup_or_null(name);
                }
        }
        if (!name)
@@ -998,7 +993,7 @@ static int gitdiff_delete(const char *line, struct patch *patch)
 {
        patch->is_delete = 1;
        free(patch->old_name);
-       patch->old_name = null_strdup(patch->def_name);
+       patch->old_name = xstrdup_or_null(patch->def_name);
        return gitdiff_oldmode(line, patch);
 }
 
@@ -1006,7 +1001,7 @@ static int gitdiff_newfile(const char *line, struct patch *patch)
 {
        patch->is_new = 1;
        free(patch->new_name);
-       patch->new_name = null_strdup(patch->def_name);
+       patch->new_name = xstrdup_or_null(patch->def_name);
        return gitdiff_newmode(line, patch);
 }
 
@@ -2235,6 +2230,12 @@ static void update_pre_post_images(struct image *preimage,
                ctx++;
        }
 
+       if (postlen
+           ? postlen < new - postimage->buf
+           : postimage->len < new - postimage->buf)
+               die("BUG: caller miscounted postlen: asked %d, orig = %d, used = %d",
+                   (int)postlen, (int) postimage->len, (int)(new - postimage->buf));
+
        /* Fix the length of the whole thing */
        postimage->len = new - postimage->buf;
        postimage->nr -= reduced;
@@ -2390,10 +2391,27 @@ static int match_fragment(struct image *img,
 
        /*
         * The hunk does not apply byte-by-byte, but the hash says
-        * it might with whitespace fuzz. We haven't been asked to
+        * it might with whitespace fuzz. We weren't asked to
         * ignore whitespace, we were asked to correct whitespace
         * errors, so let's try matching after whitespace correction.
         *
+        * While checking the preimage against the target, whitespace
+        * errors in both fixed, we count how large the corresponding
+        * postimage needs to be.  The postimage prepared by
+        * apply_one_fragment() has whitespace errors fixed on added
+        * lines already, but the common lines were propagated as-is,
+        * which may become longer when their whitespace errors are
+        * fixed.
+        */
+
+       /* First count added lines in postimage */
+       postlen = 0;
+       for (i = 0; i < postimage->nr; i++) {
+               if (!(postimage->line[i].flag & LINE_COMMON))
+                       postlen += postimage->line[i].len;
+       }
+
+       /*
         * The preimage may extend beyond the end of the file,
         * but in this loop we will only handle the part of the
         * preimage that falls within the file.
@@ -2401,7 +2419,6 @@ static int match_fragment(struct image *img,
        strbuf_init(&fixed, preimage->len + 1);
        orig = preimage->buf;
        target = img->buf + try;
-       postlen = 0;
        for (i = 0; i < preimage_limit; i++) {
                size_t oldlen = preimage->line[i].len;
                size_t tgtlen = img->line[try_lno + i].len;
@@ -2429,7 +2446,10 @@ static int match_fragment(struct image *img,
                match = (tgtfix.len == fixed.len - fixstart &&
                         !memcmp(tgtfix.buf, fixed.buf + fixstart,
                                             fixed.len - fixstart));
-               postlen += tgtfix.len;
+
+               /* Add the length if this is common with the postimage */
+               if (preimage->line[i].flag & LINE_COMMON)
+                       postlen += tgtfix.len;
 
                strbuf_release(&tgtfix);
                if (!match)
index 303e217ae919f21aa4d4574bd1720b5f4d635c32..0374fe8056acfe193d2cbd5c553b3de889b788fe 100644 (file)
@@ -2390,7 +2390,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
        return commit;
 }
 
-static const char *prepare_final(struct scoreboard *sb)
+static char *prepare_final(struct scoreboard *sb)
 {
        int i;
        const char *final_commit_name = NULL;
@@ -2415,10 +2415,10 @@ static const char *prepare_final(struct scoreboard *sb)
                sb->final = (struct commit *) obj;
                final_commit_name = revs->pending.objects[i].name;
        }
-       return final_commit_name;
+       return xstrdup_or_null(final_commit_name);
 }
 
-static const char *prepare_initial(struct scoreboard *sb)
+static char *prepare_initial(struct scoreboard *sb)
 {
        int i;
        const char *final_commit_name = NULL;
@@ -2445,7 +2445,7 @@ static const char *prepare_initial(struct scoreboard *sb)
        }
        if (!final_commit_name)
                die("No commit to dig down to?");
-       return final_commit_name;
+       return xstrdup(final_commit_name);
 }
 
 static int blame_copy_callback(const struct option *option, const char *arg, int unset)
@@ -2489,7 +2489,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
        struct origin *o;
        struct blame_entry *ent = NULL;
        long dashdash_pos, lno;
-       const char *final_commit_name = NULL;
+       char *final_commit_name = NULL;
        enum object_type type;
 
        static struct string_list range_list;
@@ -2786,6 +2786,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 
        assign_blame(&sb, opt);
 
+       free(final_commit_name);
+
        if (incremental)
                return 0;
 
index 7d90c3591567d10f9a075ec38048b93923f707d4..714638c5d625f370ce87f26b55375f874290ed95 100644 (file)
@@ -559,20 +559,14 @@ static void set_ident_var(char **buf, char *val)
        *buf = val;
 }
 
-static char *envdup(const char *var)
-{
-       const char *val = getenv(var);
-       return val ? xstrdup(val) : NULL;
-}
-
 static void determine_author_info(struct strbuf *author_ident)
 {
        char *name, *email, *date;
        struct ident_split author;
 
-       name = envdup("GIT_AUTHOR_NAME");
-       email = envdup("GIT_AUTHOR_EMAIL");
-       date = envdup("GIT_AUTHOR_DATE");
+       name = xstrdup_or_null(getenv("GIT_AUTHOR_NAME"));
+       email = xstrdup_or_null(getenv("GIT_AUTHOR_EMAIL"));
+       date = xstrdup_or_null(getenv("GIT_AUTHOR_DATE"));
 
        if (author_message) {
                struct ident_split ident;
@@ -1056,7 +1050,7 @@ static const char *find_author_by_nickname(const char *name)
                clear_mailmap(&mailmap);
                return strbuf_detach(&buf, NULL);
        }
-       die(_("No existing author found with '%s'"), name);
+       die(_("--author '%s' is not 'Name <email>' and matches no existing author"), name);
 }
 
 
index 7b84d35d83498bc51b06915818f63d1f365eec91..75a55e590bdc3411e5e4aeee6275fbfff4451904 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 923ffe72ced41f12a2258f732be418731bc2e4a8..a131992c52f96daeb7c72b447c5ed6929c01a96a 100644 (file)
@@ -705,7 +705,7 @@ static int git_format_config(const char *var, const char *value, void *cb)
                return 0;
        }
        if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff") ||
-           !strcmp(var, "color.ui")) {
+           !strcmp(var, "color.ui") || !strcmp(var, "diff.submodule")) {
                return 0;
        }
        if (!strcmp(var, "format.numbered")) {
diff --git a/cache.h b/cache.h
index f704af5df0984e092fe318e535596921c4ea7122..04951ddcbf7cf2cb61957568f8608b0fbbd9c9da 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1498,7 +1498,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 752e2e227f56edfb7b2ad168798c110c14a2c5e8..66c0a51bce529e4c027f11017697a62dd737b3bd 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';
                }
        }
@@ -1340,7 +1345,7 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
                string_list_init(&e->value_list, 1);
                hashmap_add(&cs->config_hash, e);
        }
-       si = string_list_append_nodup(&e->value_list, value ? xstrdup(value) : NULL);
+       si = string_list_append_nodup(&e->value_list, xstrdup_or_null(value));
 
        ALLOC_GROW(cs->list.items, cs->list.nr + 1, cs->list.alloc);
        l_item = &cs->list.items[cs->list.nr++];
index a1d38f035bea404aa9a5fa37518f0af21143dbf0..006134043a472edd54720d6d4237e9484476d3a3 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 f6ad190a038a55e39a0b8b135c995413192f80e3..13c6e20412591ed3bc56b38b17419a540264f6c5 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 c7256741cc2a28f333d6a9be5f12e248df99ed5e..77876d433a1ba2384a690155b51dac8118fa27b4 100755 (executable)
@@ -515,6 +515,9 @@ sub error_msg {
 sub list_and_choose {
        my ($opts, @stuff) = @_;
        my (@chosen, @return);
+       if (!@stuff) {
+           return @return;
+       }
        my $i;
        my @prefixes = find_unique_prefixes(@stuff) unless $opts->{LIST_ONLY};
 
@@ -725,6 +728,8 @@ sub add_untracked_cmd {
        if (@add) {
                system(qw(git update-index --add --), @add);
                say_n_paths('added', @add);
+       } else {
+               print "No untracked files.\n";
        }
        print "\n";
 }
index eb9b0ff32829ef62bf2d1af432742841b9720906..2ce96d5cb78120a050bb36e2501c97f25e051148 100644 (file)
@@ -212,12 +212,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
@@ -678,6 +681,11 @@ extern char *xgetcwd(void);
 
 #define REALLOC_ARRAY(x, alloc) (x) = xrealloc((x), (alloc) * sizeof(*(x)))
 
+static inline char *xstrdup_or_null(const char *str)
+{
+       return str ? xstrdup(str) : NULL;
+}
+
 static inline size_t xsize_t(off_t len)
 {
        if (len > (size_t) len)
index c6a4629cbc2b69d3e6dfabe5e124384fe7fe611c..c96b9847e9fc2aaf67997c74a8d5c0abe78b607d 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 a9c75a2360fec7a9ce5f22877a471f70bc405ff1..752c763eb666e197304efbc7ea006325a36ff870 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"
diff --git a/grep.c b/grep.c
index 6e085f829731146c319fff57da0ae482de97ff77..b58c7c64342698737f9c11b20457bd30ca1fc727 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -1661,8 +1661,8 @@ void grep_source_init(struct grep_source *gs, enum grep_source_type type,
                      const void *identifier)
 {
        gs->type = type;
-       gs->name = name ? xstrdup(name) : NULL;
-       gs->path = path ? xstrdup(path) : NULL;
+       gs->name = xstrdup_or_null(name);
+       gs->path = xstrdup_or_null(path);
        gs->buf = NULL;
        gs->size = 0;
        gs->driver = NULL;
diff --git a/hex.c b/hex.c
index 9ebc050637532765b775cbd8e3b92951a67ea333..cfd9d722fd92f137a79ee2bf6be44b4b393c6da6 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/http.c b/http.c
index 040f362a6a299618288c9249588ceb7aed6f3011..67986200655f88f5545e3df3669c2f4bbe688247 100644 (file)
--- a/http.c
+++ b/http.c
@@ -62,6 +62,9 @@ static const char *user_agent;
 
 static struct credential cert_auth = CREDENTIAL_INIT;
 static int ssl_cert_password_required;
+#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
+static unsigned long http_auth_methods = CURLAUTH_ANY;
+#endif
 
 static struct curl_slist *pragma_header;
 static struct curl_slist *no_pragma_header;
@@ -580,6 +583,9 @@ struct active_request_slot *get_active_slot(void)
        curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
        curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
        curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1);
+#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
+       curl_easy_setopt(slot->curl, CURLOPT_HTTPAUTH, http_auth_methods);
+#endif
        if (http_auth.password)
                init_curl_http_auth(slot->curl);
 
@@ -870,6 +876,9 @@ int handle_curl_result(struct slot_results *results)
                        credential_reject(&http_auth);
                        return HTTP_NOAUTH;
                } else {
+#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
+                       http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE;
+#endif
                        return HTTP_REAUTH;
                }
        } else {
@@ -986,6 +995,7 @@ static void extract_content_type(struct strbuf *raw, struct strbuf *type,
                strbuf_addstr(charset, "ISO-8859-1");
 }
 
+
 /* http_request() targets */
 #define HTTP_REQUEST_STRBUF    0
 #define HTTP_REQUEST_FILE      1
@@ -1240,7 +1250,7 @@ static int fetch_and_setup_pack_index(struct packed_git **packs_head,
        int ret;
 
        if (has_pack_index(sha1)) {
-               new_pack = parse_pack_index(sha1, NULL);
+               new_pack = parse_pack_index(sha1, sha1_pack_index_name(sha1));
                if (!new_pack)
                        return -1; /* parse_pack_index() already issued error message */
                goto add_pack;
diff --git a/notes.c b/notes.c
index c763a21eef5b64c984c22d18cd5f21c1bd32e5a3..2be4d7f3fd081476001212b103f011e45b4a9c41 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -1006,7 +1006,7 @@ void init_notes(struct notes_tree *t, const char *notes_ref,
        t->root = (struct int_node *) xcalloc(1, sizeof(struct int_node));
        t->first_non_note = NULL;
        t->prev_non_note = NULL;
-       t->ref = notes_ref ? xstrdup(notes_ref) : NULL;
+       t->ref = xstrdup_or_null(notes_ref);
        t->combine_notes = combine_notes;
        t->initialized = 1;
        t->dirty = 0;
diff --git a/pager.c b/pager.c
index f6e8c331924496ca6656cd05d7de6497310502ab..98b26823c9e0c0bd220a7a41a97675626c8e65ec 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 b5905ee1ad03fe9973e3cf7d46fa29c5cf184215..9026a7bb980a984086a62536f46ec3837588f277 100644 (file)
@@ -695,7 +695,7 @@ sub config_path {
 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 682b4cde6eeda9d93de4071362cbc505994093c1..a649508b121a9cee651c15fbb1ad2c7b37d74d3b 100644 (file)
--- a/po/ca.po
+++ b/po/ca.po
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: Git\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
 "POT-Creation-Date: 2015-01-18 11:24+0800\n"
-"PO-Revision-Date: 2015-01-26 10:12-0700\n"
+"PO-Revision-Date: 2015-01-30 15:01-0700\n"
 "Last-Translator: Alex Henrie <alexhenrie24@gmail.com>\n"
 "Language-Team: Catalan\n"
 "Language: ca\n"
@@ -1881,11 +1881,11 @@ msgstr "rebase en progrés; en "
 
 #: wt-status.c:1317
 msgid "HEAD detached at "
-msgstr "HEAD separat a"
+msgstr "HEAD separat a "
 
 #: wt-status.c:1319
 msgid "HEAD detached from "
-msgstr "HEAD separat de"
+msgstr "HEAD separat de "
 
 #: wt-status.c:1322
 msgid "Not currently on any branch."
@@ -3243,7 +3243,7 @@ msgstr "surt amb zero quan no hi ha error"
 
 #: builtin/cat-file.c:371
 msgid "pretty-print object's content"
-msgstr "imprimeix bellament el contingut de l'objecte "
+msgstr "imprimeix bellament el contingut de l'objecte"
 
 #: builtin/cat-file.c:373
 msgid "for blob objects, run textconv on object's content"
@@ -3764,7 +3764,7 @@ msgstr "Selecciona els Ã­tems a suprimir"
 #: builtin/clean.c:757
 #, c-format
 msgid "remove %s? "
-msgstr "eliminar %s?"
+msgstr "eliminar %s? "
 
 #: builtin/clean.c:782
 msgid "Bye."
diff --git a/refs.c b/refs.c
index ed3b2cb405cc576f16e5b94d83683953b94e1e89..9edf18b04e7e29b12fa3808aab2239efcc404dca 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -1618,8 +1618,7 @@ const char *resolve_ref_unsafe(const char *refname, int resolve_flags, unsigned
 
 char *resolve_refdup(const char *ref, int resolve_flags, unsigned char *sha1, int *flags)
 {
-       const char *ret = resolve_ref_unsafe(ref, resolve_flags, sha1, flags);
-       return ret ? xstrdup(ret) : NULL;
+       return xstrdup_or_null(resolve_ref_unsafe(ref, resolve_flags, sha1, flags));
 }
 
 /* The argument to filter_refs */
index dd63bc27abf8ae4b9e480ba1bb88942db11a0e48..515ac9b411a211936a575628706a30ea4a2ccc3f 100644 (file)
@@ -760,7 +760,7 @@ static int fetch_git(struct discovery *heads,
 
        for (i = 0; i < nr_heads; i++) {
                struct ref *ref = to_fetch[i];
-               if (!ref->name || !*ref->name)
+               if (!*ref->name)
                        die("cannot fetch by sha1 over smart http");
                packet_buf_write(&preamble, "%s %s\n",
                                 sha1_to_hex(ref->old_sha1), ref->name);
index 5b9c6931c1e66adb03f5d505aa8dd57169452eae..7b71ebf4bfca0ce6490a122afc5c321d2b35690c 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -975,8 +975,8 @@ struct ref *copy_ref(const struct ref *ref)
        cpy = xmalloc(sizeof(struct ref) + len + 1);
        memcpy(cpy, ref, sizeof(struct ref) + len + 1);
        cpy->next = NULL;
-       cpy->symref = ref->symref ? xstrdup(ref->symref) : NULL;
-       cpy->remote_status = ref->remote_status ? xstrdup(ref->remote_status) : NULL;
+       cpy->symref = xstrdup_or_null(ref->symref);
+       cpy->remote_status = xstrdup_or_null(ref->remote_status);
        cpy->peer_ref = copy_ref(ref->peer_ref);
        return cpy;
 }
index 1b0555f1a5a0233e931b13a088c052a56aef3977..31644dec04fe4a77d43624720ff516de2d746dbc 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -477,27 +477,23 @@ static int merge(const char *name, const char *path)
 
 static struct lock_file index_lock;
 
-static int update_paths(struct string_list *update)
+static void update_paths(struct string_list *update)
 {
        int i;
-       int fd = hold_locked_index(&index_lock, 0);
-       int status = 0;
 
-       if (fd < 0)
-               return -1;
+       hold_locked_index(&index_lock, 1);
 
        for (i = 0; i < update->nr; i++) {
                struct string_list_item *item = &update->items[i];
-               if (add_file_to_cache(item->string, ADD_CACHE_IGNORE_ERRORS))
-                       status = -1;
+               if (add_file_to_cache(item->string, 0))
+                       exit(128);
        }
 
-       if (!status && active_cache_changed) {
+       if (active_cache_changed) {
                if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
                        die("Unable to write new index file");
-       } else if (fd >= 0)
+       } else
                rollback_lock_file(&index_lock);
-       return status;
 }
 
 static int do_plain_rerere(struct string_list *rr, int fd)
index cdd07751461e69291588dee801c3563644cb1107..f5e67204a4084ff79beec0d5a5dd0fb06966cc3f 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -22,7 +22,7 @@ void set_alternate_shallow_file(const char *path, int override)
        if (alternate_shallow_file && !override)
                return;
        free(alternate_shallow_file);
-       alternate_shallow_file = path ? xstrdup(path) : NULL;
+       alternate_shallow_file = xstrdup_or_null(path);
 }
 
 int register_shallow(const unsigned char *sha1)
index d88da29f77d23fe2f3efc86a15daf198dddbeb69..db2ef22e8f76a54c851424dd19c1232f6061392c 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 fb1f048c22fc9bdc32c27ac931f149c65f89ed24..d4754a1f19c7984b3286cfd9dfa9740a790800e0 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
+
+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
+=iYv/
+-----END PGP PUBLIC KEY BLOCK-----
index fd53b5718780e25f03924e38438706acc54598db..d154d1ed1dd8f3449ad21e0aeefdce7d3120e1fb 100644 (file)
@@ -37,7 +37,7 @@ then
        test_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 17e969df609f71b0b4562cff8fda112632d27442..9acf628726fe0c648279fb724f1917435db206f7 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 fdc257e66fdc121b9f125466bf38431e3233dd19..3c6791e6be705bc823ff180cd481fef3dc939734 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 335420fd87f87727f323156f461e520374b7da0b..b6977d4b390ec9a3f4f3b621db88908a2c40f689 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 8197ed29a9ecedb43679200f1485a7b50984fdff..a31f7e0430e107c1fbe036ce412d4466fa5bd2c2 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
diff --git a/t/t4138-apply-ws-expansion.sh b/t/t4138-apply-ws-expansion.sh
new file mode 100755 (executable)
index 0000000..0ffe33f
--- /dev/null
@@ -0,0 +1,121 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 Kyle J. McKay
+#
+
+test_description='git apply test patches with whitespace expansion.'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+       #
+       ## create test-N, patchN.patch, expect-N files
+       #
+
+       # test 1
+       printf "\t%s\n" 1 2 3 4 5 6 >before &&
+       printf "\t%s\n" 1 2 3 >after &&
+       printf "%64s\n" a b c >>after &&
+       printf "\t%s\n" 4 5 6 >>after &&
+       git diff --no-index before after |
+               sed -e "s/before/test-1/" -e "s/after/test-1/" >patch1.patch &&
+       printf "%64s\n" 1 2 3 4 5 6 >test-1 &&
+       printf "%64s\n" 1 2 3 a b c 4 5 6 >expect-1 &&
+
+       # test 2
+       printf "\t%s\n" a b c d e f >before &&
+       printf "\t%s\n" a b c >after &&
+       n=10 &&
+       x=1 &&
+       while test $x -lt $n
+       do
+               printf "%63s%d\n" "" $x >>after
+               x=$(( $x + 1 ))
+       done &&
+       printf "\t%s\n" d e f >>after &&
+       git diff --no-index before after |
+               sed -e "s/before/test-2/" -e "s/after/test-2/" >patch2.patch &&
+       printf "%64s\n" a b c d e f >test-2 &&
+       printf "%64s\n" a b c >expect-2 &&
+       x=1 &&
+       while test $x -lt $n
+       do
+               printf "%63s%d\n" "" $x >>expect-2
+               x=$(( $x + 1 ))
+       done &&
+       printf "%64s\n" d e f >>expect-2 &&
+
+       # test 3
+       printf "\t%s\n" a b c d e f >before &&
+       printf "\t%s\n" a b c >after &&
+       n=100 &&
+       x=0 &&
+       while test $x -lt $n
+       do
+               printf "%63s%02d\n" "" $x >>after
+               x=$(( $x + 1 ))
+       done &&
+       printf "\t%s\n" d e f >>after &&
+       git diff --no-index before after |
+       sed -e "s/before/test-3/" -e "s/after/test-3/" >patch3.patch &&
+       printf "%64s\n" a b c d e f >test-3 &&
+       printf "%64s\n" a b c >expect-3 &&
+       x=0 &&
+       while test $x -lt $n
+       do
+               printf "%63s%02d\n" "" $x >>expect-3
+               x=$(( $x + 1 ))
+       done &&
+       printf "%64s\n" d e f >>expect-3 &&
+
+       # test 4
+       >before &&
+       x=0 &&
+       while test $x -lt 50
+       do
+               printf "\t%02d\n" $x >>before
+               x=$(( $x + 1 ))
+       done &&
+       cat before >after &&
+       printf "%64s\n" a b c >>after &&
+       while test $x -lt 100
+       do
+               printf "\t%02d\n" $x >>before
+               printf "\t%02d\n" $x >>after
+               x=$(( $x + 1 ))
+       done &&
+       git diff --no-index before after |
+       sed -e "s/before/test-4/" -e "s/after/test-4/" >patch4.patch &&
+       >test-4 &&
+       x=0 &&
+       while test $x -lt 50
+       do
+               printf "%63s%02d\n" "" $x >>test-4
+               x=$(( $x + 1 ))
+       done &&
+       cat test-4 >expect-4 &&
+       printf "%64s\n" a b c >>expect-4 &&
+       while test $x -lt 100
+       do
+               printf "%63s%02d\n" "" $x >>test-4
+               printf "%63s%02d\n" "" $x >>expect-4
+               x=$(( $x + 1 ))
+       done &&
+
+       git config core.whitespace tab-in-indent,tabwidth=63 &&
+       git config apply.whitespace fix
+
+'
+
+# Note that `patch` can successfully apply all patches when run
+# with the --ignore-whitespace option.
+
+for t in 1 2 3 4
+do
+       test_expect_success 'apply with ws expansion (t=$t)' '
+               git apply patch$t.patch &&
+               test_cmp test-$t expect-$t
+       '
+done
+
+test_done
index 8bde7dbb6dba8f65797204fee38951e213e80cdd..0ba8194403f6740807cbd63d1bda8a69091e3d6b 100755 (executable)
@@ -18,4 +18,76 @@ am_3way () {
 KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
 test_submodule_switch "am_3way"
 
+test_expect_success 'setup diff.submodule' '
+       test_commit one &&
+       INITIAL=$(git rev-parse HEAD) &&
+
+       git init submodule &&
+       (
+               cd submodule &&
+               test_commit two &&
+               git rev-parse HEAD >../initial-submodule
+       ) &&
+       git submodule add ./submodule &&
+       git commit -m first &&
+
+       (
+               cd submodule &&
+               test_commit three &&
+               git rev-parse HEAD >../first-submodule
+       ) &&
+       git add submodule &&
+       git commit -m second &&
+       SECOND=$(git rev-parse HEAD) &&
+
+       (
+               cd submodule &&
+               git mv two.t four.t &&
+               git commit -m "second submodule" &&
+               git rev-parse HEAD >../second-submodule
+       ) &&
+       test_commit four &&
+       git add submodule &&
+       git commit --amend --no-edit &&
+       THIRD=$(git rev-parse HEAD) &&
+       git submodule update --init
+'
+
+run_test() {
+       START_COMMIT=$1 &&
+       EXPECT=$2 &&
+       # Abort any merges in progress: the previous
+       # test may have failed, and we should clean up.
+       test_might_fail git am --abort &&
+       git reset --hard $START_COMMIT &&
+       rm -f *.patch &&
+       git format-patch -1 &&
+       git reset --hard $START_COMMIT^ &&
+       git submodule update &&
+       git am *.patch &&
+       git submodule update &&
+       git -C submodule rev-parse HEAD >actual &&
+       test_cmp $EXPECT actual
+}
+
+test_expect_success 'diff.submodule unset' '
+       test_unconfig diff.submodule &&
+       run_test $SECOND first-submodule
+'
+
+test_expect_success 'diff.submodule unset with extra file' '
+       test_unconfig diff.submodule &&
+       run_test $THIRD second-submodule
+'
+
+test_expect_success 'diff.submodule=log' '
+       test_config diff.submodule log &&
+       run_test $SECOND first-submodule
+'
+
+test_expect_success 'diff.submodule=log with extra file' '
+       test_config diff.submodule log &&
+       run_test $THIRD second-submodule
+'
+
 test_done
index ac71418a1b26bc17a1252d6831869b96a8d8c176..6da942243101c4f5358b4aaf3c62cf6390c258b4 100755 (executable)
@@ -165,6 +165,24 @@ test_expect_success 'fetch notices corrupt idx' '
        )
 '
 
+test_expect_success 'fetch can handle previously-fetched .idx files' '
+       git checkout --orphan branch1 &&
+       echo base >file &&
+       git add file &&
+       git commit -m base &&
+       git --bare init "$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git &&
+       git push "$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git branch1 &&
+       git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git repack -d &&
+       git checkout -b branch2 branch1 &&
+       echo b2 >>file &&
+       git commit -a -m b2 &&
+       git push "$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git branch2 &&
+       git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git repack -d &&
+       git --bare init clone_packed_branches.git &&
+       git --git-dir=clone_packed_branches.git fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch1:branch1 &&
+       git --git-dir=clone_packed_branches.git fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch2:branch2
+'
+
 test_expect_success 'did not use upload-pack service' '
        grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act
        : >exp
index 24194075468819881826c24c08b1aa97bacb9897..c9d3ed14c3a3238208b44ce815e37123298dea77 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 bb1402de944de11ee54a73dab7c33441ae1450c5..c09677802cce067a946a2550cdd2d8ef33434e81 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 623adeb02d0e06a83d7b17a9b605ff8c6475a0bd..05b3859b476dc19f37d8715ac012c29373e8f91e 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 0224687a2316798c57315093315eafae0da0b1aa..7dc4a443aee0c6220dc0581d4bcfdd1d65da1d8a 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 fad52d6392fab8aadc8f6555db5aafcde224a120..2ccbee50cb69171062e84c9a1b36baf7e31be2f8 100644 (file)
@@ -1,6 +1,5 @@
 #include "cache.h"
 #include "userdiff.h"
-#include "cache.h"
 #include "attr.h"
 
 static struct userdiff_driver *drivers;
index f149371e71ebdcdbd12336aace15b0fc20f74569..483da4e0fb5771b8a64d62648624258dcf3fdcb0 100644 (file)
--- a/walker.c
+++ b/walker.c
@@ -232,7 +232,7 @@ int walker_targets_stdin(char ***target, const char ***write_ref)
                        REALLOC_ARRAY(*write_ref, targets_alloc);
                }
                (*target)[targets] = xstrdup(tg_one);
-               (*write_ref)[targets] = rf_one ? xstrdup(rf_one) : NULL;
+               (*write_ref)[targets] = xstrdup_or_null(rf_one);
                targets++;
        }
        strbuf_release(&buf);
index b54eac5af6233de183144230259bd317cf24513a..29666d0dbaa5af768aca86f3ca0b644ac9720648 100644 (file)
@@ -1140,7 +1140,7 @@ static char *read_and_strip_branch(const char *path)
        if (strbuf_read_file(&sb, git_path("%s", path), 0) <= 0)
                goto got_nothing;
 
-       while (&sb.len && sb.buf[sb.len - 1] == '\n')
+       while (sb.len && sb.buf[sb.len - 1] == '\n')
                strbuf_setlen(&sb, sb.len - 1);
        if (!sb.len)
                goto got_nothing;