Merge branch 'master' of git://github.com/git-l10n/git-po
authorJiang Xin <worldhello.net@gmail.com>
Tue, 22 Nov 2016 14:08:47 +0000 (22:08 +0800)
committerJiang Xin <worldhello.net@gmail.com>
Tue, 22 Nov 2016 14:08:47 +0000 (22:08 +0800)
* 'master' of git://github.com/git-l10n/git-po:
l10n: zh_CN: for git v2.11.0 l10n round 1
l10n: pt_PT: update Portuguese translation
l10n: fr.po fix grammar mistakes
l10n: fr.po v2.11.0_rnd1
l10n: sv.po: Update Swedish translation (2913t0f0u)
l10n: vi.po: Updated translation to v2.11.0 (2913t)
l10n: ko.po: Update Korean translation
l10n: git.pot: v2.11.0 round 1 (209 new, 53 removed)
l10n: ru.po: update Russian translation

25 files changed:
.travis.yml
Documentation/RelNotes/2.11.0.txt
Documentation/git-worktree.txt
Documentation/gitrepository-layout.txt
GIT-VERSION-GEN
Makefile
branch.c
branch.h
builtin/branch.c
builtin/checkout.c
contrib/coccinelle/object_id.cocci
diff.c
diffcore-break.c
diffcore-delta.c
diffcore-rename.c
diffcore.h
fetch-pack.c
sequencer.c
sha1_file.c
sha1_name.c
split-index.c
t/t0021-conversion.sh
t/t0021/rot13-filter.pl [changed mode: 0755->0644]
t/t5615-alternate-env.sh [new file with mode: 0755]
t/t6026-merge-attr.sh
index 9a65514d829987eb8a0274c12f094381d90e87be..0b2ea5c3e2daa057cb88763f1943f6a250d019d9 100644 (file)
@@ -32,7 +32,6 @@ env:
     - DEFAULT_TEST_TARGET=prove
     - GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
     - GIT_TEST_OPTS="--verbose-log"
-    - GIT_TEST_HTTPD=true
     - GIT_TEST_CLONE_2GB=YesPlease
     # t9810 occasionally fails on Travis CI OS X
     # t9816 occasionally fails with "TAP out of sequence errors" on Travis CI OS X
@@ -57,6 +56,8 @@ before_install:
   - >
     case "${TRAVIS_OS_NAME:-linux}" in
     linux)
+      export GIT_TEST_HTTPD=YesPlease
+
       mkdir --parents custom/p4
       pushd custom/p4
         wget --quiet http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION/bin.linux26x86_64/p4d
index f8e8e3f3905564be5295dd6f3bb21613ac22b16f..4898d5ab11869677e7119ec4598969b655af5776 100644 (file)
@@ -21,7 +21,7 @@ Backward compatibility notes.
 
  * The default abbreviation length, which has historically been 7, now
    scales as the repository grows, using the approximate number of
-   objects in the reopsitory and a bit of math around the birthday
+   objects in the repository and a bit of math around the birthday
    paradox.  The logic suggests to use 12 hexdigits for the Linux
    kernel, and 9 to 10 for Git itself.
 
@@ -45,10 +45,10 @@ UI, Workflows & Features
    which was not intuitive, given that "git nosuchcommand" said "git:
    'nosuchcommand' is not a git command".
 
- * "git clone --resurse-submodules --reference $path $URL" is a way to
+ * "git clone --recurse-submodules --reference $path $URL" is a way to
    reduce network transfer cost by borrowing objects in an existing
    $path repository when cloning the superproject from $URL; it
-   learned to also peek into $path for presense of corresponding
+   learned to also peek into $path for presence of corresponding
    repositories of submodules and borrow objects from there when able.
 
  * The "git diff --submodule={short,log}" mechanism has been enhanced
@@ -73,7 +73,7 @@ UI, Workflows & Features
 
  * In some projects, it is common to use "[RFC PATCH]" as the subject
    prefix for a patch meant for discussion rather than application.  A
-   new option "--rfc" was a short-hand for "--subject-prefix=RFC PATCH"
+   new option "--rfc" is a short-hand for "--subject-prefix=RFC PATCH"
    to help the participants of such projects.
 
  * "git add --chmod=+x <pathspec>" added recently only toggled the
