#!/bin/sh # Copyright (c) 2006, Junio C Hamano. global test_description := ''Per branch config variables affects "git fetch". '' source ./test-lib.sh global D := $[pwd] proc test_bundle_object_count { git verify-pack -v $1 >verify.out && test $2 = $[grep '^[0-9a-f]\{40\} ' verify.out | wc -l] } proc convert_bundle_to_pack { while read x && test -n "$x" { :; } cat } test_expect_success setup ' echo >file original && git add file && git commit -a -m original' test_expect_success "clone and setup child repos" ' git clone . one && ( cd one && echo >file updated by one && git commit -a -m "updated by one" ) && git clone . two && ( cd two && git config branch.master.remote one && git config remote.one.url ../one/.git/ && git config remote.one.fetch refs/heads/master:refs/heads/one ) && git clone . three && ( cd three && git config branch.master.remote two && git config branch.master.merge refs/heads/one && mkdir -p .git/remotes && { echo "URL: ../two/.git/" echo "Pull: refs/heads/master:refs/heads/two" echo "Pull: refs/heads/one:refs/heads/one" } >.git/remotes/two ) && git clone . bundle && git clone . seven ' test_expect_success "fetch test" ' cd "$D" && echo >file updated by origin && git commit -a -m "updated by origin" && cd two && git fetch && test -f .git/refs/heads/one && mine=$(git rev-parse refs/heads/one) && his=$(cd ../one && git rev-parse refs/heads/master) && test "z$mine" = "z$his" ' test_expect_success "fetch test for-merge" ' cd "$D" && cd three && git fetch && test -f .git/refs/heads/two && test -f .git/refs/heads/one && master_in_two=$(cd ../two && git rev-parse master) && one_in_two=$(cd ../two && git rev-parse one) && { echo "$one_in_two " echo "$master_in_two not-for-merge" } >expected && cut -f -2 .git/FETCH_HEAD >actual && test_cmp expected actual' test_expect_success 'fetch --prune on its own works as expected' ' cd "$D" && git clone . prune && cd prune && git update-ref refs/remotes/origin/extrabranch master && git fetch --prune origin && test_must_fail git rev-parse origin/extrabranch ' test_expect_success 'fetch --prune with a branch name keeps branches' ' cd "$D" && git clone . prune-branch && cd prune-branch && git update-ref refs/remotes/origin/extrabranch master && git fetch --prune origin master && git rev-parse origin/extrabranch ' test_expect_success 'fetch --prune with a namespace keeps other namespaces' ' cd "$D" && git clone . prune-namespace && cd prune-namespace && git fetch --prune origin refs/heads/a/*:refs/remotes/origin/a/* && git rev-parse origin/master ' test_expect_success 'fetch --prune handles overlapping refspecs' ' cd "$D" && git update-ref refs/pull/42/head master && git clone . prune-overlapping && cd prune-overlapping && git config --add remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* && git fetch --prune origin && git rev-parse origin/master && git rev-parse origin/pr/42 && git config --unset-all remote.origin.fetch && git config remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* && git config --add remote.origin.fetch refs/heads/*:refs/remotes/origin/* && git fetch --prune origin && git rev-parse origin/master && git rev-parse origin/pr/42 ' test_expect_success 'fetch --prune --tags prunes branches but not tags' ' cd "$D" && git clone . prune-tags && cd prune-tags && git tag sometag master && # Create what looks like a remote-tracking branch from an earlier # fetch that has since been deleted from the remote: git update-ref refs/remotes/origin/fake-remote master && git fetch --prune --tags origin && git rev-parse origin/master && test_must_fail git rev-parse origin/fake-remote && git rev-parse sometag ' test_expect_success 'fetch --prune --tags with branch does not prune other things' ' cd "$D" && git clone . prune-tags-branch && cd prune-tags-branch && git tag sometag master && git update-ref refs/remotes/origin/extrabranch master && git fetch --prune --tags origin master && git rev-parse origin/extrabranch && git rev-parse sometag ' test_expect_success 'fetch --prune --tags with refspec prunes based on refspec' ' cd "$D" && git clone . prune-tags-refspec && cd prune-tags-refspec && git tag sometag master && git update-ref refs/remotes/origin/foo/otherbranch master && git update-ref refs/remotes/origin/extrabranch master && git fetch --prune --tags origin refs/heads/foo/*:refs/remotes/origin/foo/* && test_must_fail git rev-parse refs/remotes/origin/foo/otherbranch && git rev-parse origin/extrabranch && git rev-parse sometag ' test_expect_success 'fetch tags when there is no tags' ' cd "$D" && mkdir notags && cd notags && git init && git fetch -t .. ' test_expect_success 'fetch following tags' ' cd "$D" && git tag -a -m 'annotated' anno HEAD && git tag light HEAD && mkdir four && cd four && git init && git fetch .. :track && git show-ref --verify refs/tags/anno && git show-ref --verify refs/tags/light ' test_expect_success 'fetch uses remote ref names to describe new refs' ' cd "$D" && git init descriptive && ( cd descriptive && git config remote.o.url .. && git config remote.o.fetch "refs/heads/*:refs/crazyheads/*" && git config --add remote.o.fetch "refs/others/*:refs/heads/*" && git fetch o ) && git tag -a -m "Descriptive tag" descriptive-tag && git branch descriptive-branch && git checkout descriptive-branch && echo "Nuts" >crazy && git add crazy && git commit -a -m "descriptive commit" && git update-ref refs/others/crazy HEAD && ( cd descriptive && git fetch o 2>actual && grep " -> refs/crazyheads/descriptive-branch$" actual | test_i18ngrep "new branch" && grep " -> descriptive-tag$" actual | test_i18ngrep "new tag" && grep " -> crazy$" actual | test_i18ngrep "new ref" ) && git checkout master ' test_expect_success 'fetch must not resolve short tag name' ' cd "$D" && mkdir five && cd five && git init && test_must_fail git fetch .. anno:five ' test_expect_success 'fetch can now resolve short remote name' ' cd "$D" && git update-ref refs/remotes/six/HEAD HEAD && mkdir six && cd six && git init && git fetch .. six:six ' test_expect_success 'create bundle 1' ' cd "$D" && echo >file updated again by origin && git commit -a -m "tip" && git bundle create bundle1 master^..master ' test_expect_success 'header of bundle looks right' ' head -n 1 "$D"/bundle1 | grep "^#" && head -n 2 "$D"/bundle1 | grep "^-[0-9a-f]\{40\} " && head -n 3 "$D"/bundle1 | grep "^[0-9a-f]\{40\} " && head -n 4 "$D"/bundle1 | grep "^$" ' test_expect_success 'create bundle 2' ' cd "$D" && git bundle create bundle2 master~2..master ' test_expect_success 'unbundle 1' ' cd "$D/bundle" && git checkout -b some-branch && test_must_fail git fetch "$D/bundle1" master:master ' test_expect_success 'bundle 1 has only 3 files ' ' cd "$D" && convert_bundle_to_pack bundle.pack && git index-pack bundle.pack && test_bundle_object_count bundle.pack 3 ' test_expect_success 'unbundle 2' ' cd "$D/bundle" && git fetch ../bundle2 master:master && test "tip" = "$(git log -1 --pretty=oneline master | cut -b42-)" ' test_expect_success 'bundle does not prerequisite objects' ' cd "$D" && touch file2 && git add file2 && git commit -m add.file2 file2 && git bundle create bundle3 -1 HEAD && convert_bundle_to_pack bundle.pack && git index-pack bundle.pack && test_bundle_object_count bundle.pack 3 ' test_expect_success 'bundle should be able to create a full history' ' cd "$D" && git tag -a -m '1.0' v1.0 master && git bundle create bundle4 v1.0 ' test_expect_success 'fetch with a non-applying branch..merge' ' git config branch.master.remote yeti && git config branch.master.merge refs/heads/bigfoot && git config remote.blub.url one && git config remote.blub.fetch "refs/heads/*:refs/remotes/one/*" && git fetch blub ' # URL supplied to fetch does not match the url of the configured branch's remote test_expect_success 'fetch from GIT URL with a non-applying branch..merge [1]' ' one_head=$(cd one && git rev-parse HEAD) && this_head=$(git rev-parse HEAD) && git update-ref -d FETCH_HEAD && git fetch one && test $one_head = "$(git rev-parse --verify FETCH_HEAD)" && test $this_head = "$(git rev-parse --verify HEAD)" ' # URL supplied to fetch matches the url of the configured branch's remote and # the merge spec matches the branch the remote HEAD points to test_expect_success 'fetch from GIT URL with a non-applying branch..merge [2]' ' one_ref=$(cd one && git symbolic-ref HEAD) && git config branch.master.remote blub && git config branch.master.merge "$one_ref" && git update-ref -d FETCH_HEAD && git fetch one && test $one_head = "$(git rev-parse --verify FETCH_HEAD)" && test $this_head = "$(git rev-parse --verify HEAD)" ' # URL supplied to fetch matches the url of the configured branch's remote, but # the merge spec does not match the branch the remote HEAD points to test_expect_success 'fetch from GIT URL with a non-applying branch..merge [3]' ' git config branch.master.merge "${one_ref}_not" && git update-ref -d FETCH_HEAD && git fetch one && test $one_head = "$(git rev-parse --verify FETCH_HEAD)" && test $this_head = "$(git rev-parse --verify HEAD)" ' # the strange name is: a\!'b test_expect_success 'quoting of a strangely named repo' ' test_must_fail git fetch "a\\!'''''b" > result 2>&1 && cat result && grep "fatal: '''''a\\\\!'''''b'''''" result ' test_expect_success 'bundle should record HEAD correctly' ' cd "$D" && git bundle create bundle5 HEAD master && git bundle list-heads bundle5 >actual && for h in HEAD refs/heads/master do echo "$(git rev-parse --verify $h) $h" done >expect && test_cmp expect actual ' test_expect_success 'mark initial state of origin/master' ' ( cd three && git tag base-origin-master refs/remotes/origin/master ) ' test_expect_success 'explicit fetch should update tracking' ' cd "$D" && git branch -f side && ( cd three && git update-ref refs/remotes/origin/master base-origin-master && o=$(git rev-parse --verify refs/remotes/origin/master) && git fetch origin master && n=$(git rev-parse --verify refs/remotes/origin/master) && test "$o" != "$n" && test_must_fail git rev-parse --verify refs/remotes/origin/side ) ' test_expect_success 'explicit pull should update tracking' ' cd "$D" && git branch -f side && ( cd three && git update-ref refs/remotes/origin/master base-origin-master && o=$(git rev-parse --verify refs/remotes/origin/master) && git pull origin master && n=$(git rev-parse --verify refs/remotes/origin/master) && test "$o" != "$n" && test_must_fail git rev-parse --verify refs/remotes/origin/side ) ' test_expect_success 'explicit --refmap is allowed only with command-line refspec' ' cd "$D" && ( cd three && test_must_fail git fetch --refmap="*:refs/remotes/none/*" ) ' test_expect_success 'explicit --refmap option overrides remote.*.fetch' ' cd "$D" && git branch -f side && ( cd three && git update-ref refs/remotes/origin/master base-origin-master && o=$(git rev-parse --verify refs/remotes/origin/master) && git fetch --refmap="refs/heads/*:refs/remotes/other/*" origin master && n=$(git rev-parse --verify refs/remotes/origin/master) && test "$o" = "$n" && test_must_fail git rev-parse --verify refs/remotes/origin/side && git rev-parse --verify refs/remotes/other/master ) ' test_expect_success 'explicitly empty --refmap option disables remote.*.fetch' ' cd "$D" && git branch -f side && ( cd three && git update-ref refs/remotes/origin/master base-origin-master && o=$(git rev-parse --verify refs/remotes/origin/master) && git fetch --refmap="" origin master && n=$(git rev-parse --verify refs/remotes/origin/master) && test "$o" = "$n" && test_must_fail git rev-parse --verify refs/remotes/origin/side ) ' test_expect_success 'configured fetch updates tracking' ' cd "$D" && git branch -f side && ( cd three && git update-ref refs/remotes/origin/master base-origin-master && o=$(git rev-parse --verify refs/remotes/origin/master) && git fetch origin && n=$(git rev-parse --verify refs/remotes/origin/master) && test "$o" != "$n" && git rev-parse --verify refs/remotes/origin/side ) ' test_expect_success 'non-matching refspecs do not confuse tracking update' ' cd "$D" && git update-ref refs/odd/location HEAD && ( cd three && git update-ref refs/remotes/origin/master base-origin-master && git config --add remote.origin.fetch \ refs/odd/location:refs/remotes/origin/odd && o=$(git rev-parse --verify refs/remotes/origin/master) && git fetch origin master && n=$(git rev-parse --verify refs/remotes/origin/master) && test "$o" != "$n" && test_must_fail git rev-parse --verify refs/remotes/origin/odd ) ' test_expect_success 'pushing nonexistent branch by mistake should not segv' ' cd "$D" && test_must_fail git push seven no:no ' test_expect_success 'auto tag following fetches minimum' ' cd "$D" && git clone .git follow && git checkout HEAD^0 && ( for i in 1 2 3 4 5 6 7 do echo $i >>file && git commit -m $i -a && git tag -a -m $i excess-$i || exit 1 done ) && git checkout master && ( cd follow && git fetch ) ' test_expect_success 'refuse to fetch into the current branch' ' test_must_fail git fetch . side:master ' test_expect_success 'fetch into the current branch with --update-head-ok' ' git fetch --update-head-ok . side:master ' test_expect_success 'fetch --dry-run' ' rm -f .git/FETCH_HEAD && git fetch --dry-run . && ! test -f .git/FETCH_HEAD ' test_expect_success "should be able to fetch with duplicate refspecs" ' mkdir dups && ( cd dups && git init && git config branch.master.remote three && git config remote.three.url ../three/.git && git config remote.three.fetch +refs/heads/*:refs/remotes/origin/* && git config --add remote.three.fetch +refs/heads/*:refs/remotes/origin/* && git fetch three ) ' # configured prune tests proc set_config_tristate { # var=$1 val=$2 matchstr $2 { unset { test_unconfig $1 } * { git config $1 $2 } } } proc test_configured_prune { global fetch_prune := $1, remote_origin_prune := $2, cmdline := $3, expected := $4 test_expect_success "prune fetch.prune=$1 remote.origin.prune=$2$(3:+ $3); $4" ' # make sure a newbranch is there in . and also in one git branch -f newbranch && ( cd one && test_unconfig fetch.prune && test_unconfig remote.origin.prune && git fetch && git rev-parse --verify refs/remotes/origin/newbranch ) && # now remove it git branch -d newbranch && # then test ( cd one && set_config_tristate fetch.prune $fetch_prune && set_config_tristate remote.origin.prune $remote_origin_prune && git fetch $cmdline && case "$expected" in pruned) test_must_fail git rev-parse --verify refs/remotes/origin/newbranch ;; kept) git rev-parse --verify refs/remotes/origin/newbranch ;; esac ) ' } test_configured_prune unset unset "" kept test_configured_prune unset unset "--no-prune" kept test_configured_prune unset unset "--prune" pruned test_configured_prune false unset "" kept test_configured_prune false unset "--no-prune" kept test_configured_prune false unset "--prune" pruned test_configured_prune true unset "" pruned test_configured_prune true unset "--prune" pruned test_configured_prune true unset "--no-prune" kept test_configured_prune unset false "" kept test_configured_prune unset false "--no-prune" kept test_configured_prune unset false "--prune" pruned test_configured_prune false false "" kept test_configured_prune false false "--no-prune" kept test_configured_prune false false "--prune" pruned test_configured_prune true false "" kept test_configured_prune true false "--prune" pruned test_configured_prune true false "--no-prune" kept test_configured_prune unset true "" pruned test_configured_prune unset true "--no-prune" kept test_configured_prune unset true "--prune" pruned test_configured_prune false true "" pruned test_configured_prune false true "--no-prune" kept test_configured_prune false true "--prune" pruned test_configured_prune true true "" pruned test_configured_prune true true "--prune" pruned test_configured_prune true true "--no-prune" kept test_expect_success 'all boundary commits are excluded' ' test_commit base && test_commit oneside && git checkout HEAD^ && test_commit otherside && git checkout master && test_tick && git merge otherside && ad=$(git log --no-walk --format=%ad HEAD) && git bundle create twoside-boundary.bdl master --since="$ad" && convert_bundle_to_pack twoside-boundary.pack && pack=$(git index-pack --fix-thin --stdin &1 | head -n1 >../actual ) && echo "From ${D}/." >expect && test_i18ncmp expect actual ' test_expect_success 'branchname D/F conflict resolved by --prune' ' git branch dir/file && git clone . prune-df-conflict && git branch -D dir/file && git branch dir && ( cd prune-df-conflict && git fetch --prune && git rev-parse origin/dir >../actual ) && git rev-parse dir >expect && test_cmp expect actual ' test_expect_success 'fetching a one-level ref works' ' test_commit extra && git reset --hard HEAD^ && git update-ref refs/foo extra && git init one-level && ( cd one-level && git fetch .. HEAD refs/foo ) ' test_expect_success 'fetching with auto-gc does not lock up' ' write_script askyesno <<-\EOF && echo "$*" && false EOF git clone "file://$D" auto-gc && test_commit test2 && ( cd auto-gc && git config gc.autoPackLimit 1 && git config gc.autoDetach false && GIT_ASK_YESNO="$D/askyesno" git fetch >fetch.out 2>&1 && ! grep "Should I try again" fetch.out ) ' test_expect_success C_LOCALE_OUTPUT 'fetch aligned output' ' git clone . full-output && test_commit looooooooooooong-tag && ( cd full-output && git -c fetch.output=full fetch origin 2>&1 | \ grep -e "->" | cut -c 22- >../actual ) && cat >expect <<-\EOF && master -> origin/master looooooooooooong-tag -> looooooooooooong-tag EOF test_cmp expect actual ' test_expect_success C_LOCALE_OUTPUT 'fetch compact output' ' git clone . compact && test_commit extraaa && ( cd compact && git -c fetch.output=compact fetch origin 2>&1 | \ grep -e "->" | cut -c 22- >../actual ) && cat >expect <<-\EOF && master -> origin/* extraaa -> * EOF test_cmp expect actual ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"Per branch config variables affects \"git fetch\".\n"> <"\n">)} spids: [7] ) ] spids: [7] ) (C {(.)} {(./test-lib.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:D) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: spids: [20 22] ) } spids: [19] ) ] spids: [19] ) (FuncDef name: test_bundle_object_count body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(git)} {(verify-pack)} {(-v)} {(DQ ($ VSub_Number "$1"))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(verify.out)} spids:[43])] ) (C {(test)} {(DQ ($ VSub_Number "$2"))} {(Lit_Other "=")} { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(SQ <"^[0-9a-f]\\{40\\} ">)} {(verify.out)}) (C {(wc)} {(-l)}) ] negated: False ) ] ) left_token: spids: [57 71] ) } ) ] op_id: Op_DAmp ) ] spids: [30] ) spids: [25 29] ) (FuncDef name: convert_bundle_to_pack body: (BraceGroup children: [ (While cond: [ (AndOr children: [(C {(read)} {(x)}) (C {(test)} {(-n)} {(DQ ($ VSub_Name "$x"))})] op_id: Op_DAmp ) ] body: (DoGroup children: [(Sentence child:(C {(Lit_Other ":")}) terminator:)] spids: [101 108] ) ) (C {(cat)}) ] spids: [81] ) spids: [76 80] ) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\techo >file original &&\n"> <"\tgit add file &&\n"> <"\tgit commit -a -m original"> ) } ) (C {(test_expect_success)} {(DQ ("clone and setup child repos"))} { (SQ <"\n"> <"\tgit clone . one &&\n"> <"\t(\n"> <"\t\tcd one &&\n"> <"\t\techo >file updated by one &&\n"> <"\t\tgit commit -a -m \"updated by one\"\n"> <"\t) &&\n"> <"\tgit clone . two &&\n"> <"\t(\n"> <"\t\tcd two &&\n"> <"\t\tgit config branch.master.remote one &&\n"> <"\t\tgit config remote.one.url ../one/.git/ &&\n"> <"\t\tgit config remote.one.fetch refs/heads/master:refs/heads/one\n"> <"\t) &&\n"> <"\tgit clone . three &&\n"> <"\t(\n"> <"\t\tcd three &&\n"> <"\t\tgit config branch.master.remote two &&\n"> <"\t\tgit config branch.master.merge refs/heads/one &&\n"> <"\t\tmkdir -p .git/remotes &&\n"> <"\t\t{\n"> <"\t\t\techo \"URL: ../two/.git/\"\n"> <"\t\t\techo \"Pull: refs/heads/master:refs/heads/two\"\n"> <"\t\t\techo \"Pull: refs/heads/one:refs/heads/one\"\n"> <"\t\t} >.git/remotes/two\n"> <"\t) &&\n"> <"\tgit clone . bundle &&\n"> <"\tgit clone . seven\n"> ) } ) (C {(test_expect_success)} {(DQ ("fetch test"))} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\techo >file updated by origin &&\n"> <"\tgit commit -a -m \"updated by origin\" &&\n"> <"\tcd two &&\n"> <"\tgit fetch &&\n"> <"\ttest -f .git/refs/heads/one &&\n"> <"\tmine=$(git rev-parse refs/heads/one) &&\n"> <"\this=$(cd ../one && git rev-parse refs/heads/master) &&\n"> <"\ttest \"z$mine\" = \"z$his\"\n"> ) } ) (C {(test_expect_success)} {(DQ ("fetch test for-merge"))} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tcd three &&\n"> <"\tgit fetch &&\n"> <"\ttest -f .git/refs/heads/two &&\n"> <"\ttest -f .git/refs/heads/one &&\n"> <"\tmaster_in_two=$(cd ../two && git rev-parse master) &&\n"> <"\tone_in_two=$(cd ../two && git rev-parse one) &&\n"> <"\t{\n"> <"\t\techo \"$one_in_two\t\"\n"> <"\t\techo \"$master_in_two\tnot-for-merge\"\n"> <"\t} >expected &&\n"> <"\tcut -f -2 .git/FETCH_HEAD >actual &&\n"> <"\ttest_cmp expected actual"> ) } ) (C {(test_expect_success)} {(SQ <"fetch --prune on its own works as expected">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit clone . prune &&\n"> <"\tcd prune &&\n"> <"\tgit update-ref refs/remotes/origin/extrabranch master &&\n"> <"\n"> <"\tgit fetch --prune origin &&\n"> <"\ttest_must_fail git rev-parse origin/extrabranch\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch --prune with a branch name keeps branches">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit clone . prune-branch &&\n"> <"\tcd prune-branch &&\n"> <"\tgit update-ref refs/remotes/origin/extrabranch master &&\n"> <"\n"> <"\tgit fetch --prune origin master &&\n"> <"\tgit rev-parse origin/extrabranch\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch --prune with a namespace keeps other namespaces">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit clone . prune-namespace &&\n"> <"\tcd prune-namespace &&\n"> <"\n"> <"\tgit fetch --prune origin refs/heads/a/*:refs/remotes/origin/a/* &&\n"> <"\tgit rev-parse origin/master\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch --prune handles overlapping refspecs">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit update-ref refs/pull/42/head master &&\n"> <"\tgit clone . prune-overlapping &&\n"> <"\tcd prune-overlapping &&\n"> <"\tgit config --add remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* &&\n"> <"\n"> <"\tgit fetch --prune origin &&\n"> <"\tgit rev-parse origin/master &&\n"> <"\tgit rev-parse origin/pr/42 &&\n"> <"\n"> <"\tgit config --unset-all remote.origin.fetch &&\n"> <"\tgit config remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* &&\n"> <"\tgit config --add remote.origin.fetch refs/heads/*:refs/remotes/origin/* &&\n"> <"\n"> <"\tgit fetch --prune origin &&\n"> <"\tgit rev-parse origin/master &&\n"> <"\tgit rev-parse origin/pr/42\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch --prune --tags prunes branches but not tags">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit clone . prune-tags &&\n"> <"\tcd prune-tags &&\n"> <"\tgit tag sometag master &&\n"> <"\t# Create what looks like a remote-tracking branch from an earlier\n"> <"\t# fetch that has since been deleted from the remote:\n"> <"\tgit update-ref refs/remotes/origin/fake-remote master &&\n"> <"\n"> <"\tgit fetch --prune --tags origin &&\n"> <"\tgit rev-parse origin/master &&\n"> <"\ttest_must_fail git rev-parse origin/fake-remote &&\n"> <"\tgit rev-parse sometag\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch --prune --tags with branch does not prune other things">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit clone . prune-tags-branch &&\n"> <"\tcd prune-tags-branch &&\n"> <"\tgit tag sometag master &&\n"> <"\tgit update-ref refs/remotes/origin/extrabranch master &&\n"> <"\n"> <"\tgit fetch --prune --tags origin master &&\n"> <"\tgit rev-parse origin/extrabranch &&\n"> <"\tgit rev-parse sometag\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch --prune --tags with refspec prunes based on refspec">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit clone . prune-tags-refspec &&\n"> <"\tcd prune-tags-refspec &&\n"> <"\tgit tag sometag master &&\n"> <"\tgit update-ref refs/remotes/origin/foo/otherbranch master &&\n"> <"\tgit update-ref refs/remotes/origin/extrabranch master &&\n"> <"\n"> <"\tgit fetch --prune --tags origin refs/heads/foo/*:refs/remotes/origin/foo/* &&\n"> <"\ttest_must_fail git rev-parse refs/remotes/origin/foo/otherbranch &&\n"> <"\tgit rev-parse origin/extrabranch &&\n"> <"\tgit rev-parse sometag\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch tags when there is no tags">)} { (SQ <"\n"> <"\n"> <" cd \"$D\" &&\n"> <"\n"> <" mkdir notags &&\n"> <" cd notags &&\n"> <" git init &&\n"> <"\n"> <" git fetch -t ..\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch following tags">)} {(SQ <"\n"> <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit tag -a -m ">) (annotated) (SQ <" anno HEAD &&\n"> <"\tgit tag light HEAD &&\n"> <"\n"> <"\tmkdir four &&\n"> <"\tcd four &&\n"> <"\tgit init &&\n"> <"\n"> <"\tgit fetch .. :track &&\n"> <"\tgit show-ref --verify refs/tags/anno &&\n"> <"\tgit show-ref --verify refs/tags/light\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch uses remote ref names to describe new refs">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit init descriptive &&\n"> <"\t(\n"> <"\t\tcd descriptive &&\n"> <"\t\tgit config remote.o.url .. &&\n"> <"\t\tgit config remote.o.fetch \"refs/heads/*:refs/crazyheads/*\" &&\n"> <"\t\tgit config --add remote.o.fetch \"refs/others/*:refs/heads/*\" &&\n"> <"\t\tgit fetch o\n"> <"\t) &&\n"> <"\tgit tag -a -m \"Descriptive tag\" descriptive-tag &&\n"> <"\tgit branch descriptive-branch &&\n"> <"\tgit checkout descriptive-branch &&\n"> <"\techo \"Nuts\" >crazy &&\n"> <"\tgit add crazy &&\n"> <"\tgit commit -a -m \"descriptive commit\" &&\n"> <"\tgit update-ref refs/others/crazy HEAD &&\n"> <"\t(\n"> <"\t\tcd descriptive &&\n"> <"\t\tgit fetch o 2>actual &&\n"> <"\t\tgrep \" -> refs/crazyheads/descriptive-branch$\" actual |\n"> <"\t\ttest_i18ngrep \"new branch\" &&\n"> <"\t\tgrep \" -> descriptive-tag$\" actual |\n"> <"\t\ttest_i18ngrep \"new tag\" &&\n"> <"\t\tgrep \" -> crazy$\" actual |\n"> <"\t\ttest_i18ngrep \"new ref\"\n"> <"\t) &&\n"> <"\tgit checkout master\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch must not resolve short tag name">)} { (SQ <"\n"> <"\n"> <"\tcd \"$D\" &&\n"> <"\n"> <"\tmkdir five &&\n"> <"\tcd five &&\n"> <"\tgit init &&\n"> <"\n"> <"\ttest_must_fail git fetch .. anno:five\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch can now resolve short remote name">)} { (SQ <"\n"> <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit update-ref refs/remotes/six/HEAD HEAD &&\n"> <"\n"> <"\tmkdir six &&\n"> <"\tcd six &&\n"> <"\tgit init &&\n"> <"\n"> <"\tgit fetch .. six:six\n"> ) } ) (C {(test_expect_success)} {(SQ <"create bundle 1">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\techo >file updated again by origin &&\n"> <"\tgit commit -a -m \"tip\" &&\n"> <"\tgit bundle create bundle1 master^..master\n"> ) } ) (C {(test_expect_success)} {(SQ <"header of bundle looks right">)} { (SQ <"\n"> <"\thead -n 1 \"$D\"/bundle1 | grep \"^#\" &&\n"> <"\thead -n 2 \"$D\"/bundle1 | grep \"^-[0-9a-f]\\{40\\} \" &&\n"> <"\thead -n 3 \"$D\"/bundle1 | grep \"^[0-9a-f]\\{40\\} \" &&\n"> <"\thead -n 4 \"$D\"/bundle1 | grep \"^$\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"create bundle 2">)} {(SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit bundle create bundle2 master~2..master\n">)} ) (C {(test_expect_success)} {(SQ <"unbundle 1">)} { (SQ <"\n"> <"\tcd \"$D/bundle\" &&\n"> <"\tgit checkout -b some-branch &&\n"> <"\ttest_must_fail git fetch \"$D/bundle1\" master:master\n"> ) } ) (C {(test_expect_success)} {(SQ <"bundle 1 has only 3 files ">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tconvert_bundle_to_pack bundle.pack &&\n"> <"\tgit index-pack bundle.pack &&\n"> <"\ttest_bundle_object_count bundle.pack 3\n"> ) } ) (C {(test_expect_success)} {(SQ <"unbundle 2">)} { (SQ <"\n"> <"\tcd \"$D/bundle\" &&\n"> <"\tgit fetch ../bundle2 master:master &&\n"> <"\ttest \"tip\" = \"$(git log -1 --pretty=oneline master | cut -b42-)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"bundle does not prerequisite objects">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\ttouch file2 &&\n"> <"\tgit add file2 &&\n"> <"\tgit commit -m add.file2 file2 &&\n"> <"\tgit bundle create bundle3 -1 HEAD &&\n"> <"\tconvert_bundle_to_pack bundle.pack &&\n"> <"\tgit index-pack bundle.pack &&\n"> <"\ttest_bundle_object_count bundle.pack 3\n"> ) } ) (C {(test_expect_success)} {(SQ <"bundle should be able to create a full history">)} {(SQ <"\n"> <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit tag -a -m ">) (1.0) (SQ <" v1.0 master &&\n"> <"\tgit bundle create bundle4 v1.0\n"> <"\n">) } ) (C {(test_expect_success)} {(SQ <"fetch with a non-applying branch..merge">)} { (SQ <"\n"> <"\tgit config branch.master.remote yeti &&\n"> <"\tgit config branch.master.merge refs/heads/bigfoot &&\n"> <"\tgit config remote.blub.url one &&\n"> <"\tgit config remote.blub.fetch \"refs/heads/*:refs/remotes/one/*\" &&\n"> <"\tgit fetch blub\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch from GIT URL with a non-applying branch..merge [1]">)} { (SQ <"\n"> <"\tone_head=$(cd one && git rev-parse HEAD) &&\n"> <"\tthis_head=$(git rev-parse HEAD) &&\n"> <"\tgit update-ref -d FETCH_HEAD &&\n"> <"\tgit fetch one &&\n"> <"\ttest $one_head = \"$(git rev-parse --verify FETCH_HEAD)\" &&\n"> <"\ttest $this_head = \"$(git rev-parse --verify HEAD)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch from GIT URL with a non-applying branch..merge [2]">)} { (SQ <"\n"> <"\tone_ref=$(cd one && git symbolic-ref HEAD) &&\n"> <"\tgit config branch.master.remote blub &&\n"> <"\tgit config branch.master.merge \"$one_ref\" &&\n"> <"\tgit update-ref -d FETCH_HEAD &&\n"> <"\tgit fetch one &&\n"> <"\ttest $one_head = \"$(git rev-parse --verify FETCH_HEAD)\" &&\n"> <"\ttest $this_head = \"$(git rev-parse --verify HEAD)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch from GIT URL with a non-applying branch..merge [3]">)} { (SQ <"\n"> <"\tgit config branch.master.merge \"${one_ref}_not\" &&\n"> <"\tgit update-ref -d FETCH_HEAD &&\n"> <"\tgit fetch one &&\n"> <"\ttest $one_head = \"$(git rev-parse --verify FETCH_HEAD)\" &&\n"> <"\ttest $this_head = \"$(git rev-parse --verify HEAD)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"quoting of a strangely named repo">)} {(SQ <"\n"> <"\ttest_must_fail git fetch \"a\\\\!">) (EscapedLiteralPart token:) (SQ <"b\" > result 2>&1 &&\n"> <"\tcat result &&\n"> <"\tgrep \"fatal: ">) (EscapedLiteralPart token:) (SQ <"a\\\\\\\\!">) (EscapedLiteralPart token:) (SQ ) (EscapedLiteralPart token:) (SQ <"\" result\n">) } ) (C {(test_expect_success)} {(SQ <"bundle should record HEAD correctly">)} { (SQ <"\n"> <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit bundle create bundle5 HEAD master &&\n"> <"\tgit bundle list-heads bundle5 >actual &&\n"> <"\tfor h in HEAD refs/heads/master\n"> <"\tdo\n"> <"\t\techo \"$(git rev-parse --verify $h) $h\"\n"> <"\tdone >expect &&\n"> <"\ttest_cmp expect actual\n"> <"\n"> ) } ) (C {(test_expect_success)} {(SQ <"mark initial state of origin/master">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd three &&\n"> <"\t\tgit tag base-origin-master refs/remotes/origin/master\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"explicit fetch should update tracking">)} { (SQ <"\n"> <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit branch -f side &&\n"> <"\t(\n"> <"\t\tcd three &&\n"> <"\t\tgit update-ref refs/remotes/origin/master base-origin-master &&\n"> <"\t\to=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\tgit fetch origin master &&\n"> <"\t\tn=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\ttest \"$o\" != \"$n\" &&\n"> <"\t\ttest_must_fail git rev-parse --verify refs/remotes/origin/side\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"explicit pull should update tracking">)} { (SQ <"\n"> <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit branch -f side &&\n"> <"\t(\n"> <"\t\tcd three &&\n"> <"\t\tgit update-ref refs/remotes/origin/master base-origin-master &&\n"> <"\t\to=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\tgit pull origin master &&\n"> <"\t\tn=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\ttest \"$o\" != \"$n\" &&\n"> <"\t\ttest_must_fail git rev-parse --verify refs/remotes/origin/side\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"explicit --refmap is allowed only with command-line refspec">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\t(\n"> <"\t\tcd three &&\n"> <"\t\ttest_must_fail git fetch --refmap=\"*:refs/remotes/none/*\"\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"explicit --refmap option overrides remote.*.fetch">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit branch -f side &&\n"> <"\t(\n"> <"\t\tcd three &&\n"> <"\t\tgit update-ref refs/remotes/origin/master base-origin-master &&\n"> <"\t\to=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\tgit fetch --refmap=\"refs/heads/*:refs/remotes/other/*\" origin master &&\n"> <"\t\tn=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\ttest \"$o\" = \"$n\" &&\n"> <"\t\ttest_must_fail git rev-parse --verify refs/remotes/origin/side &&\n"> <"\t\tgit rev-parse --verify refs/remotes/other/master\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"explicitly empty --refmap option disables remote.*.fetch">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit branch -f side &&\n"> <"\t(\n"> <"\t\tcd three &&\n"> <"\t\tgit update-ref refs/remotes/origin/master base-origin-master &&\n"> <"\t\to=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\tgit fetch --refmap=\"\" origin master &&\n"> <"\t\tn=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\ttest \"$o\" = \"$n\" &&\n"> <"\t\ttest_must_fail git rev-parse --verify refs/remotes/origin/side\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"configured fetch updates tracking">)} { (SQ <"\n"> <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit branch -f side &&\n"> <"\t(\n"> <"\t\tcd three &&\n"> <"\t\tgit update-ref refs/remotes/origin/master base-origin-master &&\n"> <"\t\to=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\tgit fetch origin &&\n"> <"\t\tn=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\ttest \"$o\" != \"$n\" &&\n"> <"\t\tgit rev-parse --verify refs/remotes/origin/side\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"non-matching refspecs do not confuse tracking update">)} { (SQ <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit update-ref refs/odd/location HEAD &&\n"> <"\t(\n"> <"\t\tcd three &&\n"> <"\t\tgit update-ref refs/remotes/origin/master base-origin-master &&\n"> <"\t\tgit config --add remote.origin.fetch \\\n"> <"\t\t\trefs/odd/location:refs/remotes/origin/odd &&\n"> <"\t\to=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\tgit fetch origin master &&\n"> <"\t\tn=$(git rev-parse --verify refs/remotes/origin/master) &&\n"> <"\t\ttest \"$o\" != \"$n\" &&\n"> <"\t\ttest_must_fail git rev-parse --verify refs/remotes/origin/odd\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"pushing nonexistent branch by mistake should not segv">)} {(SQ <"\n"> <"\n"> <"\tcd \"$D\" &&\n"> <"\ttest_must_fail git push seven no:no\n"> <"\n">)} ) (C {(test_expect_success)} {(SQ <"auto tag following fetches minimum">)} { (SQ <"\n"> <"\n"> <"\tcd \"$D\" &&\n"> <"\tgit clone .git follow &&\n"> <"\tgit checkout HEAD^0 &&\n"> <"\t(\n"> <"\t\tfor i in 1 2 3 4 5 6 7\n"> <"\t\tdo\n"> <"\t\t\techo $i >>file &&\n"> <"\t\t\tgit commit -m $i -a &&\n"> <"\t\t\tgit tag -a -m $i excess-$i || exit 1\n"> <"\t\tdone\n"> <"\t) &&\n"> <"\tgit checkout master &&\n"> <"\t(\n"> <"\t\tcd follow &&\n"> <"\t\tgit fetch\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"refuse to fetch into the current branch">)} {(SQ <"\n"> <"\n"> <"\ttest_must_fail git fetch . side:master\n"> <"\n">)} ) (C {(test_expect_success)} {(SQ <"fetch into the current branch with --update-head-ok">)} {(SQ <"\n"> <"\n"> <"\tgit fetch --update-head-ok . side:master\n"> <"\n">)} ) (C {(test_expect_success)} {(SQ <"fetch --dry-run">)} { (SQ <"\n"> <"\n"> <"\trm -f .git/FETCH_HEAD &&\n"> <"\tgit fetch --dry-run . &&\n"> <"\t! test -f .git/FETCH_HEAD\n"> ) } ) (C {(test_expect_success)} {(DQ ("should be able to fetch with duplicate refspecs"))} { (SQ <"\n"> <"\tmkdir dups &&\n"> <"\t(\n"> <"\t\tcd dups &&\n"> <"\t\tgit init &&\n"> <"\t\tgit config branch.master.remote three &&\n"> <"\t\tgit config remote.three.url ../three/.git &&\n"> <"\t\tgit config remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&\n"> <"\t\tgit config --add remote.three.fetch +refs/heads/*:refs/remotes/origin/* &&\n"> <"\t\tgit fetch three\n"> <"\t)\n"> ) } ) (FuncDef name: set_config_tristate body: (BraceGroup children: [ (Case to_match: {(DQ ($ VSub_Number "$2"))} arms: [ (case_arm pat_list: [{(unset)}] action: [(C {(test_unconfig)} {(DQ ($ VSub_Number "$1"))})] spids: [1045 1046 1054 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (C {(git)} {(config)} {(DQ ($ VSub_Number "$1"))} {(DQ ($ VSub_Number "$2"))}) ] spids: [1057 1058 1072 -1] ) ] spids: [1036 1042 1075] ) ] spids: [1029] ) spids: [1024 1028] ) (FuncDef name: test_configured_prune body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fetch_prune) op: Equal rhs: {($ VSub_Number "$1")} spids: [1088] ) (assign_pair lhs: (LhsName name:remote_origin_prune) op: Equal rhs: {($ VSub_Number "$2")} spids: [1091] ) (assign_pair lhs: (LhsName name:cmdline) op: Equal rhs: {($ VSub_Number "$3")} spids: [1094] ) (assign_pair lhs: (LhsName name:expected) op: Equal rhs: {($ VSub_Number "$4")} spids: [1097] ) ] spids: [1088] ) (C {(test_expect_success)} { (DQ ("prune fetch.prune=") ($ VSub_Number "$1") (" remote.origin.prune=") ($ VSub_Number "$2") (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonPlus arg_word: {(" ") ($ VSub_Number "$3")} ) spids: [1109 1114] ) ("; ") ($ VSub_Number "$4") ) } { (SQ <"\n"> <"\t\t# make sure a newbranch is there in . and also in one\n"> <"\t\tgit branch -f newbranch &&\n"> <"\t\t(\n"> <"\t\t\tcd one &&\n"> <"\t\t\ttest_unconfig fetch.prune &&\n"> <"\t\t\ttest_unconfig remote.origin.prune &&\n"> <"\t\t\tgit fetch &&\n"> <"\t\t\tgit rev-parse --verify refs/remotes/origin/newbranch\n"> <"\t\t) &&\n"> <"\n"> <"\t\t# now remove it\n"> <"\t\tgit branch -d newbranch &&\n"> <"\n"> <"\t\t# then test\n"> <"\t\t(\n"> <"\t\t\tcd one &&\n"> <"\t\t\tset_config_tristate fetch.prune $fetch_prune &&\n"> <"\t\t\tset_config_tristate remote.origin.prune $remote_origin_prune &&\n"> <"\n"> <"\t\t\tgit fetch $cmdline &&\n"> <"\t\t\tcase \"$expected\" in\n"> <"\t\t\tpruned)\n"> <"\t\t\t\ttest_must_fail git rev-parse --verify refs/remotes/origin/newbranch\n"> <"\t\t\t\t;;\n"> <"\t\t\tkept)\n"> <"\t\t\t\tgit rev-parse --verify refs/remotes/origin/newbranch\n"> <"\t\t\t\t;;\n"> <"\t\t\tesac\n"> <"\t\t)\n"> <"\t"> ) } ) ] spids: [1085] ) spids: [1080 1084] ) (C {(test_configured_prune)} {(unset)} {(unset)} {(DQ )} {(kept)}) (C {(test_configured_prune)} {(unset)} {(unset)} {(DQ (--no-prune))} {(kept)}) (C {(test_configured_prune)} {(unset)} {(unset)} {(DQ (--prune))} {(pruned)}) (C {(test_configured_prune)} {(false)} {(unset)} {(DQ )} {(kept)}) (C {(test_configured_prune)} {(false)} {(unset)} {(DQ (--no-prune))} {(kept)}) (C {(test_configured_prune)} {(false)} {(unset)} {(DQ (--prune))} {(pruned)}) (C {(test_configured_prune)} {(true)} {(unset)} {(DQ )} {(pruned)}) (C {(test_configured_prune)} {(true)} {(unset)} {(DQ (--prune))} {(pruned)}) (C {(test_configured_prune)} {(true)} {(unset)} {(DQ (--no-prune))} {(kept)}) (C {(test_configured_prune)} {(unset)} {(false)} {(DQ )} {(kept)}) (C {(test_configured_prune)} {(unset)} {(false)} {(DQ (--no-prune))} {(kept)}) (C {(test_configured_prune)} {(unset)} {(false)} {(DQ (--prune))} {(pruned)}) (C {(test_configured_prune)} {(false)} {(false)} {(DQ )} {(kept)}) (C {(test_configured_prune)} {(false)} {(false)} {(DQ (--no-prune))} {(kept)}) (C {(test_configured_prune)} {(false)} {(false)} {(DQ (--prune))} {(pruned)}) (C {(test_configured_prune)} {(true)} {(false)} {(DQ )} {(kept)}) (C {(test_configured_prune)} {(true)} {(false)} {(DQ (--prune))} {(pruned)}) (C {(test_configured_prune)} {(true)} {(false)} {(DQ (--no-prune))} {(kept)}) (C {(test_configured_prune)} {(unset)} {(true)} {(DQ )} {(pruned)}) (C {(test_configured_prune)} {(unset)} {(true)} {(DQ (--no-prune))} {(kept)}) (C {(test_configured_prune)} {(unset)} {(true)} {(DQ (--prune))} {(pruned)}) (C {(test_configured_prune)} {(false)} {(true)} {(DQ )} {(pruned)}) (C {(test_configured_prune)} {(false)} {(true)} {(DQ (--no-prune))} {(kept)}) (C {(test_configured_prune)} {(false)} {(true)} {(DQ (--prune))} {(pruned)}) (C {(test_configured_prune)} {(true)} {(true)} {(DQ )} {(pruned)}) (C {(test_configured_prune)} {(true)} {(true)} {(DQ (--prune))} {(pruned)}) (C {(test_configured_prune)} {(true)} {(true)} {(DQ (--no-prune))} {(kept)}) (C {(test_expect_success)} {(SQ <"all boundary commits are excluded">)} { (SQ <"\n"> <"\ttest_commit base &&\n"> <"\ttest_commit oneside &&\n"> <"\tgit checkout HEAD^ &&\n"> <"\ttest_commit otherside &&\n"> <"\tgit checkout master &&\n"> <"\ttest_tick &&\n"> <"\tgit merge otherside &&\n"> <"\tad=$(git log --no-walk --format=%ad HEAD) &&\n"> <"\tgit bundle create twoside-boundary.bdl master --since=\"$ad\" &&\n"> <"\tconvert_bundle_to_pack twoside-boundary.pack &&\n"> <"\tpack=$(git index-pack --fix-thin --stdin <"\ttest_bundle_object_count .git/objects/pack/pack-${pack##pack\t}.pack 3\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetch --prune prints the remotes url">)} { (SQ <"\n"> <"\tgit branch goodbye &&\n"> <"\tgit clone . only-prunes &&\n"> <"\tgit branch -D goodbye &&\n"> <"\t(\n"> <"\t\tcd only-prunes &&\n"> <"\t\tgit fetch --prune origin 2>&1 | head -n1 >../actual\n"> <"\t) &&\n"> <"\techo \"From ${D}/.\" >expect &&\n"> <"\ttest_i18ncmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"branchname D/F conflict resolved by --prune">)} { (SQ <"\n"> <"\tgit branch dir/file &&\n"> <"\tgit clone . prune-df-conflict &&\n"> <"\tgit branch -D dir/file &&\n"> <"\tgit branch dir &&\n"> <"\t(\n"> <"\t\tcd prune-df-conflict &&\n"> <"\t\tgit fetch --prune &&\n"> <"\t\tgit rev-parse origin/dir >../actual\n"> <"\t) &&\n"> <"\tgit rev-parse dir >expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetching a one-level ref works">)} { (SQ <"\n"> <"\ttest_commit extra &&\n"> <"\tgit reset --hard HEAD^ &&\n"> <"\tgit update-ref refs/foo extra &&\n"> <"\tgit init one-level &&\n"> <"\t(\n"> <"\t\tcd one-level &&\n"> <"\t\tgit fetch .. HEAD refs/foo\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetching with auto-gc does not lock up">)} { (SQ <"\n"> <"\twrite_script askyesno <<-\\EOF &&\n"> <"\techo \"$*\" &&\n"> <"\tfalse\n"> <"\tEOF\n"> <"\tgit clone \"file://$D\" auto-gc &&\n"> <"\ttest_commit test2 &&\n"> <"\t(\n"> <"\t\tcd auto-gc &&\n"> <"\t\tgit config gc.autoPackLimit 1 &&\n"> <"\t\tgit config gc.autoDetach false &&\n"> <"\t\tGIT_ASK_YESNO=\"$D/askyesno\" git fetch >fetch.out 2>&1 &&\n"> <"\t\t! grep \"Should I try again\" fetch.out\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(C_LOCALE_OUTPUT)} {(SQ <"fetch aligned output">)} { (SQ <"\n"> <"\tgit clone . full-output &&\n"> <"\ttest_commit looooooooooooong-tag &&\n"> <"\t(\n"> <"\t\tcd full-output &&\n"> <"\t\tgit -c fetch.output=full fetch origin 2>&1 | \\\n"> <"\t\t\tgrep -e \"->\" | cut -c 22- >../actual\n"> <"\t) &&\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\tmaster -> origin/master\n"> <"\tlooooooooooooong-tag -> looooooooooooong-tag\n"> <"\tEOF\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(C_LOCALE_OUTPUT)} {(SQ <"fetch compact output">)} { (SQ <"\n"> <"\tgit clone . compact &&\n"> <"\ttest_commit extraaa &&\n"> <"\t(\n"> <"\t\tcd compact &&\n"> <"\t\tgit -c fetch.output=compact fetch origin 2>&1 | \\\n"> <"\t\t\tgrep -e \"->\" | cut -c 22- >../actual\n"> <"\t) &&\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\tmaster -> origin/*\n"> <"\textraaa -> *\n"> <"\tEOF\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_done)}) ] )