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/t3432-rebase-fast-forward.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 / t3432-rebase-fast-forward.sh` 147 lines ยท 5344 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2019 Denton Liu 4 # 5 6 test_description='ensure rebase fast-forwards commits when possible' 7 8 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh 12 13 test_expect_success setup ' 14 # Commit dates are hardcoded to 2005, and the reflog entries will have 15 # a matching timestamp. Maintenance may thus immediately expire 16 # reflogs if it was running. 17 git config set gc.reflogExpire never && 18 git config set gc.reflogExpireUnreachable never && 19 20 test_commit A && 21 test_commit B && 22 test_commit C && 23 test_commit D && 24 git checkout -t -b side 25 ' 26 27 test_rebase_same_head () { 28 status_n="$1" && 29 shift && 30 what_n="$1" && 31 shift && 32 cmp_n="$1" && 33 shift && 34 status_f="$1" && 35 shift && 36 what_f="$1" && 37 shift && 38 cmp_f="$1" && 39 shift && 40 test_rebase_same_head_ $status_n $what_n $cmp_n 0 " --apply" "$*" && 41 test_rebase_same_head_ $status_f $what_f $cmp_f 0 " --apply --no-ff" "$*" 42 test_rebase_same_head_ $status_n $what_n $cmp_n 0 " --merge" "$*" && 43 test_rebase_same_head_ $status_f $what_f $cmp_f 0 " --merge --no-ff" "$*" 44 test_rebase_same_head_ $status_n $what_n $cmp_n 1 " --merge" "$*" && 45 test_rebase_same_head_ $status_f $what_f $cmp_f 1 " --merge --no-ff" "$*" 46 } 47 48 test_rebase_same_head_ () { 49 status="$1" && 50 shift && 51 what="$1" && 52 shift && 53 cmp="$1" && 54 shift && 55 abbreviate="$1" && 56 shift && 57 flag="$1" 58 shift && 59 if test $abbreviate -eq 1 60 then 61 msg="git rebase$flag $* (rebase.abbreviateCommands = true) with $changes is $what with $cmp HEAD" 62 else 63 msg="git rebase$flag $* with $changes is $what with $cmp HEAD" 64 fi && 65 test_expect_$status "$msg" " 66 if test $abbreviate -eq 1 67 then 68 test_config rebase.abbreviateCommands true 69 fi && 70 oldhead=\$(git rev-parse HEAD) && 71 test_when_finished 'git reset --hard \$oldhead' && 72 git reflog HEAD >expect && 73 git rebase$flag $* >stdout && 74 git reflog HEAD >actual && 75 if test $what = work 76 then 77 old=\$(wc -l