Merge branch 'tb/complete-checkout' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 15 Nov 2017 03:04:58 +0000 (12:04 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Nov 2017 03:04:58 +0000 (12:04 +0900)
Command line completion (in contrib/) update.

* tb/complete-checkout:
completion: add remaining flags to checkout

33 files changed:
.travis.yml
Documentation/RelNotes/2.15.0.txt
Documentation/git-check-ref-format.txt
Documentation/git-config.txt
Documentation/git-rev-parse.txt
Documentation/rev-list-options.txt
GIT-VERSION-GEN
builtin/check-ref-format.c
builtin/commit.c
builtin/grep.c
builtin/remote.c
ci/install-dependencies.sh
ci/lib-travisci.sh
column.c
diff.c
dir.c
log-tree.c
path.c
po/ca.po
refs/files-backend.c
sequencer.c
sha1_name.c
t/helper/test-ref-store.c
t/t1402-check-ref-format.sh
t/t1404-update-ref-errors.sh
t/t3404-rebase-interactive.sh
t/t4015-diff-whitespace.sh
t/t5601-clone.sh
t/t7006-pager.sh
t/t7061-wtstatus-ignore.sh
worktree.c
xdiff-interface.c
xdiff-interface.h
index fead995eddd15460b6be81e6a5f7c8f0648368ca..281f101f3154e3884e71cde6184b59fd2b21c154 100644 (file)
@@ -71,7 +71,7 @@ matrix:
           packages:
           - coccinelle
       before_install:
-      # "before_script" that builds Git is inherited from base job
+      before_script:
       script: ci/run-static-analysis.sh
       after_failure:
     - env: Documentation
index 541815ee346c87212af0d119d2e6f5e9bfc039b6..248ba70c3dc1c6959f24ded8db7ce0119f811ad4 100644 (file)
@@ -488,6 +488,10 @@ Fixes since v2.14
    described in an earlier part of the doc.
    (merge 07c4984508 dg/filter-branch-filter-order-doc later to maint).
 
+ * A possible oom error is now caught as a fatal error, instead of
+   continuing and dereferencing NULL.
+   (merge 55d7d15847 ao/path-use-xmalloc later to maint).
+
  * Other minor doc, test and build updates and code cleanups.
    (merge f094b89a4d ma/parse-maybe-bool later to maint).
    (merge 6cdf8a7929 ma/ts-cleanups later to maint).
@@ -499,3 +503,6 @@ Fixes since v2.14
    (merge 7cbbf9d6a2 ls/filter-process-delayed later to maint).
    (merge 488aa65c8f wk/merge-options-gpg-sign-doc later to maint).
    (merge e61cb19a27 jc/branch-force-doc-readability-fix later to maint).
+   (merge 32fceba3fd np/config-path-doc later to maint).
+   (merge e38c681fb7 sb/rev-parse-show-superproject-root later to maint).
+   (merge 4f851dc883 sg/rev-list-doc-reorder-fix later to maint).
index 92777cef25e1145fc2a060d572255be564dec491..cf0a0b7df28e560a243805618bf9e5b093354eeb 100644 (file)
@@ -77,7 +77,14 @@ reference name expressions (see linkgit:gitrevisions[7]):
 
 . at-open-brace `@{` is used as a notation to access a reflog entry.
 
-With the `--branch` option, it expands the ``previous branch syntax''
+With the `--branch` option, the command takes a name and checks if
+it can be used as a valid branch name (e.g. when creating a new
+branch).  The rule `git check-ref-format --branch $name` implements
+may be stricter than what `git check-ref-format refs/heads/$name`
+says (e.g. a dash may appear at the beginning of a ref component,
+but it is explicitly forbidden at the beginning of a branch name).
+When run with `--branch` option in a repository, the input is first
+expanded for the ``previous branch syntax''
 `@{-n}`.  For example, `@{-1}` is a way to refer the last branch you
 were on.  This option should be used by porcelains to accept this
 syntax anywhere a branch name is expected, so they can act as if you
index 83f86b9231b012bbb4716dc27cd72291cb48126a..4edd09fc6b0742042f3236598d8ecb793773d8ab 100644 (file)
@@ -174,11 +174,11 @@ See also <<FILES>>.
        either --bool or --int, as described above.
 
 --path::
-       'git-config' will expand leading '{tilde}' to the value of
-       '$HOME', and '{tilde}user' to the home directory for the
+       `git config` will expand a leading `~` to the value of
+       `$HOME`, and `~user` to the home directory for the
        specified user.  This option has no effect when setting the
-       value (but you can use 'git config bla {tilde}/' from the
-       command line to let your shell do the expansion).
+       value (but you can use `git config section.variable ~/`
+       from the command line to let your shell do the expansion).
 
 -z::
 --null::
index 0917b8207b9d6e6c88dc611cf40a81ab17481a2e..95326b85ff68edbda3a6661816251351029bdfda 100644 (file)
@@ -264,7 +264,7 @@ print a message to stderr and exit with nonzero status.
 --show-toplevel::
        Show the absolute path of the top-level directory.
 
---show-superproject-working-tree
+--show-superproject-working-tree::
        Show the absolute path of the root of the superproject's
        working tree (if exists) that uses the current repository as
        its submodule.  Outputs nothing if the current repository is
index 7d860bfca1442e7957c41b7a7a5cd6f82141ed7e..13501e1556e25b9571c089e58c4bd092fee50b63 100644 (file)
@@ -799,11 +799,11 @@ endif::git-rev-list[]
 
 --parents::
        Print also the parents of the commit (in the form "commit parent...").
-       Also enables parent rewriting, see 'History Simplification' below.
+       Also enables parent rewriting, see 'History Simplification' above.
 
 --children::
        Print also the children of the commit (in the form "commit child...").
-       Also enables parent rewriting, see 'History Simplification' below.
+       Also enables parent rewriting, see 'History Simplification' above.
 
 ifdef::git-rev-list[]
 --timestamp::
@@ -846,7 +846,7 @@ you would get an output like this:
        to be drawn properly.
        Cannot be combined with `--no-walk`.
 +
-This enables parent rewriting, see 'History Simplification' below.
+This enables parent rewriting, see 'History Simplification' above.
 +
 This implies the `--topo-order` option by default, but the
 `--date-order` option may also be specified.
index 9ef24f24d8bb3e08f7f831345285a6790eecc2e7..a9dbc3f12c428ff4e86932ad1eb29448b9290812 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.15.0-rc2
+DEF_VER=v2.15.0
 
 LF='
 '
index 6c40ff110bee7387d4eb4e9c7c04a21e8b12ca44..bc67d3f0a83d35b2fc6d81f28c6908075564644a 100644 (file)
@@ -39,12 +39,14 @@ static char *collapse_slashes(const char *refname)
 static int check_ref_format_branch(const char *arg)
 {
        struct strbuf sb = STRBUF_INIT;
+       const char *name;
        int nongit;
 
        setup_git_directory_gently(&nongit);
-       if (strbuf_check_branch_ref(&sb, arg))
+       if (strbuf_check_branch_ref(&sb, arg) ||
+           !skip_prefix(sb.buf, "refs/heads/", &name))
                die("'%s' is not a valid branch name", arg);
-       printf("%s\n", sb.buf + 11);
+       printf("%s\n", name);
        strbuf_release(&sb);
        return 0;
 }
index d75b3805ea7fe3475564f337bf660d8155909445..b2a6c7f100d82c4160c4bea6b4663af5459194cc 100644 (file)
@@ -1492,6 +1492,8 @@ static void print_summary(const char *prefix, const struct object_id *oid,
        diff_setup_done(&rev.diffopt);
 
        head = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
+       if (!head)
+               die_errno(_("unable to resolve HEAD after creating commit"));
        if (!strcmp(head, "HEAD"))
                head = _("detached HEAD");
        else
index 2d65f27d01f3da772f7bad21f101fdc0af0102ed..5a6cfe6b45b06b6b75ea399a83cb8dcf7e197141 100644 (file)
@@ -431,7 +431,9 @@ static int grep_submodule(struct grep_opt *opt, struct repository *superproject,
         * store is no longer global and instead is a member of the repository
         * object.
         */
+       grep_read_lock();
        add_to_alternates_memory(submodule.objectdir);
+       grep_read_unlock();
 
        if (oid) {
                struct object *object;
index 4f5cac96b0f5e0044ddf0fd1e2ea686f694d62ca..bc896236952079fc3ae06e23101991169dea64fc 100644 (file)
@@ -565,7 +565,7 @@ static int read_remote_branches(const char *refname,
                item = string_list_append(rename->remote_branches, xstrdup(refname));
                symref = resolve_ref_unsafe(refname, RESOLVE_REF_READING,
                                            NULL, &flag);
-               if (flag & REF_ISSYMREF)
+               if (symref && (flag & REF_ISSYMREF))
                        item->util = xstrdup(symref);
                else
                        item->util = NULL;
index a29246af3580dc9ef7af584cb53a2fc6e084d09a..5bd06fe900d44916fd11875fa5641e9b97e90540 100755 (executable)
@@ -12,20 +12,18 @@ case "${TRAVIS_OS_NAME:-linux}" in
 linux)
        export GIT_TEST_HTTPD=YesPlease
 
-       mkdir --parents custom/p4
-       pushd custom/p4
+       mkdir --parents "$P4_PATH"
+       pushd "$P4_PATH"
                wget --quiet "$P4WHENCE/bin.linux26x86_64/p4d"
                wget --quiet "$P4WHENCE/bin.linux26x86_64/p4"
                chmod u+x p4d
                chmod u+x p4
-               export PATH="$(pwd):$PATH"
        popd
-       mkdir --parents custom/git-lfs
-       pushd custom/git-lfs
+       mkdir --parents "$GIT_LFS_PATH"
+       pushd "$GIT_LFS_PATH"
                wget --quiet "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
                tar --extract --gunzip --file "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
                cp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .
-               export PATH="$(pwd):$PATH"
        popd
        ;;
 osx)
index b3ed0a0ddac4261307a31a99f3cd18fb7aabc4fc..ac05f1f4694347bbd96fe1911aa33450d43ae24f 100755 (executable)
@@ -26,3 +26,11 @@ skip_branch_tip_with_tag () {
 set -e
 
 skip_branch_tip_with_tag
+
+case "${TRAVIS_OS_NAME:-linux}" in
+linux)
+       P4_PATH="$(pwd)/custom/p4"
+       GIT_LFS_PATH="$(pwd)/custom/git-lfs"
+       export PATH="$GIT_LFS_PATH:$P4_PATH:$PATH"
+       ;;
+esac
index ff7bdab1a32478c8719ee3b973742456df7dc629..49ab85b76916784d5d5e6d6ef15a9638ef97b59f 100644 (file)
--- a/column.c
+++ b/column.c
@@ -224,7 +224,7 @@ int finalize_colopts(unsigned int *colopts, int stdout_is_tty)
                if (stdout_is_tty < 0)
                        stdout_is_tty = isatty(1);
                *colopts &= ~COL_ENABLE_MASK;
-               if (stdout_is_tty)
+               if (stdout_is_tty || pager_in_use())
                        *colopts |= COL_ENABLED;
        }
        return 0;
diff --git a/diff.c b/diff.c
index 6fd288420bc55b5213ad6dfea4a4f411543d6dbf..e6814b9e9c6d6f49a48fb2d3234323e20dec5f56 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -707,83 +707,14 @@ struct moved_entry {
        struct moved_entry *next_line;
 };
 
-static int next_byte(const char **cp, const char **endp,
-                    const struct diff_options *diffopt)
-{
-       int retval;
-
-       if (*cp > *endp)
-               return -1;
-
-       if (isspace(**cp)) {
-               if (DIFF_XDL_TST(diffopt, IGNORE_WHITESPACE_CHANGE)) {
-                       while (*cp < *endp && isspace(**cp))
-                               (*cp)++;
-                       /*
-                        * After skipping a couple of whitespaces,
-                        * we still have to account for one space.
-                        */
-                       return (int)' ';
-               }
-
-               if (DIFF_XDL_TST(diffopt, IGNORE_WHITESPACE)) {
-                       while (*cp < *endp && isspace(**cp))
-                               (*cp)++;
-                       /* return the first non-ws character via the usual below */
-               }
-       }
-
-       retval = (unsigned char)(**cp);
-       (*cp)++;
-       return retval;
-}
-
 static int moved_entry_cmp(const struct diff_options *diffopt,
                           const struct moved_entry *a,
                           const struct moved_entry *b,
                           const void *keydata)
 {
-       const char *ap = a->es->line, *ae = a->es->line + a->es->len;
-       const char *bp = b->es->line, *be = b->es->line + b->es->len;
-
-       if (!(diffopt->xdl_opts & XDF_WHITESPACE_FLAGS))
-               return a->es->len != b->es->len  || memcmp(ap, bp, a->es->len);
-
-       if (DIFF_XDL_TST(diffopt, IGNORE_WHITESPACE_AT_EOL)) {
-               while (ae > ap && isspace(*ae))
-                       ae--;
-               while (be > bp && isspace(*be))
-                       be--;
-       }
-
-       while (1) {
-               int ca, cb;
-               ca = next_byte(&ap, &ae, diffopt);
-               cb = next_byte(&bp, &be, diffopt);
-               if (ca != cb)
-                       return 1;
-               if (ca < 0)
-                       return 0;
-       }
-}
-
-static unsigned get_string_hash(struct emitted_diff_symbol *es, struct diff_options *o)
-{
-       if (o->xdl_opts & XDF_WHITESPACE_FLAGS) {
-               static struct strbuf sb = STRBUF_INIT;
-               const char *ap = es->line, *ae = es->line + es->len;
-               int c;
-
-               strbuf_reset(&sb);
-               while (ae > ap && isspace(*ae))
-                       ae--;
-               while ((c = next_byte(&ap, &ae, o)) > 0)
-                       strbuf_addch(&sb, c);
-
-               return memhash(sb.buf, sb.len);
-       } else {
-               return memhash(es->line, es->len);
-       }
+       return !xdiff_compare_lines(a->es->line, a->es->len,
+                                   b->es->line, b->es->len,
+                                   diffopt->xdl_opts);
 }
 
 static struct moved_entry *prepare_entry(struct diff_options *o,
@@ -792,7 +723,7 @@ static struct moved_entry *prepare_entry(struct diff_options *o,
        struct moved_entry *ret = xmalloc(sizeof(*ret));
        struct emitted_diff_symbol *l = &o->emitted_symbols->buf[line_no];
 
-       ret->ent.hash = get_string_hash(l, o);
+       ret->ent.hash = xdiff_hash_string(l->line, l->len, o->xdl_opts);
        ret->es = l;
        ret->next_line = NULL;
 
diff --git a/dir.c b/dir.c
index 1d17b800cf374d179d7cef3c6bbb180a5a1b4aba..9987011da57bcf171ba645788b8ccd2151561e5c 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -1392,7 +1392,7 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
                if (!(dir->flags & DIR_NO_GITLINKS)) {
                        unsigned char sha1[20];
                        if (resolve_gitlink_ref(dirname, "HEAD", sha1) == 0)
-                               return path_untracked;
+                               return exclude ? path_excluded : path_untracked;
                }
                return path_recurse;
        }
index cea056234d0a0b605c988a4e157852cd659f22ef..580b3a98a03df8b1920b3f729c783b79ed781164 100644 (file)
@@ -198,7 +198,7 @@ static const struct name_decoration *current_pointed_by_HEAD(const struct name_d
 
        /* Now resolve and find the matching current branch */
        branch_name = resolve_ref_unsafe("HEAD", 0, NULL, &rru_flags);
-       if (!(rru_flags & REF_ISSYMREF))
+       if (!branch_name || !(rru_flags & REF_ISSYMREF))
                return NULL;
 
        if (!starts_with(branch_name, "refs/"))
diff --git a/path.c b/path.c
index 2e09a7bce0688acccaca8b980c2c337a71885966..da8b655730d363dda5010bdf2d53bd76abb82931 100644 (file)
--- a/path.c
+++ b/path.c
@@ -192,7 +192,7 @@ static void *add_to_trie(struct trie *root, const char *key, void *value)
                 * Split this node: child will contain this node's
                 * existing children.
                 */
-               child = malloc(sizeof(*child));
+               child = xmalloc(sizeof(*child));
                memcpy(child->children, root->children, sizeof(root->children));
 
                child->len = root->len - i - 1;
index 4dc7b9cb152d3adcd8308be74392d3ac1bd8ea6b..7f8c30f7cce97647fe2b59c1a9b10476c5b75e15 100644 (file)
--- a/po/ca.po
+++ b/po/ca.po
 #   amend            |  esmenar
 #   broken           |  malmès
 #   delta            |  diferència
-#   dry              |  simulació
 #   deprecated       |  en desús
+#   dry              |  simulació
 #   fatal            |  fatal
+#   hook             |  lligam
 #   hunk             |  tros
 #   not supported    |  no està admès
 #   repository       |  dipòsit
+#   setting          |  paràmetre
 #   skip             |  ometre
 #   squelch          |  silenciar
-#   setting          |  paràmetre
 #   token            |  testimoni
+#   unset            |  desassignar
 #
 # Alguns termes que són comandes específiques del git i d'àmbit molt tècnic
 # hem decidit no traduir-los per facilitar-ne la compressió a l'usuari i perquè
@@ -39,6 +41,7 @@
 #   stage            |  Â«stage»
 #   stash            |  Â«sta»
 #   squash           |  Â«squash»
+#   trailer          |  Â«trailer»
 #   unstage          |  Â«unstage»
 msgid ""
 msgstr ""
@@ -145,7 +148,7 @@ msgstr "opció d'espai en blanc Â«%s» no reconeguda"
 #: apply.c:74
 #, c-format
 msgid "unrecognized whitespace ignore option '%s'"
-msgstr "opció d'ignora l'espai en blanc Â«%s» no reconeguda"
+msgstr "opció ignora l'espai en blanc Â«%s» no reconeguda"
 
 #: apply.c:125
 msgid "--reject and --3way cannot be used together."
@@ -1316,7 +1319,7 @@ msgstr "memòria esgotada"
 
 #: config.c:187
 msgid "relative config include conditionals must come from files"
-msgstr ""
+msgstr "els condicionals d'inclusió de configuració relatius han de venir de fitxers"
 
 #: config.c:721
 #, c-format
@@ -1432,12 +1435,12 @@ msgstr "%s no vàlid: Â«%s»"
 #: config.c:2130
 #, c-format
 msgid "unknown core.untrackedCache value '%s'; using 'keep' default value"
-msgstr ""
+msgstr "valor Â«%s» a core.untrackedCache desconegut; utilitzant el valor per defecte Â«keep»"
 
 #: config.c:2156
 #, c-format
 msgid "splitIndex.maxPercentChange value '%d' should be between 0 and 100"
-msgstr ""
+msgstr "valor Â«%d» a splitIndex.maxPercentChange ha d'estar entre 0 i 100"
 
 #: config.c:2167
 #, c-format
@@ -1467,7 +1470,7 @@ msgstr "no s'ha pogut establir Â«%s» a Â«%s»"
 #: config.c:2680 builtin/remote.c:776
 #, c-format
 msgid "could not unset '%s'"
-msgstr "no s'ha pogut desestablir Â«%s»"
+msgstr "no s'ha pogut desassignar Â«%s»"
 
 #: connect.c:50
 msgid "The remote end hung up upon initial contact"
@@ -1630,6 +1633,7 @@ msgid ""
 "color moved setting must be one of 'no', 'default', 'zebra', 'dimmed_zebra', "
 "'plain'"
 msgstr ""
+"el paràmetre de color en moviment ha de ser Â«no», Â«default», Â«zebra», Â«dimmed_zebra» o Â«plain»"
 
 #: diff.c:341
 #, c-format
@@ -2070,7 +2074,7 @@ msgstr "no s'ha pogut detectar automàticament el nom («%s» rebut)"
 #: ident.c:395
 #, c-format
 msgid "empty ident name (for <%s>) not allowed"
-msgstr ""
+msgstr "nom d'identitat buit (per <%s>) no Ã©s permès"
 
 #: ident.c:401
 #, c-format
@@ -2608,7 +2612,7 @@ msgstr "No s'ha pogut obrir Â«%s» per a escriptura"
 
 #: refs.c:1792
 msgid "ref updates forbidden inside quarantine environment"
-msgstr ""
+msgstr "no està permès actualitzar les referències en un entorn de quarantena"
 
 #: refs/files-backend.c:1136
 #, c-format
@@ -2681,9 +2685,9 @@ msgid "%%(subject) does not take arguments"
 msgstr "%%(subject) no accepta paràmetres"
 
 #: ref-filter.c:198
-#, fuzzy, c-format
+#, c-format
 msgid "unknown %%(trailers) argument: %s"
-msgstr "paràmetre de reflexió desconegut: %s"
+msgstr "paràmetre %%(trailers) desconegut: %s"
 
 #: ref-filter.c:221
 #, c-format
@@ -3916,7 +3920,7 @@ msgstr "no s'ha pogut llegir el fitxer d'entrada Â«%s»"
 
 #: trailer.c:753
 msgid "could not read from stdin"
-msgstr "no s'ha pogut llegir des d'stdin"
+msgstr "no s'ha pogut llegir des dstdin"
 
 #: trailer.c:1008 builtin/am.c:46
 #, c-format
@@ -4905,7 +4909,7 @@ msgstr "actualitza els fitxers seguits"
 
 #: builtin/add.c:279
 msgid "record only the fact that the path will be added later"
-msgstr "registra només el fet de que el camí s'afegirà més tard"
+msgstr "registra només el fet que el camí s'afegirà més tard"
 
 #: builtin/add.c:280
 msgid "add changes from all tracked and untracked files"
@@ -4958,6 +4962,19 @@ msgid ""
 "\n"
 "See \"git help submodule\" for more information."
 msgstr ""
+"Heu afegit un altre dipòsit git dins del dipòsit actual.\n"
+"Els clons de dipòsits externs no contindran els continguts de\n"
+"del dipòsit incrustat i no saben com obtenir-ho.\n"
+"Si volíeu afegir un submòdul, useu:\n"
+"\n"
+"\tgit submodule add <url> %s\n"
+"\n"
+"Si heu afegit aquest camí per error, podeu suprimir-lo de\n"
+" l'índex amb:\n"
+"\n"
+"\tgit rm --cached %s\n"
+"\n"
+"Vegeu \"git help submodule\" per a més informació."
 
 #: builtin/add.c:333
 #, c-format
@@ -5010,7 +5027,7 @@ msgstr "no s'ha pogut analitzar l'script d'autor"
 #: builtin/am.c:498
 #, c-format
 msgid "'%s' was deleted by the applypatch-msg hook"
-msgstr "s'ha suprimit Â«%s» pel ganxo applypatch-msg"
+msgstr "s'ha suprimit Â«%s» pel lligam applypatch-msg"
 
 #: builtin/am.c:539
 #, c-format
@@ -5200,6 +5217,10 @@ msgid ""
 "such.\n"
 "You might run `git rm` on a file to accept \"deleted by them\" for it."
 msgstr ""
+"Encara teniu camins sense fusionar a l'índex.\n"
+"Heu de fer 'git add' a cada fitxer amb conflictes resolts per marcar-los "
+"com a tal.\n"
+"Podeu executar `git rm` en un fitxer per acceptar \"suprimit per ells\" pel fitxer."
 
 #: builtin/am.c:2029 builtin/am.c:2033 builtin/am.c:2045 builtin/reset.c:332
 #: builtin/reset.c:340
@@ -5779,7 +5800,7 @@ msgstr "canvia la informació de font"
 
 #: builtin/branch.c:588
 msgid "Unset the upstream info"
-msgstr "Desestableix la informació de font"
+msgstr "Desassigna la informació de font"
 
 #: builtin/branch.c:589
 msgid "use colored output"
@@ -5945,12 +5966,12 @@ msgstr "la branca Â«%s» no existeix"
 
 #: builtin/branch.c:775
 msgid "too many arguments to unset upstream"
-msgstr "hi ha massa arguments per a desestablir la font"
+msgstr "hi ha massa arguments per a desassignar la font"
 
 #: builtin/branch.c:779
 msgid "could not unset upstream of HEAD when it does not point to any branch."
 msgstr ""
-"no s'ha pogut desestablir la font de HEAD perquè no assenyala cap branca."
+"no s'ha pogut desassignar la font de HEAD perquè no assenyala cap branca."
 
 #: builtin/branch.c:785
 #, c-format
@@ -6084,7 +6105,7 @@ msgstr "usa .gitattributes només des de l'índex"
 
 #: builtin/check-attr.c:22 builtin/check-ignore.c:24 builtin/hash-object.c:99
 msgid "read file names from stdin"
-msgstr "llegeix els noms de fitxer d'stdin"
+msgstr "llegeix els noms de fitxer dstdin"
 
 #: builtin/check-attr.c:24 builtin/check-ignore.c:26
 msgid "terminate input and output records by a NUL character"
@@ -6132,7 +6153,7 @@ msgstr "git check-mailmap [<opcions>] <contacte>..."
 
 #: builtin/check-mailmap.c:14
 msgid "also read contacts from stdin"
-msgstr "també llegeix els contactes des d'stdin"
+msgstr "també llegeix els contactes des dstdin"
 
 #: builtin/check-mailmap.c:25
 #, c-format
@@ -6498,7 +6519,7 @@ msgstr "especificació de camí no vàlida"
 #: builtin/checkout.c:1277
 #, c-format
 msgid "'%s' is not a commit and a branch '%s' cannot be created from it"
-msgstr ""
+msgstr "«%s» no Ã©s una comissió i la branca Â«%s» no es pot crear a partir d'aquesta comissió"
 
 #: builtin/checkout.c:1281
 #, c-format
@@ -6804,7 +6825,7 @@ msgstr "clona només una branca, HEAD o --branch"
 
 #: builtin/clone.c:127
 msgid "don't clone any tags, and make later fetches not to follow them"
-msgstr ""
+msgstr "no cloneu cap etiqueta, i feu que els Â«fetch» següents no els segueixen"
 
 #: builtin/clone.c:129
 msgid "any cloned submodules will be shallow"
@@ -7604,7 +7625,7 @@ msgstr "comet només els fitxers especificats"
 
 #: builtin/commit.c:1624
 msgid "bypass pre-commit and commit-msg hooks"
-msgstr "evita els ganxos de precomissió i missatge de comissió"
+msgstr "evita els lligams de precomissió i missatge de comissió"
 
 #: builtin/commit.c:1625
 msgid "show what would be committed"
@@ -7616,7 +7637,7 @@ msgstr "esmena la comissió anterior"
 
 #: builtin/commit.c:1637
 msgid "bypass post-rewrite hook"
-msgstr "evita el ganxo de post escriptura"
+msgstr "evita el lligam de post escriptura"
 
 #: builtin/commit.c:1642
 msgid "ok to record an empty change"
@@ -8067,6 +8088,8 @@ msgid ""
 "combined diff formats('-c' and '--cc') are not supported in\n"
 "directory diff mode('-d' and '--dir-diff')."
 msgstr ""
+"els formats de diff combinats ('-c' and '--cc') no són admesos \n"
+"en el mode diff per directoris ('-d' and '--dir-diff')."
 
 #: builtin/difftool.c:633
 #, c-format
@@ -8120,6 +8143,7 @@ msgid ""
 "make 'git-difftool' exit when an invoked diff tool returns a non - zero exit "
 "code"
 msgstr ""
+"fes que 'git-difftool' surti quan l'eina de diff invocada torna un codi de sortida diferent a zero"
 
 #: builtin/difftool.c:715
 msgid "<command>"
@@ -8282,6 +8306,7 @@ msgid ""
 "default for recursive fetching of submodules (lower priority than config "
 "files)"
 msgstr ""
+"per defecte per a l'obtenció recursiva de submòduls (prioritat més baixa que els fitxers de configuració)"
 
 #: builtin/fetch.c:156 builtin/pull.c:212
 msgid "accept refs that update .git/shallow"
@@ -8984,7 +9009,7 @@ msgstr "escriu l'objecte a la base de dades d'objectes"
 
 #: builtin/hash-object.c:98
 msgid "read the object from stdin"
-msgstr "llegeix l'objecte des d'stdin"
+msgstr "llegeix l'objecte des dstdin"
 
 #: builtin/hash-object.c:100
 msgid "store file as is without filters"
@@ -9414,7 +9439,7 @@ msgstr "--fix-thin no es pot usar sense --stdin"
 
 #: builtin/index-pack.c:1746
 msgid "--stdin requires a git repository"
-msgstr "--stdin requereix d'un dipòsit git"
+msgstr "--stdin requereix un dipòsit git"
 
 #: builtin/index-pack.c:1754
 msgid "--verify with no packfile name given"
@@ -9558,30 +9583,27 @@ msgstr "escurça els remolcs buits"
 
 #: builtin/interpret-trailers.c:96
 msgid "where to place the new trailer"
-msgstr ""
+msgstr "on ubica"
 
 #: builtin/interpret-trailers.c:98
-#, fuzzy
 msgid "action if trailer already exists"
-msgstr "l'arbre de treball '%s' ja existeix."
+msgstr "acció si el Â«trailer» ja existeix"
 
 #: builtin/interpret-trailers.c:100
 msgid "action if trailer is missing"
-msgstr ""
+msgstr "acció si el Â«trailer» falta"
 
 #: builtin/interpret-trailers.c:102
-#, fuzzy
 msgid "output only the trailers"
-msgstr "escurça els remolcs buits"
+msgstr "mostra només els Â«trailer»"
 
 #: builtin/interpret-trailers.c:103
-#, fuzzy
 msgid "do not apply config rules"
-msgstr "cerca les variables de configuració"
+msgstr "no apliquis les regles de configuració"
 
 #: builtin/interpret-trailers.c:104
 msgid "join whitespace-continued values"
-msgstr ""
+msgstr "uneix els valors continus amb espais en blanc"
 
 #: builtin/interpret-trailers.c:105
 msgid "set parsing options"
@@ -9596,9 +9618,8 @@ msgid "trailer(s) to add"
 msgstr "remolcs a afegir"
 
 #: builtin/interpret-trailers.c:117
-#, fuzzy
 msgid "--trailer with --only-input does not make sense"
-msgstr "--name-only no té sentit"
+msgstr "--trailer amb --only-input no té sentit"
 
 #: builtin/interpret-trailers.c:127
 msgid "no input file given for in-place editing"
@@ -10248,9 +10269,8 @@ msgid "allow merging unrelated histories"
 msgstr "permet fusionar històries no relacionades"
 
 #: builtin/merge.c:240
-#, fuzzy
 msgid "verify commit-msg hook"
-msgstr "evita els ganxos de precomissió i missatge de comissió"
+msgstr "verifica el lligam de missatge de comissió"
 
 #: builtin/merge.c:265
 msgid "could not run stash."
@@ -10783,7 +10803,7 @@ msgstr "llista totes les comissions abastables de totes les referències"
 
 #: builtin/name-rev.c:403
 msgid "read from stdin"
-msgstr "llegeix d'stdin"
+msgstr "llegeix dstdin"
 
 #: builtin/name-rev.c:404
 msgid "allow to print `undefined` names (default)"
@@ -11040,7 +11060,7 @@ msgstr "S'està eliminant la nota de l'objecte %s\n"
 
 #: builtin/notes.c:488
 msgid "read objects from stdin"
-msgstr "llegeix els objectes des d'stdin"
+msgstr "llegeix els objectes des dstdin"
 
 #: builtin/notes.c:490
 msgid "load rewriting config for <command> (implies --stdin)"
@@ -11631,7 +11651,7 @@ msgstr "No es pot fer Â«rebase» sobre múltiples branques."
 
 #: builtin/pull.c:912
 msgid "cannot rebase with locally recorded submodule modifications"
-msgstr ""
+msgstr "no es pot fer Â«rebase» amb modificacions als submòduls enregistrades localment"
 
 #: builtin/push.c:17
 msgid "git push [<options>] [<repository> [<refspec>...]]"
@@ -11899,7 +11919,7 @@ msgstr "poda les referències eliminades localment"
 
 #: builtin/push.c:547
 msgid "bypass pre-push hook"
-msgstr "evita el ganxo de prepujada"
+msgstr "evita el lligam de prepujada"
 
 #: builtin/push.c:548
 msgid "push missing but relevant tags"
@@ -12040,13 +12060,12 @@ msgid "check the todo list"
 msgstr "comprova la llista a fer"
 
 #: builtin/rebase--helper.c:36
-#, fuzzy
 msgid "skip unnecessary picks"
-msgstr "No s'ha pogut ometre ordres innecessaris d'elecció"
+msgstr "omet els Â«picks» no necessaris"
 
 #: builtin/rebase--helper.c:38
 msgid "rearrange fixup/squash lines"
-msgstr ""
+msgstr "reorganitza les línies Â«fixup/pick»"
 
 #: builtin/receive-pack.c:29
 msgid "git receive-pack <git-dir>"
@@ -12079,7 +12098,7 @@ msgstr ""
 "recomana això a menys que hàgiu decidit actualitzar el seu arbre en\n"
 "alguna altra manera per a coincidir amb el que hàgiu pujat.\n"
 "\n"
-"Per a silenciar aquest missatge i mantenir el el comportament\n"
+"Per a silenciar aquest missatge i mantenir el comportament\n"
 "predeterminat, establiu la variable de configuració\n"
 "'receive.denyCurrentBranch' a 'refuse'."
 
@@ -12645,6 +12664,8 @@ msgid ""
 "Incremental repacks are incompatible with bitmap indexes.  Use\n"
 "--no-write-bitmap-index or disable the pack.writebitmaps configuration."
 msgstr ""
+"Els re-empaquetaments incrementals són incompatibles amb els Ã­ndexs de bitmaps.  Useu\n"
+"--no-write-bitmap-index o inhabiliteu el paràmetre de configuració pack.writebitmaps."
 
 #: builtin/repack.c:168
 msgid "pack everything in a single pack"
@@ -12906,7 +12927,7 @@ msgstr "restableix HEAD però retén els canvis locals"
 
 #: builtin/reset.c:312
 msgid "record only the fact that removed paths will be added later"
-msgstr "registra només el fet de que els camins eliminats s'afegiran després"
+msgstr "registra només el fet que els camins eliminats s'afegiran després"
 
 #: builtin/reset.c:329
 #, c-format
@@ -13178,7 +13199,7 @@ msgstr "usa el protocol RPC sense estat"
 
 #: builtin/send-pack.c:177
 msgid "read refs from stdin"
-msgstr "llegeix les referències des d'stdin"
+msgstr "llegeix les referències des dstdin"
 
 #: builtin/send-pack.c:178
 msgid "print status from remote helper"
@@ -13190,7 +13211,7 @@ msgstr "git shortlog [<opcions>] [<rang-de-revisions>] [[--] [<camí>...]]"
 
 #: builtin/shortlog.c:263
 msgid "Group by committer rather than author"
-msgstr ""
+msgstr "Agrupa per Â«comiitter» en comptes de per autor"
 
 #: builtin/shortlog.c:265
 msgid "sort output according to the number of commits per author"
@@ -13392,7 +13413,7 @@ msgstr "no imprimeixis els resultats a stdout (útil amb --verify)"
 
 #: builtin/show-ref.c:176
 msgid "show refs from stdin that aren't in local repository"
-msgstr "mostra les referències d'stdin que no siguin en el dipòsit local"
+msgstr "mostra les referències dstdin que no siguin en el dipòsit local"
 
 #: builtin/stripspace.c:18
 msgid "git stripspace [-s | --strip-comments]"
@@ -13445,6 +13466,7 @@ msgid ""
 "could not lookup configuration '%s'. Assuming this repository is its own "
 "authoritative upstream."
 msgstr ""
+"no s'ha pogut trobar la configuració Â«%s». S'assumeix que aquest dipòsit Ã©s el seu dipòsit font autoritzat."
 
 #: builtin/submodule--helper.c:400
 #, c-format
@@ -14126,7 +14148,7 @@ msgstr "stdin té paràmetres acabats amb NUL"
 
 #: builtin/update-ref.c:367
 msgid "read updates from stdin"
-msgstr "llegeix les actualitzacions des d'stdin"
+msgstr "llegeix les actualitzacions des dstdin"
 
 #: builtin/update-server-info.c:7
 msgid "git update-server-info [--force]"
@@ -14209,6 +14231,8 @@ msgid ""
 "Removing worktrees/%s: short read (expected %<PRIuMAX> bytes, read "
 "%<PRIuMAX>)"
 msgstr ""
+"S'estan suprimint els arbres de treball/%s: lectura curta (s'esperaven %<PRIuMAX> bytes, llegits "
+"%<PRIuMAX>)"
 
 #: builtin/worktree.c:84
 #, c-format
@@ -14365,7 +14389,7 @@ msgstr ""
 #: http.c:338
 #, c-format
 msgid "negative value for http.postbuffer; defaulting to %d"
-msgstr ""
+msgstr "valor negatiu per http.postbuffer; utilitzant el valor %d"
 
 #: http.c:359
 msgid "Delegation control is not supported with cURL < 7.22.0"
@@ -14793,7 +14817,7 @@ msgstr "No es pot emmagatzemar $stash_sha1"
 
 #: git-rebase.sh:214
 msgid "The pre-rebase hook refused to rebase."
-msgstr "El ganxo pre-«rebase» ha refusat a fer Â«rebase»."
+msgstr "El lligam pre-«rebase» ha refusat a fer Â«rebase»."
 
 #: git-rebase.sh:219
 msgid "It looks like git-am is in progress. Cannot rebase."
@@ -15044,7 +15068,7 @@ msgstr "L'índex no estava sense emmagatzemar."
 #: git-stash.sh:641
 msgid "The stash entry is kept in case you need it again."
 msgstr ""
-"Es conserva l'entrada Â«stash» en cas de que la necessiteu altra vegada."
+"Es conserva l'entrada Â«stash» en cas que la necessiteu altra vegada."
 
 #: git-stash.sh:650
 #, sh-format
@@ -15489,8 +15513,8 @@ msgid ""
 msgstr ""
 "No s'ha pogut esmenar la comissió després d'escollir amb Ã¨xit $sha1... "
 "$rest\n"
-"Això Ã©s probablement a causa d'un missatge de comissió buit, o el ganxo de\n"
-"precomissió ha fallat. Si el ganxo de precomissió ha fallat, pot ser que\n"
+"Això Ã©s probablement a causa d'un missatge de comissió buit, o el lligam de\n"
+"precomissió ha fallat. Si el lligam de precomissió ha fallat, pot ser que\n"
 "necessiteu resoldre el problema abans que pugueu canviar el missatge de\n"
 "comissió."
 
@@ -15741,7 +15765,7 @@ msgstr "No s'ha pogut determinar el camí absolut del directori de git"
 #: git-add--interactive.perl:196
 #, perl-format
 msgid "%12s %12s %s"
-msgstr ""
+msgstr "%12s %12s %s"
 
 #: git-add--interactive.perl:197
 msgid "staged"
@@ -15955,6 +15979,12 @@ msgid ""
 "a - apply this hunk and all later hunks in the file\n"
 "d - do not apply this hunk or any of the later hunks in the file"
 msgstr ""
+"y - aplica aquest tros a l'índex\n"
+"n - no apliquis aquest tros a l'índex\n"
+"q - surt; no apliquis aquest tros ni cap dels pendents\n"
+"a - aplica aquest tros i tots els trossos posteriors en el fitxer\n"
+"d - no apliquis aquest tros ni cap dels trossos posteriors en el fitxer"
+
 
 #: git-add--interactive.perl:1167
 msgid ""
@@ -15964,6 +15994,11 @@ msgid ""
 "a - discard this hunk and all later hunks in the file\n"
 "d - do not discard this hunk or any of the later hunks in the file"
 msgstr ""
+"y - descarta aquest tros de l'arbre de treball\n"
+"n - no descartis aquest tros des de l'arbre de treball\n"
+"q - surt; no apliquis aquest tros ni cap dels pendents\n"
+"a - descarta aquest tros i tots els trossos posteriors en el fitxer\n"
+"d - no descartis aquest tros ni cap dels trossos posteriors en el fitxer"
 
 #: git-add--interactive.perl:1173
 msgid ""
@@ -15973,6 +16008,11 @@ msgid ""
 "a - discard this hunk and all later hunks in the file\n"
 "d - do not discard this hunk or any of the later hunks in the file"
 msgstr ""
+"y - descarta aquest tros de l'índex i de l'arbre de treball\n"
+"n - no descartis aquest tros des de l'índex i de l'arbre de treball\n"
+"q - surt; no apliquis aquest tros ni cap dels pendents\n"
+"a - descarta aquest tros i tots els trossos posteriors en el fitxer\n"
+"d - no descartis aquest tros ni cap dels trossos posteriors en el fitxer"
 
 #: git-add--interactive.perl:1179
 msgid ""
@@ -15982,6 +16022,11 @@ msgid ""
 "a - apply this hunk and all later hunks in the file\n"
 "d - do not apply this hunk or any of the later hunks in the file"
 msgstr ""
+"y - aplica aquest tros a l'índex i l'arbre de treball\n"
+"n - no apliquis aquest tros des de l'índex i de l'arbre de treball\n"
+"q - surt; no apliquis aquest tros ni cap dels pendents\n"
+"a - aplica aquest tros i tots els trossos posteriors en el fitxer\n"
+"d - no apliquis aquest tros ni cap dels trossos posteriors en el fitxer"
 
 #: git-add--interactive.perl:1188
 msgid ""
@@ -15995,6 +16040,15 @@ msgid ""
 "e - manually edit the current hunk\n"
 "? - print help\n"
 msgstr ""
+"g - selecciona el tros on voleu anar\n"
+"/ - cerca un tros que coincideixi amb l'expressió regular donada\n"
+"j - deixa aquest tros sense decidir, veure el tros sense decidir següent\n"
+"J - deixa aquest tros sense decidir, veure el tros següent\n"
+"k - deixa aquest tros sense decidir, veure el tros sense decidir anterior\n"
+"K - deixa aquest tros sense decidir, veure el tros anterior\n"
+"s - divideix el tros actual en trossos més petits\n"
+"e - edita manualment el tros actual\n"
+"? - mostra l'ajuda\n"
 
 #: git-add--interactive.perl:1219
 msgid "The selected hunks do not apply to the index!\n"
@@ -16200,6 +16254,12 @@ msgid ""
 "add untracked - add contents of untracked files to the staged set of "
 "changes\n"
 msgstr ""
+"status        - mostra els camins amb canvis\n"
+"update        - afegeix l'estat de l'arbre de treball al conjunt de canvis Â«staged»\n"
+"revert        - reverteix el conjunt de canvis de Â«staged» a la versió HEAD\n"
+"patch         - selecciona trossos i actualitza'ls selectivament\n"
+"diff          - mostra la diferència entre HEAD i l'índex\n"
+"add untracked - afegeix el contingut dels fitxers no seguits al conjunt de canvis Â«staged»\n"
 
 #: git-add--interactive.perl:1641 git-add--interactive.perl:1646
 #: git-add--interactive.perl:1649 git-add--interactive.perl:1656
@@ -16386,6 +16446,11 @@ msgid ""
 "want to send.\n"
 msgstr ""
 
+"S'ha refusat a enviar perquè el pedaç\n"
+"\t%s\n"
+"perquè la plantilla té l'assumpte '*** SUBJECT HERE ***'. Passeu --force si realment "
+"voleu enviar-lo.\n"
+
 #: git-send-email.perl:847
 msgid "To whom should the emails be sent (if anyone)?"
 msgstr ""
@@ -16466,7 +16531,7 @@ msgstr "El servidor no admet STARTTLS! %s"
 #: git-send-email.perl:1431 git-send-email.perl:1435
 #, perl-format
 msgid "STARTTLS failed! %s"
-msgstr ""
+msgstr "STARTTLS ha fallat! %s"
 
 #: git-send-email.perl:1445
 msgid "Unable to initialize SMTP properly. Check config and use --smtp-debug."
index 014dabb0bf3647b9392d6087ebf6c40e1bc68108..8cc1e07fdb7204d13c99826304317c66d4249cf5 100644 (file)
@@ -2570,7 +2570,7 @@ static int files_transaction_prepare(struct ref_store *ref_store,
                ret = lock_ref_for_update(refs, update, transaction,
                                          head_ref, &affected_refnames, err);
                if (ret)
-                       break;
+                       goto cleanup;
 
                if (update->flags & REF_DELETING &&
                    !(update->flags & REF_LOG_ONLY) &&
index f2a10cc4f24c10adf072eb26ba427f00037b3c79..332a383b037d2a24627a2c833aae163dc05665f8 100644 (file)
@@ -1862,12 +1862,15 @@ static int error_failed_squash(struct commit *commit,
 
 static int do_exec(const char *command_line)
 {
+       struct argv_array child_env = ARGV_ARRAY_INIT;
        const char *child_argv[] = { NULL, NULL };
        int dirty, status;
 
        fprintf(stderr, "Executing: %s\n", command_line);
        child_argv[0] = command_line;
-       status = run_command_v_opt(child_argv, RUN_USING_SHELL);
+       argv_array_pushf(&child_env, "GIT_DIR=%s", absolute_path(get_git_dir()));
+       status = run_command_v_opt_cd_env(child_argv, RUN_USING_SHELL, NULL,
+                                         child_env.argv);
 
        /* force re-reading of the cache */
        if (discard_cache() < 0 || read_cache() < 0)
@@ -1897,6 +1900,8 @@ static int do_exec(const char *command_line)
                status = 1;
        }
 
+       argv_array_clear(&child_env);
+
        return status;
 }
 
index c7c5ab376ccb56b3a4f4533f61293bd543ea8097..603e667faa6b935ed5c44fc7d67188088bdfaa84 100644 (file)
@@ -1331,7 +1331,10 @@ void strbuf_branchname(struct strbuf *sb, const char *name, unsigned allowed)
 
 int strbuf_check_branch_ref(struct strbuf *sb, const char *name)
 {
-       strbuf_branchname(sb, name, INTERPRET_BRANCH_LOCAL);
+       if (startup_info->have_repository)
+               strbuf_branchname(sb, name, INTERPRET_BRANCH_LOCAL);
+       else
+               strbuf_addstr(sb, name);
        if (name[0] == '-')
                return -1;
        strbuf_splice(sb, 0, 0, "refs/heads/", 11);
index 05d8c4d8af093ad42d855b17d243fe07b8893bfb..6ec2670044d205533594947547fce8255de5aa4c 100644 (file)
@@ -135,7 +135,7 @@ static int cmd_resolve_ref(struct ref_store *refs, const char **argv)
 
        ref = refs_resolve_ref_unsafe(refs, refname, resolve_flags,
                                      sha1, &flags);
-       printf("%s %s 0x%x\n", sha1_to_hex(sha1), ref, flags);
+       printf("%s %s 0x%x\n", sha1_to_hex(sha1), ref ? ref : "(null)", flags);
        return ref ? 0 : 1;
 }
 
index 0790edf60de2d0324ea4752087f03db1113d822e..98e4a8613ba8ab4aebe99360e89c21be2ce3473d 100755 (executable)
@@ -144,6 +144,11 @@ test_expect_success "check-ref-format --branch @{-1}" '
        refname2=$(git check-ref-format --branch @{-2}) &&
        test "$refname2" = master'
 
+test_expect_success 'check-ref-format --branch -naster' '
+       test_must_fail git check-ref-format --branch -naster >actual &&
+       test_must_be_empty actual
+'
+
 test_expect_success 'check-ref-format --branch from subdir' '
        mkdir subdir &&
 
@@ -161,6 +166,17 @@ test_expect_success 'check-ref-format --branch from subdir' '
        test "$refname" = "$sha1"
 '
 
+test_expect_success 'check-ref-format --branch @{-1} from non-repo' '
+       nongit test_must_fail git check-ref-format --branch @{-1} >actual &&
+       test_must_be_empty actual
+'
+
+test_expect_success 'check-ref-format --branch master from non-repo' '
+       echo master >expect &&
+       nongit git check-ref-format --branch master >actual &&
+       test_cmp expect actual
+'
+
 valid_ref_normalized() {
        prereq=
        case $1 in
index 100d50e3623c2eb4b3498dd87f95402617c6d737..3a887b511340b50a0cadcf1968a8c0986d67d66c 100755 (executable)
@@ -34,6 +34,81 @@ test_update_rejected () {
 
 Q="'"
 
+# Test adding and deleting D/F-conflicting references in a single
+# transaction.
+df_test() {
+       prefix="$1"
+       pack=: symadd=false symdel=false add_del=false addref= delref=
+       shift
+       while test $# -gt 0
+       do
+               case "$1" in
+               --pack)
+                       pack="git pack-refs --all"
+                       shift
+                       ;;
+               --sym-add)
+                       # Perform the add via a symbolic reference
+                       symadd=true
+                       shift
+                       ;;
+               --sym-del)
+                       # Perform the del via a symbolic reference
+                       symdel=true
+                       shift
+                       ;;
+               --del-add)
+                       # Delete first reference then add second
+                       add_del=false
+                       delref="$prefix/r/$2"
+                       addref="$prefix/r/$3"
+                       shift 3
+                       ;;
+               --add-del)
+                       # Add first reference then delete second
+                       add_del=true
+                       addref="$prefix/r/$2"
+                       delref="$prefix/r/$3"
+                       shift 3
+                       ;;
+               *)
+                       echo 1>&2 "Extra args to df_test: $*"
+                       return 1
+                       ;;
+               esac
+       done
+       git update-ref "$delref" $C &&
+       if $symadd
+       then
+               addname="$prefix/s/symadd" &&
+               git symbolic-ref "$addname" "$addref"
+       else
+               addname="$addref"
+       fi &&
+       if $symdel
+       then
+               delname="$prefix/s/symdel" &&
+               git symbolic-ref "$delname" "$delref"
+       else
+               delname="$delref"
+       fi &&
+       cat >expected-err <<-EOF &&
+       fatal: cannot lock ref $Q$addname$Q: $Q$delref$Q exists; cannot create $Q$addref$Q
+       EOF
+       $pack &&
+       if $add_del
+       then
+               printf "%s\n" "create $addname $D" "delete $delname"
+       else
+               printf "%s\n" "delete $delname" "create $addname $D"
+       fi >commands &&
+       test_must_fail git update-ref --stdin <commands 2>output.err &&
+       test_cmp expected-err output.err &&
+       printf "%s\n" "$C $delref" >expected-refs &&
+       git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
+       test_cmp expected-refs actual-refs
+}
+
 test_expect_success 'setup' '
 
        git commit --allow-empty -m Initial &&
@@ -188,6 +263,72 @@ test_expect_success 'empty directory should not fool 1-arg delete' '
        git update-ref --stdin
 '
 
+test_expect_success 'D/F conflict prevents add long + delete short' '
+       df_test refs/df-al-ds --add-del foo/bar foo
+'
+
+test_expect_success 'D/F conflict prevents add short + delete long' '
+       df_test refs/df-as-dl --add-del foo foo/bar
+'
+
+test_expect_success 'D/F conflict prevents delete long + add short' '
+       df_test refs/df-dl-as --del-add foo/bar foo
+'
+
+test_expect_success 'D/F conflict prevents delete short + add long' '
+       df_test refs/df-ds-al --del-add foo foo/bar
+'
+
+test_expect_success 'D/F conflict prevents add long + delete short packed' '
+       df_test refs/df-al-dsp --pack --add-del foo/bar foo
+'
+
+test_expect_success 'D/F conflict prevents add short + delete long packed' '
+       df_test refs/df-as-dlp --pack --add-del foo foo/bar
+'
+
+test_expect_success 'D/F conflict prevents delete long packed + add short' '
+       df_test refs/df-dlp-as --pack --del-add foo/bar foo
+'
+
+test_expect_success 'D/F conflict prevents delete short packed + add long' '
+       df_test refs/df-dsp-al --pack --del-add foo foo/bar
+'
+
+# Try some combinations involving symbolic refs...
+
+test_expect_success 'D/F conflict prevents indirect add long + delete short' '
+       df_test refs/df-ial-ds --sym-add --add-del foo/bar foo
+'
+
+test_expect_success 'D/F conflict prevents indirect add long + indirect delete short' '
+       df_test refs/df-ial-ids --sym-add --sym-del --add-del foo/bar foo
+'
+
+test_expect_success 'D/F conflict prevents indirect add short + indirect delete long' '
+       df_test refs/df-ias-idl --sym-add --sym-del --add-del foo foo/bar
+'
+
+test_expect_success 'D/F conflict prevents indirect delete long + indirect add short' '
+       df_test refs/df-idl-ias --sym-add --sym-del --del-add foo/bar foo
+'
+
+test_expect_success 'D/F conflict prevents indirect add long + delete short packed' '
+       df_test refs/df-ial-dsp --sym-add --pack --add-del foo/bar foo
+'
+
+test_expect_success 'D/F conflict prevents indirect add long + indirect delete short packed' '
+       df_test refs/df-ial-idsp --sym-add --sym-del --pack --add-del foo/bar foo
+'
+
+test_expect_success 'D/F conflict prevents add long + indirect delete short packed' '
+       df_test refs/df-al-idsp --sym-del --pack --add-del foo/bar foo
+'
+
+test_expect_success 'D/F conflict prevents indirect delete long packed + indirect add short' '
+       df_test refs/df-idlp-ias --sym-add --sym-del --pack --del-add foo/bar foo
+'
+
 # Test various errors when reading the old values of references...
 
 test_expect_success 'missing old value blocks update' '
index 3704dbb2ecf6046e09adb03b451e4e531509b2f4..6a82d1ed876dd5d1073dc63be8ba5720adbf12e3 100755 (executable)
@@ -108,6 +108,17 @@ test_expect_success 'rebase -i with the exec command runs from tree root' '
        rm -fr subdir
 '
 
+test_expect_success 'rebase -i with exec allows git commands in subdirs' '
+       test_when_finished "rm -rf subdir" &&
+       test_when_finished "git rebase --abort ||:" &&
+       git checkout master &&
+       mkdir subdir && (cd subdir &&
+       set_fake_editor &&
+       FAKE_LINES="1 exec_cd_subdir_&&_git_rev-parse_--is-inside-work-tree" \
+               git rebase -i HEAD^
+       )
+'
+
 test_expect_success 'rebase -i with the exec command checks tree cleanness' '
        git checkout master &&
        set_fake_editor &&
index 87083f728fed1be9d93d971419ac533ee5314d4f..6c9a93b734542cc17fa1591525dc3c49019b77fe 100755 (executable)
@@ -1318,30 +1318,38 @@ test_expect_success 'no effect from --color-moved with --word-diff' '
        test_cmp expect actual
 '
 
-test_expect_success 'move detection ignoring whitespace ' '
+test_expect_success 'set up whitespace tests' '
        git reset --hard &&
-       cat <<\EOF >lines.txt &&
-line 1
-line 2
-line 3
-line 4
-long line 5
-long line 6
-long line 7
-EOF
-       git add lines.txt &&
-       git commit -m "add poetry" &&
-       cat <<\EOF >lines.txt &&
-       long line 5
+       # Note that these lines have no leading or trailing whitespace.
+       cat <<-\EOF >lines.txt &&
+       line 1
+       line 2
+       line 3
+       line 4
+       line 5
        long line 6
        long line 7
-line 1
-line 2
-line 3
-line 4
-EOF
-       test_config color.diff.oldMoved "magenta" &&
-       test_config color.diff.newMoved "cyan" &&
+       long line 8
+       long line 9
+       EOF
+       git add lines.txt &&
+       git commit -m "add poetry" &&
+       git config color.diff.oldMoved "magenta" &&
+       git config color.diff.newMoved "cyan"
+'
+
+test_expect_success 'move detection ignoring whitespace ' '
+       q_to_tab <<-\EOF >lines.txt &&
+       Qlong line 6
+       Qlong line 7
+       Qlong line 8
+       Qchanged long line 9
+       line 1
+       line 2
+       line 3
+       line 4
+       line 5
+       EOF
        git diff HEAD --no-renames --color-moved --color |
                grep -v "index" |
                test_decode_color >actual &&
@@ -1349,17 +1357,20 @@ EOF
        <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
        <BOLD>--- a/lines.txt<RESET>
        <BOLD>+++ b/lines.txt<RESET>
-       <CYAN>@@ -1,7 +1,7 @@<RESET>
-       <GREEN>+<RESET> <GREEN>long line 5<RESET>
+       <CYAN>@@ -1,9 +1,9 @@<RESET>
        <GREEN>+<RESET> <GREEN>long line 6<RESET>
        <GREEN>+<RESET> <GREEN>long line 7<RESET>
+       <GREEN>+<RESET> <GREEN>long line 8<RESET>
+       <GREEN>+<RESET> <GREEN>changed long line 9<RESET>
         line 1<RESET>
         line 2<RESET>
         line 3<RESET>
         line 4<RESET>
-       <RED>-long line 5<RESET>
+        line 5<RESET>
        <RED>-long line 6<RESET>
        <RED>-long line 7<RESET>
+       <RED>-long line 8<RESET>
+       <RED>-long line 9<RESET>
        EOF
        test_cmp expected actual &&
 
@@ -1370,21 +1381,160 @@ EOF
        <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
        <BOLD>--- a/lines.txt<RESET>
        <BOLD>+++ b/lines.txt<RESET>
-       <CYAN>@@ -1,7 +1,7 @@<RESET>
-       <CYAN>+<RESET>  <CYAN>long line 5<RESET>
+       <CYAN>@@ -1,9 +1,9 @@<RESET>
        <CYAN>+<RESET>  <CYAN>long line 6<RESET>
        <CYAN>+<RESET>  <CYAN>long line 7<RESET>
+       <CYAN>+<RESET>  <CYAN>long line 8<RESET>
+       <GREEN>+<RESET> <GREEN>changed long line 9<RESET>
+        line 1<RESET>
+        line 2<RESET>
+        line 3<RESET>
+        line 4<RESET>
+        line 5<RESET>
+       <MAGENTA>-long line 6<RESET>
+       <MAGENTA>-long line 7<RESET>
+       <MAGENTA>-long line 8<RESET>
+       <RED>-long line 9<RESET>
+       EOF
+       test_cmp expected actual
+'
+
+test_expect_success 'move detection ignoring whitespace changes' '
+       git reset --hard &&
+       # Lines 6-8 have a space change, but 9 is new whitespace
+       q_to_tab <<-\EOF >lines.txt &&
+       longQline 6
+       longQline 7
+       longQline 8
+       long liQne 9
+       line 1
+       line 2
+       line 3
+       line 4
+       line 5
+       EOF
+
+       git diff HEAD --no-renames --color-moved --color |
+               grep -v "index" |
+               test_decode_color >actual &&
+       cat <<-\EOF >expected &&
+       <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
+       <BOLD>--- a/lines.txt<RESET>
+       <BOLD>+++ b/lines.txt<RESET>
+       <CYAN>@@ -1,9 +1,9 @@<RESET>
+       <GREEN>+<RESET><GREEN>long      line 6<RESET>
+       <GREEN>+<RESET><GREEN>long      line 7<RESET>
+       <GREEN>+<RESET><GREEN>long      line 8<RESET>
+       <GREEN>+<RESET><GREEN>long li   ne 9<RESET>
+        line 1<RESET>
+        line 2<RESET>
+        line 3<RESET>
+        line 4<RESET>
+        line 5<RESET>
+       <RED>-long line 6<RESET>
+       <RED>-long line 7<RESET>
+       <RED>-long line 8<RESET>
+       <RED>-long line 9<RESET>
+       EOF
+       test_cmp expected actual &&
+
+       git diff HEAD --no-renames -b --color-moved --color |
+               grep -v "index" |
+               test_decode_color >actual &&
+       cat <<-\EOF >expected &&
+       <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
+       <BOLD>--- a/lines.txt<RESET>
+       <BOLD>+++ b/lines.txt<RESET>
+       <CYAN>@@ -1,9 +1,9 @@<RESET>
+       <CYAN>+<RESET><CYAN>long        line 6<RESET>
+       <CYAN>+<RESET><CYAN>long        line 7<RESET>
+       <CYAN>+<RESET><CYAN>long        line 8<RESET>
+       <GREEN>+<RESET><GREEN>long li   ne 9<RESET>
+        line 1<RESET>
+        line 2<RESET>
+        line 3<RESET>
+        line 4<RESET>
+        line 5<RESET>
+       <MAGENTA>-long line 6<RESET>
+       <MAGENTA>-long line 7<RESET>
+       <MAGENTA>-long line 8<RESET>
+       <RED>-long line 9<RESET>
+       EOF
+       test_cmp expected actual
+'
+
+test_expect_success 'move detection ignoring whitespace at eol' '
+       git reset --hard &&
+       # Lines 6-9 have new eol whitespace, but 9 also has it in the middle
+       q_to_tab <<-\EOF >lines.txt &&
+       long line 6Q
+       long line 7Q
+       long line 8Q
+       longQline 9Q
+       line 1
+       line 2
+       line 3
+       line 4
+       line 5
+       EOF
+
+       # avoid cluttering the output with complaints about our eol whitespace
+       test_config core.whitespace -blank-at-eol &&
+
+       git diff HEAD --no-renames --color-moved --color |
+               grep -v "index" |
+               test_decode_color >actual &&
+       cat <<-\EOF >expected &&
+       <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
+       <BOLD>--- a/lines.txt<RESET>
+       <BOLD>+++ b/lines.txt<RESET>
+       <CYAN>@@ -1,9 +1,9 @@<RESET>
+       <GREEN>+<RESET><GREEN>long line 6       <RESET>
+       <GREEN>+<RESET><GREEN>long line 7       <RESET>
+       <GREEN>+<RESET><GREEN>long line 8       <RESET>
+       <GREEN>+<RESET><GREEN>long      line 9  <RESET>
+        line 1<RESET>
+        line 2<RESET>
+        line 3<RESET>
+        line 4<RESET>
+        line 5<RESET>
+       <RED>-long line 6<RESET>
+       <RED>-long line 7<RESET>
+       <RED>-long line 8<RESET>
+       <RED>-long line 9<RESET>
+       EOF
+       test_cmp expected actual &&
+
+       git diff HEAD --no-renames --ignore-space-at-eol --color-moved --color |
+               grep -v "index" |
+               test_decode_color >actual &&
+       cat <<-\EOF >expected &&
+       <BOLD>diff --git a/lines.txt b/lines.txt<RESET>
+       <BOLD>--- a/lines.txt<RESET>
+       <BOLD>+++ b/lines.txt<RESET>
+       <CYAN>@@ -1,9 +1,9 @@<RESET>
+       <CYAN>+<RESET><CYAN>long line 6 <RESET>
+       <CYAN>+<RESET><CYAN>long line 7 <RESET>
+       <CYAN>+<RESET><CYAN>long line 8 <RESET>
+       <GREEN>+<RESET><GREEN>long      line 9  <RESET>
         line 1<RESET>
         line 2<RESET>
         line 3<RESET>
         line 4<RESET>
-       <MAGENTA>-long line 5<RESET>
+        line 5<RESET>
        <MAGENTA>-long line 6<RESET>
        <MAGENTA>-long line 7<RESET>
+       <MAGENTA>-long line 8<RESET>
+       <RED>-long line 9<RESET>
        EOF
        test_cmp expected actual
 '
 
+test_expect_success 'clean up whitespace-test colors' '
+       git config --unset color.diff.oldMoved &&
+       git config --unset color.diff.newMoved
+'
+
 test_expect_success '--color-moved block at end of diff output respects MIN_ALNUM_COUNT' '
        git reset --hard &&
        >bar &&
@@ -1530,13 +1680,4 @@ test_expect_success 'move detection with submodules' '
        test_cmp expect decoded_actual
 '
 
-test_expect_success 'move detection with whitespace changes' '
-       test_when_finished "git reset --hard" &&
-       test_seq 10 >test &&
-       git add test &&
-       sed s/3/42/ <test >test.tmp &&
-       mv test.tmp test &&
-       git -c diff.colormoved diff --ignore-space-change -- test
-'
-
 test_done
index 9c56f771b619e4bb931ce3d34a5f9325b8f61e90..50e40abb11e1d317a2a58321f1007dde925c8da2 100755 (executable)
@@ -308,6 +308,7 @@ test_expect_success 'clone checking out a tag' '
 
 setup_ssh_wrapper () {
        test_expect_success 'setup ssh wrapper' '
+               rm -f "$TRASH_DIRECTORY/ssh-wrapper$X" &&
                cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" \
                        "$TRASH_DIRECTORY/ssh-wrapper$X" &&
                GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper$X" &&
@@ -318,6 +319,7 @@ setup_ssh_wrapper () {
 }
 
 copy_ssh_wrapper_as () {
+       rm -f "${1%$X}$X" &&
        cp "$TRASH_DIRECTORY/ssh-wrapper$X" "${1%$X}$X" &&
        GIT_SSH="${1%$X}$X" &&
        export GIT_SSH
index f0f1abd1c23d4303a686310d7325cd523d6c921b..865168ec6a7be7fc7778419f2dd1066e9c80c1bc 100755 (executable)
@@ -570,4 +570,18 @@ test_expect_success 'command with underscores does not complain' '
        test_cmp expect actual
 '
 
+test_expect_success TTY 'git tag with auto-columns ' '
+       test_commit one &&
+       test_commit two &&
+       test_commit three &&
+       test_commit four &&
+       test_commit five &&
+       cat >expect <<-\EOF &&
+       initial  one      two      three    four     five
+       EOF
+       test_terminal env PAGER="cat >actual" COLUMNS=80 \
+               git -c column.ui=auto tag --sort=authordate &&
+       test_cmp expect actual
+'
+
 test_done
index fc6013ba3c83aa7243f15595bc7b6ddd8b8f46dc..0c394cf995cbcf17b1ebd8f38e73a0740e3e00b7 100755 (executable)
@@ -272,4 +272,15 @@ test_expect_success 'status ignored tracked directory with uncommitted file in t
        test_cmp expected actual
 '
 
+cat >expected <<\EOF
+!! tracked/submodule/
+EOF
+
+test_expect_success 'status ignores submodule in excluded directory' '
+       git init tracked/submodule &&
+       test_commit -C tracked/submodule initial &&
+       git status --porcelain --ignored -u tracked/submodule >actual &&
+       test_cmp expected actual
+'
+
 test_done
index 70015629dc69e4bdf7f8ef1973596f3360898da3..f8c40f2f5f8ce5b18c976b5281f5618adbeee4a7 100644 (file)
@@ -327,7 +327,8 @@ const struct worktree *find_shared_symref(const char *symref,
                refs = get_worktree_ref_store(wt);
                symref_target = refs_resolve_ref_unsafe(refs, symref, 0,
                                                        NULL, &flags);
-               if ((flags & REF_ISSYMREF) && !strcmp(symref_target, target)) {
+               if ((flags & REF_ISSYMREF) &&
+                   symref_target && !strcmp(symref_target, target)) {
                        existing = wt;
                        break;
                }
index 018e03308921e3b44bb75b8bc1e005424ca4fc1b..770e1f7f8185e05f2618c261b70a5773041432fb 100644 (file)
@@ -5,6 +5,7 @@
 #include "xdiff/xdiffi.h"
 #include "xdiff/xemit.h"
 #include "xdiff/xmacros.h"
+#include "xdiff/xutils.h"
 
 struct xdiff_emit_state {
        xdiff_emit_consume_fn consume;
@@ -296,6 +297,17 @@ void xdiff_clear_find_func(xdemitconf_t *xecfg)
        }
 }
 
+unsigned long xdiff_hash_string(const char *s, size_t len, long flags)
+{
+       return xdl_hash_record(&s, s + len, flags);
+}
+
+int xdiff_compare_lines(const char *l1, long s1,
+                       const char *l2, long s2, long flags)
+{
+       return xdl_recmatch(l1, s1, l2, s2, flags);
+}
+
 int git_xmerge_style = -1;
 
 int git_xmerge_config(const char *var, const char *value, void *cb)
index 6f6ba9095df1f81c975652ce515c451649974145..135fc05d72e8f066a63902785d12485a656efa97 100644 (file)
@@ -29,4 +29,20 @@ extern void xdiff_clear_find_func(xdemitconf_t *xecfg);
 extern int git_xmerge_config(const char *var, const char *value, void *cb);
 extern int git_xmerge_style;
 
+/*
+ * Compare the strings l1 with l2 which are of size s1 and s2 respectively.
+ * Returns 1 if the strings are deemed equal, 0 otherwise.
+ * The `flags` given as XDF_WHITESPACE_FLAGS determine how white spaces
+ * are treated for the comparision.
+ */
+extern int xdiff_compare_lines(const char *l1, long s1,
+                              const char *l2, long s2, long flags);
+
+/*
+ * Returns a hash of the string s of length len.
+ * The `flags` given as XDF_WHITESPACE_FLAGS determine how white spaces
+ * are treated for the hash.
+ */
+extern unsigned long xdiff_hash_string(const char *s, size_t len, long flags);
+
 #endif