Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t3419-rebase-patch-id.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t3419-rebase-patch-id.sh` 117 lines ยท 2548 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='git rebase - test patch id computation' 4 5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh 9 10 scramble () { 11 i=0 12 while read x 13 do 14 if test $i -ne 0 15 then 16 echo "$x" 17 fi 18 i=$((($i+1) % 10)) 19 done <"$1" >"$1.new" 20 mv -f "$1.new" "$1" 21 } 22 23 test_expect_success 'setup' ' 24 git commit --allow-empty -m initial && 25 git tag root 26 ' 27 28 test_expect_success 'setup: 500 lines' ' 29 rm -f .gitattributes && 30 git checkout -q -f main && 31 git reset --hard root && 32 test_seq 500 >file && 33 git add file && 34 git commit -q -m initial && 35 git branch -f other && 36 37 scramble file && 38 git add file && 39 git commit -q -m "change big file" && 40 41 git checkout -q other && 42 : >newfile && 43 git add newfile && 44 git commit -q -m "add small file" && 45 46 git cherry-pick main >/dev/null 2>&1 && 47 48 git branch -f squashed main && 49 git checkout -q -f squashed && 50 git reset -q --soft HEAD~2 && 51 git commit -q -m squashed && 52 53 git branch -f mode main && 54 git checkout -q -f mode && 55 test_chmod +x file && 56 git commit -q -a --amend && 57 58 git branch -f modeother other && 59 git checkout -q -f modeother && 60 test_chmod +x file && 61 git commit -q -a --amend 62 ' 63 64 test_expect_success 'detect upstream patch' ' 65 git checkout -q main^{} && 66 scramble file && 67 git add file && 68 git commit -q -m "change big file again" && 69 git checkout -q other^{} && 70 git rebase main && 71 git rev-list main...HEAD~ >revs && 72 test_must_be_empty revs 73 ' 74 75 test_expect_success 'detect upstream patch binary' ' 76 echo "file binary" >.gitattributes && 77 git checkout -q other^{} && 78 git rebase main && 79 git rev-list main...HEAD~ >revs && 80 test_must_be_empty revs && 81 test_when_finished "rm .gitattributes" 82 ' 83 84 test_expect_success 'detect upstream patch modechange' ' 85 git checkout -q modeother^{} && 86 git rebase mode && 87 git rev-list mode...HEAD~ >revs && 88 test_must_be_empty revs 89 ' 90 91 test_expect_success 'do not drop patch' ' 92 git checkout -q other^{} && 93 test_must_fail git rebase squashed && 94 test_when_finished "git rebase --abort" 95 ' 96 97 test_expect_success 'do not drop patch binary' ' 98 echo "file binary" >.gitattributes && 99 git checkout -q other^{} && 100 test_must_fail git rebase squashed && 101 test_when_finished "git rebase --abort" && 102 test_when_finished "rm .gitattributes" 103 ' 104 105 test_expect_success 'do not drop patch modechange' ' 106 git checkout -q modeother^{} && 107 git rebase other && 108 cat >expected <<-\EOF && 109 diff --git a/file b/file 110 old mode 100644 111 new mode 100755 112 EOF 113 git diff HEAD~ >modediff && 114 test_cmp expected modediff 115 ' 116 117 test_done