diff options
-rw-r--r-- | .travis.yml | 3 | ||||
-rw-r--r-- | Documentation/RelNotes/2.11.0.txt | 25 | ||||
-rw-r--r-- | Documentation/git-worktree.txt | 2 | ||||
-rw-r--r-- | Documentation/gitrepository-layout.txt | 2 | ||||
-rwxr-xr-x | GIT-VERSION-GEN | 2 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | branch.c | 3 | ||||
-rw-r--r-- | branch.h | 22 | ||||
-rw-r--r-- | builtin/branch.c | 4 | ||||
-rw-r--r-- | builtin/checkout.c | 2 | ||||
-rw-r--r-- | contrib/coccinelle/object_id.cocci | 15 | ||||
-rw-r--r-- | diff.c | 2 | ||||
-rw-r--r-- | diffcore-break.c | 1 | ||||
-rw-r--r-- | diffcore-delta.c | 1 | ||||
-rw-r--r-- | diffcore-rename.c | 4 | ||||
-rw-r--r-- | diffcore.h | 1 | ||||
-rw-r--r-- | fetch-pack.c | 2 | ||||
-rw-r--r-- | sequencer.c | 2 | ||||
-rw-r--r-- | sha1_file.c | 2 | ||||
-rw-r--r-- | sha1_name.c | 3 | ||||
-rw-r--r-- | split-index.c | 2 | ||||
-rwxr-xr-x | t/t0021-conversion.sh | 44 | ||||
-rw-r--r--[-rwxr-xr-x] | t/t0021/rot13-filter.pl | 2 | ||||
-rwxr-xr-x | t/t5615-alternate-env.sh | 71 | ||||
-rwxr-xr-x | t/t6026-merge-attr.sh | 18 |
25 files changed, 171 insertions, 65 deletions
diff --git a/.travis.yml b/.travis.yml index 9a65514d8..0b2ea5c3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Documentation/RelNotes/2.11.0.txt b/Documentation/RelNotes/2.11.0.txt index f8e8e3f39..4898d5ab1 100644 --- a/Documentation/RelNotes/2.11.0.txt +++ b/Documentation/RelNotes/2.11.0.txt @@ -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). diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index 0aeb020d0..e257c19eb 100644 --- a/Documentation/git-worktree.txt +++ b/Documentation/git-worktree.txt @@ -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 diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt index 577ee844e..a5f99cbb1 100644 --- a/Documentation/gitrepository-layout.txt +++ b/Documentation/gitrepository-layout.txt @@ -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 diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index feddf2326..fdd0a2d32 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v2.11.0-rc0 +DEF_VER=v2.11.0-rc2 LF=' ' @@ -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 @@ -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) { @@ -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); diff --git a/builtin/branch.c b/builtin/branch.c index d5d93a8c0..60cc5c8e8 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -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); /* diff --git a/builtin/checkout.c b/builtin/checkout.c index 9b2a5b31d..512492aad 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -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, diff --git a/contrib/coccinelle/object_id.cocci b/contrib/coccinelle/object_id.cocci index 0307624a0..09afdbf99 100644 --- a/contrib/coccinelle/object_id.cocci +++ b/contrib/coccinelle/object_id.cocci @@ -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; @@ -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); diff --git a/diffcore-break.c b/diffcore-break.c index 881a74f29..c64359f48 100644 --- a/diffcore-break.c +++ b/diffcore-break.c @@ -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; diff --git a/diffcore-delta.c b/diffcore-delta.c index 2ebedb32d..ebe70fb06 100644 --- a/diffcore-delta.c +++ b/diffcore-delta.c @@ -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) { diff --git a/diffcore-rename.c b/diffcore-rename.c index 54a239665..f7444c86b 100644 --- a/diffcore-rename.c +++ b/diffcore-rename.c @@ -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; diff --git a/diffcore.h b/diffcore.h index c11b8465f..623024135 100644 --- a/diffcore.h +++ b/diffcore.h @@ -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); diff --git a/fetch-pack.c b/fetch-pack.c index cb45c346e..601f0779a 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -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, diff --git a/sequencer.c b/sequencer.c index 5fd75f30d..6f0ff9e41 100644 --- a/sequencer.c +++ b/sequencer.c @@ -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); } diff --git a/sha1_file.c b/sha1_file.c index 5457314e6..9c86d1924 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -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); diff --git a/sha1_name.c b/sha1_name.c index 06409a384..73a915ff1 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -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; } diff --git a/split-index.c b/split-index.c index 35da55365..615f4cac0 100644 --- a/split-index.c +++ b/split-index.c @@ -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. */ diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh index a20b9f58e..4ea534e9f 100755 --- a/t/t0021-conversion.sh +++ b/t/t0021-conversion.sh @@ -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 && ( diff --git a/t/t0021/rot13-filter.pl b/t/t0021/rot13-filter.pl index ae4c50f5c..4d5697ee5 100755..100644 --- a/t/t0021/rot13-filter.pl +++ b/t/t0021/rot13-filter.pl @@ -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 index 000000000..eec4137ca --- /dev/null +++ b/t/t5615-alternate-env.sh @@ -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 diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh index 7a6e33e67..8f9b48a49 100755 --- a/t/t6026-merge-attr.sh +++ b/t/t6026-merge-attr.sh @@ -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 ' |