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/t4214-log-graph-octopus.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 / t4214-log-graph-octopus.sh` 350 lines ยท 10263 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='git log --graph of skewed left octopus merge.' 4 5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh 9 . "$TEST_DIRECTORY"/lib-log-graph.sh 10 11 test_cmp_graph () { 12 cat >expect && 13 lib_test_cmp_graph --color=never --date-order --format=%s "$@" 14 } 15 16 test_cmp_colored_graph () { 17 lib_test_cmp_colored_graph --date-order --format=%s "$@" 18 } 19 20 test_expect_success 'set up merge history' ' 21 test_commit initial && 22 for i in 1 2 3 4 ; do 23 git checkout main -b $i || return $? 24 # Make tag name different from branch name, to avoid 25 # ambiguity error when calling checkout. 26 test_commit $i $i $i tag$i || return $? 27 done && 28 git checkout 1 -b merge && 29 test_merge octopus-merge 1 2 3 4 && 30 test_commit after-merge && 31 git checkout 1 -b L && 32 test_commit left && 33 git checkout 4 -b crossover && 34 test_commit after-4 && 35 git checkout initial -b more-L && 36 test_commit after-initial 37 ' 38 39 test_expect_success 'log --graph with tricky octopus merge, no color' ' 40 test_cmp_graph left octopus-merge <<-\EOF 41 * left 42 | *-. octopus-merge 43 |/|\ \ 44 | | | * 4 45 | | * | 3 46 | | |/ 47 | * / 2 48 | |/ 49 * / 1 50 |/ 51 * initial 52 EOF 53 ' 54 55 test_expect_success 'log --graph with tricky octopus merge with colors' ' 56 test_config log.graphColors red,green,yellow,blue,magenta,cyan && 57 cat >expect.colors <<-\EOF && 58 * left 59 | *-. octopus-merge 60 |/|\ \ 61 | | | * 4 62 | | * | 3 63 | | |/ 64 | * / 2 65 | |/ 66 * / 1 67 |/ 68 * initial 69 EOF 70 test_cmp_colored_graph left octopus-merge 71 ' 72 73 # Repeat the previous two tests with "normal" octopus merge (i.e., 74 # without the first parent skewing to the "left" branch column). 75 76 test_expect_success 'log --graph with normal octopus merge, no color' ' 77 test_cmp_graph octopus-merge <<-\EOF 78 *---. octopus-merge 79 |\ \ \ 80 | | | * 4 81 | | * | 3 82 | | |/ 83 | * / 2 84 | |/ 85 * / 1 86 |/ 87 * initial 88 EOF 89 ' 90 91 test_expect_success 'log --graph with normal octopus merge with colors' ' 92 cat >expect.colors <<-\EOF && 93 *---. octopus-merge 94 |\ \ \ 95 | | | * 4 96 | | * | 3 97 | | |/ 98 | * / 2 99 | |/ 100 * / 1 101 |/ 102 * initial 103 EOF 104 test_config log.graphColors red,green,yellow,blue,magenta,cyan && 105 test_cmp_colored_graph octopus-merge 106 ' 107 108 test_expect_success 'log --graph with normal octopus merge and child, no color' ' 109 test_cmp_graph after-merge <<-\EOF 110 * after-merge 111 *---. octopus-merge 112 |\ \ \ 113 | | | * 4 114 | | * | 3 115 | | |/ 116 | * / 2 117 | |/ 118 * / 1 119 |/ 120 * initial 121 EOF 122 ' 123 124 test_expect_success 'log --graph with normal octopus and child merge with colors' ' 125 cat >expect.colors <<-\EOF && 126 * after-merge 127 *---. octopus-merge 128 |\ \ \ 129 | | | * 4 130 | | * | 3 131 | | |/ 132 | * / 2 133 | |/ 134 * / 1 135 |/ 136 * initial 137 EOF 138 test_config log.graphColors red,green,yellow,blue,magenta,cyan && 139 test_cmp_colored_graph after-merge 140 ' 141 142 test_expect_success 'log --graph with tricky octopus merge and its child, no color' ' 143 test_cmp_graph left after-merge <<-\EOF 144 * left 145 | * after-merge 146 | *-. octopus-merge 147 |/|\ \ 148 | | | * 4 149 | | * | 3 150 | | |/ 151 | * / 2 152 | |/ 153 * / 1 154 |/ 155 * initial 156 EOF 157 ' 158 159 test_expect_success 'log --graph with tricky octopus merge and its child with colors' ' 160 test_config log.graphColors red,green,yellow,blue,magenta,cyan && 161 cat >expect.colors <<-\EOF && 162 * left 163 | * after-merge 164 | *-. octopus-merge 165 |/|\ \ 166 | | | * 4 167 | | * | 3 168 | | |/ 169 | * / 2 170 | |/ 171 * / 1 172 |/ 173 * initial 174 EOF 175 test_cmp_colored_graph left after-merge 176 ' 177 178 test_expect_success 'log --graph with crossover in octopus merge, no color' ' 179 test_cmp_graph after-4 octopus-merge <<-\EOF 180 * after-4 181 | *---. octopus-merge 182 | |\ \ \ 183 | |_|_|/ 184 |/| | | 185 * | | | 4 186 | | | * 3 187 | |_|/ 188 |/| | 189 | | * 2 190 | |/ 191 |/| 192 | * 1 193 |/ 194 * initial 195 EOF 196 ' 197 198 test_expect_success 'log --graph with crossover in octopus merge with colors' ' 199 test_config log.graphColors red,green,yellow,blue,magenta,cyan && 200 cat >expect.colors <<-\EOF && 201 * after-4 202 | *---. octopus-merge 203 | |\ \ \ 204 | |_|_|/ 205 |/| | | 206 * | | | 4 207 | | | * 3 208 | |_|/ 209 |/| | 210 | | * 2 211 | |/ 212 |/| 213 | * 1 214 |/ 215 * initial 216 EOF 217 test_cmp_colored_graph after-4 octopus-merge 218 ' 219 220 test_expect_success 'log --graph with crossover in octopus merge and its child, no color' ' 221 test_cmp_graph after-4 after-merge <<-\EOF 222 * after-4 223 | * after-merge 224 | *---. octopus-merge 225 | |\ \ \ 226 | |_|_|/ 227 |/| | | 228 * | | | 4 229 | | | * 3 230 | |_|/ 231 |/| | 232 | | * 2 233 | |/ 234 |/| 235 | * 1 236 |/ 237 * initial 238 EOF 239 ' 240 241 test_expect_success 'log --graph with crossover in octopus merge and its child with colors' ' 242 test_config log.graphColors red,green,yellow,blue,magenta,cyan && 243 cat >expect.colors <<-\EOF && 244 * after-4 245 | * after-merge 246 | *---. octopus-merge 247 | |\ \ \ 248 | |_|_|/ 249 |/| | | 250 * | | | 4 251 | | | * 3 252 | |_|/ 253 |/| | 254 | | * 2 255 | |/ 256 |/| 257 | * 1 258 |/ 259 * initial 260 EOF 261 test_cmp_colored_graph after-4 after-merge 262 ' 263 264 test_expect_success 'log --graph with unrelated commit and octopus tip, no color' ' 265 test_cmp_graph after-initial octopus-merge <<-\EOF 266 * after-initial 267 | *---. octopus-merge 268 | |\ \ \ 269 | | | | * 4 270 | |_|_|/ 271 |/| | | 272 | | | * 3 273 | |_|/ 274 |/| | 275 | | * 2 276 | |/ 277 |/| 278 | * 1 279 |/ 280 * initial 281 EOF 282 ' 283 284 test_expect_success 'log --graph with unrelated commit and octopus tip with colors' ' 285 test_config log.graphColors red,green,yellow,blue,magenta,cyan && 286 cat >expect.colors <<-\EOF && 287 * after-initial 288 | *---. octopus-merge 289 | |\ \ \ 290 | | | | * 4 291 | |_|_|/ 292 |/| | | 293 | | | * 3 294 | |_|/ 295 |/| | 296 | | * 2 297 | |/ 298 |/| 299 | * 1 300 |/ 301 * initial 302 EOF 303 test_cmp_colored_graph after-initial octopus-merge 304 ' 305 306 test_expect_success 'log --graph with unrelated commit and octopus child, no color' ' 307 test_cmp_graph after-initial after-merge <<-\EOF 308 * after-initial 309 | * after-merge 310 | *---. octopus-merge 311 | |\ \ \ 312 | | | | * 4 313 | |_|_|/ 314 |/| | | 315 | | | * 3 316 | |_|/ 317 |/| | 318 | | * 2 319 | |/ 320 |/| 321 | * 1 322 |/ 323 * initial 324 EOF 325 ' 326 327 test_expect_success 'log --graph with unrelated commit and octopus child with colors' ' 328 test_config log.graphColors red,green,yellow,blue,magenta,cyan && 329 cat >expect.colors <<-\EOF && 330 * after-initial 331 | * after-merge 332 | *---. octopus-merge 333 | |\ \ \ 334 | | | | * 4 335 | |_|_|/ 336 |/| | | 337 | | | * 3 338 | |_|/ 339 |/| | 340 | | * 2 341 | |/ 342 |/| 343 | * 1 344 |/ 345 * initial 346 EOF 347 test_cmp_colored_graph after-initial after-merge 348 ' 349 350 test_done