@@ -96,8 +96,8 @@ UI, Workflows & Features
 
  * When given an abbreviated object name that is not (or more
    realistically, "no longer") unique, we gave a fatal error
-   "ambiguous argument".  This error is now accompanied by hints that
-   lists the objects that begins with the given prefix.  During the
+   "ambiguous argument".  This error is now accompanied by a hint that
+   lists the objects beginning with the given prefix.  During the
    course of development of this new feature, numerous minor bugs were
    uncovered and corrected, the most notable one of which is that we
    gave "short SHA1 xxxx is ambiguous." twice without good reason.
@@ -330,7 +330,7 @@ notes for details).
  * "git diff -W" output needs to extend the context backward to
    include the header line of the current function and also forward to
    include the body of the entire current function up to the header
-   line of the next one.  This process may have to merge to adjacent
+   line of the next one.  This process may have to merge two adjacent
    hunks, but the code forgot to do so in some cases.
 
  * Performance tests done via "t/perf" did not use the same set of
@@ -568,6 +568,12 @@ notes for details).
    prefixing $(git --exec-path) output in front.
    (merge 1073094f30 ak/sh-setup-dot-source-i18n-fix later to maint).
 
+ * Fix for a racy false-positive test failure.
+   (merge fdf4f6c79b as/merge-attr-sleep later to maint).
+
+ * Portability update and workaround for builds on recent Mac OS X.
+   (merge a296bc0132 ls/macos-update later to maint).
+
  * Other minor doc, test and build updates and code cleanups.
    (merge 5c238e29a8 jk/common-main later to maint).
    (merge 5a5749e45b ak/pre-receive-hook-template-modefix later to maint).
@@ -575,3 +581,8 @@ notes for details).
    (merge de9f7fa3b0 rs/commit-pptr-simplify later to maint).
    (merge 4259d693fc sc/fmt-merge-msg-doc-markup-fix later to maint).
    (merge 28fab7b23d nd/test-helpers later to maint).
+   (merge c2bb0c1d1e rs/cocci later to maint).
+   (merge 3285b7badb ps/common-info-doc later to maint).
+   (merge 2b090822e8 nd/worktree-lock later to maint).
+   (merge 4bd488ea7c jk/create-branch-remove-unused-param later to maint).
+   (merge 974e0044d6 tk/diffcore-delta-remove-unused later to maint).
index 0aeb020d026f59ad435c72e752d6f9c2f3cec73b..e257c19ebed96c3ab4877a752c3545e2d98c5d84 100644 (file)
@@ -133,7 +133,7 @@ OPTIONS
 +
 If the last path components in the working tree's path is unique among
 working trees, it can be used to identify worktrees. For example if
-you only have to working trees at "/abc/def/ghi" and "/abc/def/ggg",
+you only have two working trees, at "/abc/def/ghi" and "/abc/def/ggg",
 then "ghi" or "def/ghi" is enough to point to the former working tree.
 
 DETAILS
index 577ee844e0ed09e9f0339de55cf14a29ca7bdab2..a5f99cbb11ba3f7957b9fcd432354c08d99a32c1 100644 (file)
@@ -177,7 +177,7 @@ sharedindex.<SHA-1>::
 info::
        Additional information about the repository is recorded
        in this directory. This directory is ignored if $GIT_COMMON_DIR
-       is set and "$GIT_COMMON_DIR/index" will be used instead.
+       is set and "$GIT_COMMON_DIR/info" will be used instead.
 
 info/refs::
        This file helps dumb transports discover what refs are
index feddf2326bdfca1184084b94eaa6bc5fe88a53de..fdd0a2d3215aa4b0db5d8c25d97a2fa9bae2844c 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.11.0-rc0
+DEF_VER=v2.11.0-rc2
 
 LF='
 '
index 9d6c24503155471cc66882f6ba2040456a1cf470..f53fcc90d71b7e0ba95b94e9baf67d559085863c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1047,6 +1047,7 @@ ifeq ($(uname_S),Darwin)
                endif
        endif
        ifndef NO_APPLE_COMMON_CRYPTO
+               NO_OPENSSL = YesPlease
                APPLE_COMMON_CRYPTO = YesPlease
                COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
        endif
