diff options
33 files changed, 591 insertions, 196 deletions
diff --git a/.travis.yml b/.travis.yml index fead995edd..281f101f31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Documentation/RelNotes/2.15.0.txt b/Documentation/RelNotes/2.15.0.txt index 541815ee34..248ba70c3d 100644 --- a/Documentation/RelNotes/2.15.0.txt +++ b/Documentation/RelNotes/2.15.0.txt @@ -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). diff --git a/Documentation/git-check-ref-format.txt b/Documentation/git-check-ref-format.txt index 92777cef25..cf0a0b7df2 100644 --- a/Documentation/git-check-ref-format.txt +++ b/Documentation/git-check-ref-format.txt @@ -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 diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt index 83f86b9231..4edd09fc6b 100644 --- a/Documentation/git-config.txt +++ b/Documentation/git-config.txt @@ -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:: diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 0917b8207b..95326b85ff 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -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 diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index 7d860bfca1..13501e1556 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -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. diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 9ef24f24d8..a9dbc3f12c 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v2.15.0-rc2 +DEF_VER=v2.15.0 LF=' ' diff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c index 6c40ff110b..bc67d3f0a8 100644 --- a/builtin/check-ref-format.c +++ b/builtin/check-ref-format.c @@ -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; } diff --git a/builtin/commit.c b/builtin/commit.c index d75b3805ea..b2a6c7f100 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -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 diff --git a/builtin/grep.c b/builtin/grep.c index 2d65f27d01..5a6cfe6b45 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -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; diff --git a/builtin/remote.c b/builtin/remote.c index 4f5cac96b0..bc89623695 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -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; diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh index a29246af35..5bd06fe900 100755 --- a/ci/install-dependencies.sh +++ b/ci/install-dependencies.sh @@ -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) diff --git a/ci/lib-travisci.sh b/ci/lib-travisci.sh index b3ed0a0dda..ac05f1f469 100755 --- a/ci/lib-travisci.sh +++ b/ci/lib-travisci.sh @@ -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 @@ -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; @@ -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; @@ -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; } diff --git a/log-tree.c b/log-tree.c index cea056234d..580b3a98a0 100644 --- a/log-tree.c +++ b/log-tree.c @@ -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/")) @@ -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; @@ -11,16 +11,18 @@ # 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 de stdin" #: 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 de stdin" #: 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 de stdin" #: 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 de stdin" #: 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 de stdin" #: 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 de stdin" #: 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 de stdin" #: 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 de stdin 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 de stdin" #: 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." diff --git a/refs/files-backend.c b/refs/files-backend.c index 014dabb0bf..8cc1e07fdb 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -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) && diff --git a/sequencer.c b/sequencer.c index f2a10cc4f2..332a383b03 100644 --- a/sequencer.c +++ b/sequencer.c @@ -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; } diff --git a/sha1_name.c b/sha1_name.c index c7c5ab376c..603e667faa 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -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); diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c index 05d8c4d8af..6ec2670044 100644 --- a/t/helper/test-ref-store.c +++ b/t/helper/test-ref-store.c @@ -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; } diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh index 0790edf60d..98e4a8613b 100755 --- a/t/t1402-check-ref-format.sh +++ b/t/t1402-check-ref-format.sh @@ -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 diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh index 100d50e362..3a887b5113 100755 --- a/t/t1404-update-ref-errors.sh +++ b/t/t1404-update-ref-errors.sh @@ -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' ' diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 3704dbb2ec..6a82d1ed87 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -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 && diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index 87083f728f..6c9a93b734 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -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 diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 9c56f771b6..50e40abb11 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -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 diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh index f0f1abd1c2..865168ec6a 100755 --- a/t/t7006-pager.sh +++ b/t/t7006-pager.sh @@ -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 diff --git a/t/t7061-wtstatus-ignore.sh b/t/t7061-wtstatus-ignore.sh index fc6013ba3c..0c394cf995 100755 --- a/t/t7061-wtstatus-ignore.sh +++ b/t/t7061-wtstatus-ignore.sh @@ -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 diff --git a/worktree.c b/worktree.c index 70015629dc..f8c40f2f5f 100644 --- a/worktree.c +++ b/worktree.c @@ -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; } diff --git a/xdiff-interface.c b/xdiff-interface.c index 018e033089..770e1f7f81 100644 --- a/xdiff-interface.c +++ b/xdiff-interface.c @@ -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) diff --git a/xdiff-interface.h b/xdiff-interface.h index 6f6ba9095d..135fc05d72 100644 --- a/xdiff-interface.h +++ b/xdiff-interface.h @@ -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 |