index a5a8dcbd0ed929d09a73674361ee1dd81dd5b88c..0d459b3cfe507b3906760fbea7f35e6191366057 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -228,8 +228,7 @@ N_("\n"
 "will track its remote counterpart, you may want to use\n"
 "\"git push -u\" to set the upstream config as you push.");
 
-void create_branch(const char *head,
-                  const char *name, const char *start_name,
+void create_branch(const char *name, const char *start_name,
                   int force, int reflog, int clobber_head,
                   int quiet, enum branch_track track)
 {
index b2f964933270e1306eff1f0589c58efd22d6c76b..3103eb9add31e08600f9fa158303417e36d3b229 100644 (file)
--- a/branch.h
+++ b/branch.h
@@ -4,15 +4,21 @@
 /* Functions for acting on the information about branches. */
 
 /*
- * Creates a new branch, where head is the branch currently checked
- * out, name is the new branch name, start_name is the name of the
- * existing branch that the new branch should start from, force
- * enables overwriting an existing (non-head) branch, reflog creates a
- * reflog for the branch, and track causes the new branch to be
- * configured to merge the remote branch that start_name is a tracking
- * branch for (if any).
+ * Creates a new branch, where:
+ *
+ *   - name is the new branch name
+ *
+ *   - start_name is the name of the existing branch that the new branch should
+ *     start from
+ *
+ *   - force enables overwriting an existing (non-head) branch
+ *
+ *   - reflog creates a reflog for the branch
+ *
+ *   - track causes the new branch to be configured to merge the remote branch
+ *     that start_name is a tracking branch for (if any).
  */
-void create_branch(const char *head, const char *name, const char *start_name,
+void create_branch(const char *name, const char *start_name,
                   int force, int reflog,
                   int clobber_head, int quiet, enum branch_track track);
 
index d5d93a8c03fe42e6b682be4da14dd50f355de269..60cc5c8e8da08e628d05f245003bc558657f6237 100644 (file)
@@ -807,7 +807,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                 * create_branch takes care of setting up the tracking
                 * info and making sure new_upstream is correct
                 */
-               create_branch(head, branch->name, new_upstream, 0, 0, 0, quiet, BRANCH_TRACK_OVERRIDE);
+               create_branch(branch->name, new_upstream, 0, 0, 0, quiet, BRANCH_TRACK_OVERRIDE);
        } else if (unset_upstream) {
                struct branch *branch = branch_get(argv[0]);
                struct strbuf buf = STRBUF_INIT;
@@ -853,7 +853,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                strbuf_release(&buf);
 
                branch_existed = ref_exists(branch->refname);
-               create_branch(head, argv[0], (argc == 2) ? argv[1] : head,
+               create_branch(argv[0], (argc == 2) ? argv[1] : head,
                              force, reflog, 0, quiet, track);
 
                /*
index 9b2a5b31d423ae2f27756df8deab2d9f2fe18ddc..512492aad9099dd2a7aa85391b5c9a8e321c3bfe 100644 (file)
@@ -630,7 +630,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
                        }
                }
                else
-                       create_branch(old->name, opts->new_branch, new->name,
+                       create_branch(opts->new_branch, new->name,
                                      opts->new_branch_force ? 1 : 0,
                                      opts->new_branch_log,
                                      opts->new_branch_force ? 1 : 0,
index 0307624a03fc4c4fd5642d2b4ad853cfba5b6905..09afdbf99462166e45ed623fe70a849e59045a3b 100644 (file)
@@ -17,10 +17,13 @@ expression E1;
 + oid_to_hex(&E1)
 
 @@
+identifier f != oid_to_hex;
 expression E1;
 @@
+  f(...) {...
 - sha1_to_hex(E1->hash)
 + oid_to_hex(E1)
+  ...}
 
 @@
 expression E1, E2;
@@ -29,10 +32,13 @@ expression E1, E2;
 + oid_to_hex_r(E1, &E2)
 
 @@
+identifier f != oid_to_hex_r;
 expression E1, E2;
 @@
+   f(...) {...
 - sha1_to_hex_r(E1, E2->hash)
 + oid_to_hex_r(E1, E2)
+  ...}
 
 @@
 expression E1;
@@ -41,10 +47,13 @@ expression E1;
 + oidclr(&E1)
 
 @@
+identifier f != oidclr;
 expression E1;
 @@
+  f(...) {...
 - hashclr(E1->hash)
 + oidclr(E1)
+  ...}
 
 @@
 expression E1, E2;
@@ -53,10 +62,13 @@ expression E1, E2;
 + oidcmp(&E1, &E2)
 
 @@
+identifier f != oidcmp;
 expression E1, E2;
 @@
+  f(...) {...
 - hashcmp(E1->hash, E2->hash)
 + oidcmp(E1, E2)
+  ...}
 
 @@
 expression E1, E2;
@@ -77,10 +89,13 @@ expression E1, E2;
 + oidcpy(&E1, &E2)
 
 @@
+identifier f != oidcpy;
 expression E1, E2;
 @@
+  f(...) {...
 - hashcpy(E1->hash, E2->hash)
 + oidcpy(E1, E2)
+  ...}
 
 @@
 expression E1, E2;
diff --git a/diff.c b/diff.c
index 8981477c436dd11d97714f0ad7e1b9363e328798..ec8728362dae5a3bf404f6782f9091d6a1c9a6c2 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -2023,7 +2023,7 @@ static void show_dirstat(struct diff_options *options)
                if (DIFF_FILE_VALID(p->one) && DIFF_FILE_VALID(p->two)) {
                        diff_populate_filespec(p->one, 0);
                        diff_populate_filespec(p->two, 0);
-                       diffcore_count_changes(p->one, p->two, NULL, NULL, 0,
+                       diffcore_count_changes(p->one, p->two, NULL, NULL,
                                               &copied, &added);
                        diff_free_filespec_data(p->one);
                        diff_free_filespec_data(p->two);
index 881a74f29e4f6033a2547f2558a5ad8a3eaad584..c64359f489c87910b9d41756918dacda49276004 100644 (file)
@@ -73,7 +73,6 @@ static int should_break(struct diff_filespec *src,
 
        if (diffcore_count_changes(src, dst,
                                   &src->cnt_data, &dst->cnt_data,
-                                  0,
                                   &src_copied, &literal_added))
                return 0;
 
index 2ebedb32d18abb3e50d8b4e4b523cf2f8205a695..ebe70fb068519be86437a11b980d804be0534c75 100644 (file)
@@ -166,7 +166,6 @@ int diffcore_count_changes(struct diff_filespec *src,
                           struct diff_filespec *dst,
                           void **src_count_p,
                           void **dst_count_p,
-                          unsigned long delta_limit,
                           unsigned long *src_copied,
                           unsigned long *literal_added)
 {
index 54a2396653df230d8f527d2eac5a2f75398f0b13..f7444c86bde3909c8fca23f71c4852514eb26b88 100644 (file)
@@ -145,7 +145,6 @@ static int estimate_similarity(struct diff_filespec *src,
         * call into this function in that case.
         */
        unsigned long max_size, delta_size, base_size, src_copied, literal_added;
-       unsigned long delta_limit;
        int score;
 
        /* We deal only with regular files.  Symlink renames are handled
@@ -191,11 +190,8 @@ static int estimate_similarity(struct diff_filespec *src,
        if (!dst->cnt_data && diff_populate_filespec(dst, 0))
                return 0;
 
-       delta_limit = (unsigned long)
-               (base_size * (MAX_SCORE-minimum_score) / MAX_SCORE);
        if (diffcore_count_changes(src, dst,
                                   &src->cnt_data, &dst->cnt_data,
-                                  delta_limit,
                                   &src_copied, &literal_added))
                return 0;
 
index c11b8465fc8ef9e54f12130e490c00bd2fb63616..623024135478088028cd42b8c6a744ebb04bf0a7 100644 (file)
@@ -142,7 +142,6 @@ extern int diffcore_count_changes(struct diff_filespec *src,
                                  struct diff_filespec *dst,
                                  void **src_count_p,
                                  void **dst_count_p,
-                                 unsigned long delta_limit,
                                  unsigned long *src_copied,
                                  unsigned long *literal_added);
 
index cb45c346ea97059b66642b458c7ca372ece67aaa..601f0779a1903a2b860412e3404e4ea8e4bce573 100644 (file)
@@ -240,7 +240,7 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1)
                        return ACK;
                }
        }
-       die(_("git fetch_pack: expected ACK/NAK, got '%s'"), line);
+       die(_("git fetch-pack: expected ACK/NAK, got '%s'"), line);
 }
 
 static void send_request(struct fetch_pack_args *args,
index 5fd75f30dd4455bf71a12fd628b488fc2b17e192..6f0ff9e413129567332b78bd93ff2528076c8db6 100644 (file)
@@ -629,7 +629,7 @@ static const char *todo_command_strings[] = {
 
 static const char *command_to_string(const enum todo_command command)
 {
-       if (command < ARRAY_SIZE(todo_command_strings))
+       if ((size_t)command < ARRAY_SIZE(todo_command_strings))
                return todo_command_strings[command];
        die("Unknown command: %d", command);
 }
index 5457314e6aaaf1a30d33f68c8e1005f8db584564..9c86d1924a23e4c81369f34ec8e1058c2dd15c1f 100644 (file)
@@ -296,7 +296,7 @@ static int link_alt_odb_entry(const char *entry, const char *relative_base,
        }
        strbuf_addstr(&pathbuf, entry);
 
-       if (strbuf_normalize_path(&pathbuf) < 0) {
+       if (strbuf_normalize_path(&pathbuf) < 0 && relative_base) {
                error("unable to normalize alternate object path: %s",
                      pathbuf.buf);
                strbuf_release(&pathbuf);
index 06409a38451971121e6cf6abd4a8af5bffd231c1..73a915ff1b3278f08ef4f327a55fe61d238f720a 100644 (file)
@@ -510,7 +510,8 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len)
 {
        static int bufno;
        static char hexbuffer[4][GIT_SHA1_HEXSZ + 1];
-       char *hex = hexbuffer[3 & ++bufno];
+       char *hex = hexbuffer[bufno];
+       bufno = (bufno + 1) % ARRAY_SIZE(hexbuffer);
        find_unique_abbrev_r(hex, sha1, len);
        return hex;
 }
index 35da553655bdf7b70519ecf529544796ca8185b5..615f4cac05f7d381b3c31831b6fd9e8a72e1f982 100644 (file)
@@ -187,7 +187,7 @@ void prepare_to_write_split_index(struct index_state *istate)
                /* Go through istate->cache[] and mark CE_MATCHED to
                 * entry with positive index. We'll go through
                 * base->cache[] later to delete all entries in base
-                * that are not marked eith either CE_MATCHED or
+                * that are not marked with either CE_MATCHED or
                 * CE_UPDATE_IN_BASE. If istate->cache[i] is a
                 * duplicate, deduplicate it.
                 */
index a20b9f58e3fe1de2932046d5d7f692b45e3ac854..4ea534e9fa70ea302d4a88a8bc922c100f896873 100755 (executable)
@@ -4,15 +4,17 @@ test_description='blob conversion via gitattributes'
 
 . ./test-lib.sh
 
-TEST_ROOT="$(pwd)"
+TEST_ROOT="$PWD"
+PATH=$TEST_ROOT:$PATH
 
-cat <<EOF >"$TEST_ROOT/rot13.sh"
-#!$SHELL_PATH
+write_script <<\EOF "$TEST_ROOT/rot13.sh"
 tr \
   'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \
   'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
 EOF
-chmod +x "$TEST_ROOT/rot13.sh"
+
+write_script rot13-filter.pl "$PERL_PATH" \
+       <"$TEST_DIRECTORY"/t0021/rot13-filter.pl
 
 generate_random_characters () {
        LEN=$1
@@ -22,13 +24,12 @@ generate_random_characters () {
 }
 
 file_size () {
-       cat "$1" | wc -c | sed "s/^[ ]*//"
+       perl -e 'print -s $ARGV[0]' "$1"
 }
 
 filter_git () {
        rm -f rot13-filter.log &&
-       git "$@" 2>git-stderr.log &&
-       rm -f git-stderr.log
+       git "$@"
 }
 
 # Compare two files and ensure that `clean` and `smudge` respectively are
@@ -40,10 +41,9 @@ test_cmp_count () {
        actual=$2
        for FILE in "$expect" "$actual"
        do
-               sort "$FILE" | uniq -c | sed "s/^[ ]*//" |
-                       sed "s/^\([0-9]\) IN: clean/x IN: clean/" |
-                       sed "s/^\([0-9]\) IN: smudge/x IN: smudge/" >"$FILE.tmp" &&
-               mv "$FILE.tmp" "$FILE"
+               sort "$FILE" | uniq -c |
+               sed -e "s/^ *[0-9][0-9]*[       ]*IN: /x IN: /" >"$FILE.tmp" &&
+               mv "$FILE.tmp" "$FILE" || return
        done &&
        test_cmp "$expect" "$actual"
 }
@@ -66,7 +66,7 @@ test_cmp_exclude_clean () {
 # is equal to the committed content.
 test_cmp_committed_rot13 () {
        test_cmp "$1" "$2" &&
-       "$TEST_ROOT/rot13.sh" <"$1" >expected &&
+       rot13.sh <"$1" >expected &&
        git cat-file blob :"$2" >actual &&
        test_cmp expected actual
 }
@@ -342,7 +342,7 @@ test_expect_success 'diff does not reuse worktree files that need cleaning' '
 '
 
 test_expect_success PERL 'required process filter should filter data' '
-       test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+       test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
        test_config_global filter.protocol.required true &&
        rm -rf repo &&
        mkdir repo &&
@@ -435,7 +435,7 @@ test_expect_success PERL 'required process filter should filter data' '
 
 test_expect_success PERL 'required process filter takes precedence' '
        test_config_global filter.protocol.clean false &&
-       test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean" &&
+       test_config_global filter.protocol.process "rot13-filter.pl clean" &&
        test_config_global filter.protocol.required true &&
        rm -rf repo &&
        mkdir repo &&
@@ -460,7 +460,7 @@ test_expect_success PERL 'required process filter takes precedence' '
 '
 
 test_expect_success PERL 'required process filter should be used only for "clean" operation only' '
-       test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean" &&
+       test_config_global filter.protocol.process "rot13-filter.pl clean" &&
        rm -rf repo &&
        mkdir repo &&
        (
@@ -495,7 +495,7 @@ test_expect_success PERL 'required process filter should be used only for "clean
 '
 
 test_expect_success PERL 'required process filter should process multiple packets' '
-       test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+       test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
        test_config_global filter.protocol.required true &&
 
        rm -rf repo &&
@@ -515,7 +515,7 @@ test_expect_success PERL 'required process filter should process multiple packet
                for FILE in "$TEST_ROOT"/*.file
                do
                        cp "$FILE" . &&
-                       "$TEST_ROOT/rot13.sh" <"$FILE" >"$FILE.rot13"
+                       rot13.sh <"$FILE" >"$FILE.rot13"
                done &&
 
                echo "*.file filter=protocol" >.gitattributes &&
@@ -555,7 +555,7 @@ test_expect_success PERL 'required process filter should process multiple packet
 '
 
 test_expect_success PERL 'required process filter with clean error should fail' '
-       test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+       test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
        test_config_global filter.protocol.required true &&
        rm -rf repo &&
        mkdir repo &&
@@ -574,7 +574,7 @@ test_expect_success PERL 'required process filter with clean error should fail'
 '
 
 test_expect_success PERL 'process filter should restart after unexpected write failure' '
-       test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+       test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
        rm -rf repo &&
        mkdir repo &&
        (
@@ -618,14 +618,14 @@ test_expect_success PERL 'process filter should restart after unexpected write f
 
                # Smudge failed
                ! test_cmp smudge-write-fail.o smudge-write-fail.r &&
-               "$TEST_ROOT/rot13.sh" <smudge-write-fail.o >expected &&
+               rot13.sh <smudge-write-fail.o >expected &&
                git cat-file blob :smudge-write-fail.r >actual &&
                test_cmp expected actual
        )
 '
 
 test_expect_success PERL 'process filter should not be restarted if it signals an error' '
-       test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+       test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
        rm -rf repo &&
        mkdir repo &&
        (
@@ -664,7 +664,7 @@ test_expect_success PERL 'process filter should not be restarted if it signals a
 '
 
 test_expect_success PERL 'process filter abort stops processing of all further files' '
-       test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+       test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
        rm -rf repo &&
        mkdir repo &&
        (
old mode 100755 (executable)
new mode 100644 (file)
index ae4c50f..4d5697e
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
 #
 # Example implementation for the Git filter protocol version 2
 # See Documentation/gitattributes.txt, section "Filter Protocol"
@@ -22,6 +21,7 @@
 
 use strict;
 use warnings;
+use IO::File;
 
 my $MAX_PACKET_CONTENT_SIZE = 65516;
 my @capabilities            = @ARGV;
diff --git a/t/t5615-alternate-env.sh b/t/t5615-alternate-env.sh
new file mode 100755 (executable)
index 0000000..eec4137
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+test_description='handling of alternates in environment variables'
+. ./test-lib.sh
+
+check_obj () {
+       alt=$1; shift
+       while read obj expect
+       do
+               echo "$obj" >&3 &&
+               echo "$obj $expect" >&4
+       done 3>input 4>expect &&
+       GIT_ALTERNATE_OBJECT_DIRECTORIES=$alt \
+               git "$@" cat-file --batch-check='%(objectname) %(objecttype)' \
+               <input >actual &&
+       test_cmp expect actual
+}
+
+test_expect_success 'create alternate repositories' '
+       git init --bare one.git &&
+       one=$(echo one | git -C one.git hash-object -w --stdin) &&
+       git init --bare two.git &&
+       two=$(echo two | git -C two.git hash-object -w --stdin)
+'
+
+test_expect_success 'objects inaccessible without alternates' '
+       check_obj "" <<-EOF
+       $one missing
+       $two missing
+       EOF
+'
+
+test_expect_success 'access alternate via absolute path' '
+       check_obj "$PWD/one.git/objects" <<-EOF
+       $one blob
+       $two missing
+       EOF
+'
+
+test_expect_success 'access multiple alternates' '
+       check_obj "$PWD/one.git/objects:$PWD/two.git/objects" <<-EOF
+       $one blob
+       $two blob
+       EOF
+'
+
+# bare paths are relative from $GIT_DIR
+test_expect_success 'access alternate via relative path (bare)' '
+       git init --bare bare.git &&
+       check_obj "../one.git/objects" -C bare.git <<-EOF
+       $one blob
+       EOF
+'
+
+# non-bare paths are relative to top of worktree
+test_expect_success 'access alternate via relative path (worktree)' '
+       git init worktree &&
+       check_obj "../one.git/objects" -C worktree <<-EOF
+       $one blob
+       EOF
+'
+
+# path is computed after moving to top-level of worktree
+test_expect_success 'access alternate via relative path (subdir)' '
+       mkdir subdir &&
+       check_obj "one.git/objects" -C subdir <<-EOF
+       $one blob
+       EOF
+'
+
+test_done
index 7a6e33e6732eaf69e298b56729ba4ead9ffaee0e..8f9b48a4937bb4141d17b7d9096d2b6fb695c25c 100755 (executable)
@@ -183,16 +183,24 @@ test_expect_success 'up-to-date merge without common ancestor' '
 
 test_expect_success 'custom merge does not lock index' '
        git reset --hard anchor &&
-       write_script sleep-one-second.sh <<-\EOF &&
-               sleep 1 &
+       write_script sleep-an-hour.sh <<-\EOF &&
+               sleep 3600 &
                echo $! >sleep.pid
        EOF
-       test_when_finished "kill \$(cat sleep.pid)" &&
 
        test_write_lines >.gitattributes \
-               "* merge=ours" "text merge=sleep-one-second" &&
+               "* merge=ours" "text merge=sleep-an-hour" &&
        test_config merge.ours.driver true &&
-       test_config merge.sleep-one-second.driver ./sleep-one-second.sh &&
+       test_config merge.sleep-an-hour.driver ./sleep-an-hour.sh &&
+
+       # We are testing that the custom merge driver does not block
+       # index.lock on Windows due to an inherited file handle.
+       # To ensure that the backgrounded process ran sufficiently
+       # long (and has been started in the first place), we do not
+       # ignore the result of the kill command.
+       # By packaging the command in test_when_finished, we get both
+       # the correctness check and the clean-up.
+       test_when_finished "kill \$(cat sleep.pid)" &&
        git merge master
 '