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/t4047-diff-dirstat.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 / t4047-diff-dirstat.sh` 992 lines ยท 33120 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='diff --dirstat tests' 4 5 . ./test-lib.sh 6 7 # set up two commits where the second commit has these files 8 # (10 lines in each file): 9 # 10 # unchanged/text (unchanged from 1st commit) 11 # changed/text (changed 1st line) 12 # rearranged/text (swapped 1st and 2nd line) 13 # dst/copy/unchanged/text (copied from src/copy/unchanged/text, unchanged) 14 # dst/copy/changed/text (copied from src/copy/changed/text, changed) 15 # dst/copy/rearranged/text (copied from src/copy/rearranged/text, rearranged) 16 # dst/move/unchanged/text (moved from src/move/unchanged/text, unchanged) 17 # dst/move/changed/text (moved from src/move/changed/text, changed) 18 # dst/move/rearranged/text (moved from src/move/rearranged/text, rearranged) 19 20 test_expect_success 'setup' ' 21 mkdir unchanged && 22 mkdir changed && 23 mkdir rearranged && 24 mkdir src && 25 mkdir src/copy && 26 mkdir src/copy/unchanged && 27 mkdir src/copy/changed && 28 mkdir src/copy/rearranged && 29 mkdir src/move && 30 mkdir src/move/unchanged && 31 mkdir src/move/changed && 32 mkdir src/move/rearranged && 33 cat <unchanged/text && 34 unchanged line #0 35 unchanged line #1 36 unchanged line #2 37 unchanged line #3 38 unchanged line #4 39 unchanged line #5 40 unchanged line #6 41 unchanged line #7 42 unchanged line #8 43 unchanged line #9 44 EOF 45 cat <changed/text && 46 changed line #0 47 changed line #1 48 changed line #2 49 changed line #3 50 changed line #4 51 changed line #5 52 changed line #6 53 changed line #7 54 changed line #8 55 changed line #9 56 EOF 57 cat <rearranged/text && 58 rearranged line #0 59 rearranged line #1 60 rearranged line #2 61 rearranged line #3 62 rearranged line #4 63 rearranged line #5 64 rearranged line #6 65 rearranged line #7 66 rearranged line #8 67 rearranged line #9 68 EOF 69 cat <src/copy/unchanged/text && 70 copy unchanged line #0 71 copy unchanged line #1 72 copy unchanged line #2 73 copy unchanged line #3 74 copy unchanged line #4 75 copy unchanged line #5 76 copy unchanged line #6 77 copy unchanged line #7 78 copy unchanged line #8 79 copy unchanged line #9 80 EOF 81 cat <src/copy/changed/text && 82 copy changed line #0 83 copy changed line #1 84 copy changed line #2 85 copy changed line #3 86 copy changed line #4 87 copy changed line #5 88 copy changed line #6 89 copy changed line #7 90 copy changed line #8 91 copy changed line #9 92 EOF 93 cat <src/copy/rearranged/text && 94 copy rearranged line #0 95 copy rearranged line #1 96 copy rearranged line #2 97 copy rearranged line #3 98 copy rearranged line #4 99 copy rearranged line #5 100 copy rearranged line #6 101 copy rearranged line #7 102 copy rearranged line #8 103 copy rearranged line #9 104 EOF 105 cat <src/move/unchanged/text && 106 move unchanged line #0 107 move unchanged line #1 108 move unchanged line #2 109 move unchanged line #3 110 move unchanged line #4 111 move unchanged line #5 112 move unchanged line #6 113 move unchanged line #7 114 move unchanged line #8 115 move unchanged line #9 116 EOF 117 cat <src/move/changed/text && 118 move changed line #0 119 move changed line #1 120 move changed line #2 121 move changed line #3 122 move changed line #4 123 move changed line #5 124 move changed line #6 125 move changed line #7 126 move changed line #8 127 move changed line #9 128 EOF 129 cat <src/move/rearranged/text && 130 move rearranged line #0 131 move rearranged line #1 132 move rearranged line #2 133 move rearranged line #3 134 move rearranged line #4 135 move rearranged line #5 136 move rearranged line #6 137 move rearranged line #7 138 move rearranged line #8 139 move rearranged line #9 140 EOF 141 git add . && 142 git commit -m "initial" && 143 mkdir dst && 144 mkdir dst/copy && 145 mkdir dst/copy/unchanged && 146 mkdir dst/copy/changed && 147 mkdir dst/copy/rearranged && 148 mkdir dst/move && 149 mkdir dst/move/unchanged && 150 mkdir dst/move/changed && 151 mkdir dst/move/rearranged && 152 cat <changed/text && 153 CHANGED XXXXXXX line #0 154 changed line #1 155 changed line #2 156 changed line #3 157 changed line #4 158 changed line #5 159 changed line #6 160 changed line #7 161 changed line #8 162 changed line #9 163 EOF 164 cat <rearranged/text && 165 rearranged line #1 166 rearranged line #0 167 rearranged line #2 168 rearranged line #3 169 rearranged line #4 170 rearranged line #5 171 rearranged line #6 172 rearranged line #7 173 rearranged line #8 174 rearranged line #9 175 EOF 176 cat <dst/copy/unchanged/text && 177 copy unchanged line #0 178 copy unchanged line #1 179 copy unchanged line #2 180 copy unchanged line #3 181 copy unchanged line #4 182 copy unchanged line #5 183 copy unchanged line #6 184 copy unchanged line #7 185 copy unchanged line #8 186 copy unchanged line #9 187 EOF 188 cat <dst/copy/changed/text && 189 copy XXXCHANGED line #0 190 copy changed line #1 191 copy changed line #2 192 copy changed line #3 193 copy changed line #4 194 copy changed line #5 195 copy changed line #6 196 copy changed line #7 197 copy changed line #8 198 copy changed line #9 199 EOF 200 cat <dst/copy/rearranged/text && 201 copy rearranged line #1 202 copy rearranged line #0 203 copy rearranged line #2 204 copy rearranged line #3 205 copy rearranged line #4 206 copy rearranged line #5 207 copy rearranged line #6 208 copy rearranged line #7 209 copy rearranged line #8 210 copy rearranged line #9 211 EOF 212 cat <dst/move/unchanged/text && 213 move unchanged line #0 214 move unchanged line #1 215 move unchanged line #2 216 move unchanged line #3 217 move unchanged line #4 218 move unchanged line #5 219 move unchanged line #6 220 move unchanged line #7 221 move unchanged line #8 222 move unchanged line #9 223 EOF 224 cat <dst/move/changed/text && 225 move XXXCHANGED line #0 226 move changed line #1 227 move changed line #2 228 move changed line #3 229 move changed line #4 230 move changed line #5 231 move changed line #6 232 move changed line #7 233 move changed line #8 234 move changed line #9 235 EOF 236 cat <dst/move/rearranged/text && 237 move rearranged line #1 238 move rearranged line #0 239 move rearranged line #2 240 move rearranged line #3 241 move rearranged line #4 242 move rearranged line #5 243 move rearranged line #6 244 move rearranged line #7 245 move rearranged line #8 246 move rearranged line #9 247 EOF 248 git add . && 249 git rm -r src/move/unchanged && 250 git rm -r src/move/changed && 251 git rm -r src/move/rearranged && 252 git commit -m "changes" && 253 git config diff.renames false 254 ' 255 256 cat <expect_diff_stat 257 1 1 changed/text 258 10 0 dst/copy/changed/text 259 10 0 dst/copy/rearranged/text 260 10 0 dst/copy/unchanged/text 261 10 0 dst/move/changed/text 262 10 0 dst/move/rearranged/text 263 10 0 dst/move/unchanged/text 264 1 1 rearranged/text 265 0 10 src/move/changed/text 266 0 10 src/move/rearranged/text 267 0 10 src/move/unchanged/text 268 EOF 269 270 cat <expect_diff_stat_M 271 1 1 changed/text 272 10 0 dst/copy/changed/text 273 10 0 dst/copy/rearranged/text 274 10 0 dst/copy/unchanged/text 275 1 1 {src => dst}/move/changed/text 276 1 1 {src => dst}/move/rearranged/text 277 0 0 {src => dst}/move/unchanged/text 278 1 1 rearranged/text 279 EOF 280 281 cat <expect_diff_stat_CC 282 1 1 changed/text 283 1 1 {src => dst}/copy/changed/text 284 1 1 {src => dst}/copy/rearranged/text 285 0 0 {src => dst}/copy/unchanged/text 286 1 1 {src => dst}/move/changed/text 287 1 1 {src => dst}/move/rearranged/text 288 0 0 {src => dst}/move/unchanged/text 289 1 1 rearranged/text 290 EOF 291 292 test_expect_success 'sanity check setup (--numstat)' ' 293 git diff --numstat HEAD^..HEAD >actual_diff_stat && 294 test_cmp expect_diff_stat actual_diff_stat && 295 git diff --numstat -M HEAD^..HEAD >actual_diff_stat_M && 296 test_cmp expect_diff_stat_M actual_diff_stat_M && 297 git diff --numstat -C -C HEAD^..HEAD >actual_diff_stat_CC && 298 test_cmp expect_diff_stat_CC actual_diff_stat_CC 299 ' 300 301 # changed/text and rearranged/text falls below default 3% threshold 302 cat <expect_diff_dirstat 303 10.8% dst/copy/changed/ 304 10.8% dst/copy/rearranged/ 305 10.8% dst/copy/unchanged/ 306 10.8% dst/move/changed/ 307 10.8% dst/move/rearranged/ 308 10.8% dst/move/unchanged/ 309 10.8% src/move/changed/ 310 10.8% src/move/rearranged/ 311 10.8% src/move/unchanged/ 312 EOF 313 314 # rearranged/text falls below default 3% threshold 315 cat <expect_diff_dirstat_M 316 5.8% changed/ 317 29.3% dst/copy/changed/ 318 29.3% dst/copy/rearranged/ 319 29.3% dst/copy/unchanged/ 320 5.8% dst/move/changed/ 321 EOF 322 323 # rearranged/text falls below default 3% threshold 324 cat <expect_diff_dirstat_CC 325 32.6% changed/ 326 32.6% dst/copy/changed/ 327 32.6% dst/move/changed/ 328 EOF 329 330 test_expect_success 'various ways to misspell --dirstat' ' 331 test_must_fail git show --dirstat10 && 332 test_must_fail git show --dirstat10,files && 333 test_must_fail git show -X=20 && 334 test_must_fail git show -X=20,cumulative 335 ' 336 337 test_expect_success 'vanilla --dirstat' ' 338 git diff --dirstat HEAD^..HEAD >actual_diff_dirstat && 339 test_cmp expect_diff_dirstat actual_diff_dirstat && 340 git diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M && 341 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 342 git diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 343 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 344 ' 345 346 test_expect_success 'vanilla -X' ' 347 git diff -X HEAD^..HEAD >actual_diff_dirstat && 348 test_cmp expect_diff_dirstat actual_diff_dirstat && 349 git diff -X -M HEAD^..HEAD >actual_diff_dirstat_M && 350 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 351 git diff -X -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 352 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 353 ' 354 355 test_expect_success 'explicit defaults: --dirstat=changes,noncumulative,3' ' 356 git diff --dirstat=changes,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat && 357 test_cmp expect_diff_dirstat actual_diff_dirstat && 358 git diff --dirstat=changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M && 359 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 360 git diff --dirstat=changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 361 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 362 ' 363 364 test_expect_success 'explicit defaults: -Xchanges,noncumulative,3' ' 365 git diff -Xchanges,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat && 366 test_cmp expect_diff_dirstat actual_diff_dirstat && 367 git diff -Xchanges,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M && 368 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 369 git diff -Xchanges,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 370 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 371 ' 372 373 test_expect_success 'later options override earlier options:' ' 374 git diff --dirstat=files,10,cumulative,changes,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat && 375 test_cmp expect_diff_dirstat actual_diff_dirstat && 376 git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M && 377 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 378 git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 379 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC && 380 git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 HEAD^..HEAD >actual_diff_dirstat && 381 test_cmp expect_diff_dirstat actual_diff_dirstat && 382 git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 -M HEAD^..HEAD >actual_diff_dirstat_M && 383 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 384 git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 385 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 386 ' 387 388 test_expect_success 'non-defaults in config overridden by explicit defaults on command line' ' 389 git -c diff.dirstat=files,cumulative,50 diff --dirstat=changes,noncumulative,3 HEAD^..HEAD >actual_diff_dirstat && 390 test_cmp expect_diff_dirstat actual_diff_dirstat && 391 git -c diff.dirstat=files,cumulative,50 diff --dirstat=changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M && 392 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 393 git -c diff.dirstat=files,cumulative,50 diff --dirstat=changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 394 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 395 ' 396 397 cat <expect_diff_dirstat 398 2.1% changed/ 399 10.8% dst/copy/changed/ 400 10.8% dst/copy/rearranged/ 401 10.8% dst/copy/unchanged/ 402 10.8% dst/move/changed/ 403 10.8% dst/move/rearranged/ 404 10.8% dst/move/unchanged/ 405 0.0% rearranged/ 406 10.8% src/move/changed/ 407 10.8% src/move/rearranged/ 408 10.8% src/move/unchanged/ 409 EOF 410 411 cat <expect_diff_dirstat_M 412 5.8% changed/ 413 29.3% dst/copy/changed/ 414 29.3% dst/copy/rearranged/ 415 29.3% dst/copy/unchanged/ 416 5.8% dst/move/changed/ 417 0.1% dst/move/rearranged/ 418 0.1% rearranged/ 419 EOF 420 421 cat <expect_diff_dirstat_CC 422 32.6% changed/ 423 32.6% dst/copy/changed/ 424 0.6% dst/copy/rearranged/ 425 32.6% dst/move/changed/ 426 0.6% dst/move/rearranged/ 427 0.6% rearranged/ 428 EOF 429 430 test_expect_success '--dirstat=0' ' 431 git diff --dirstat=0 HEAD^..HEAD >actual_diff_dirstat && 432 test_cmp expect_diff_dirstat actual_diff_dirstat && 433 git diff --dirstat=0 -M HEAD^..HEAD >actual_diff_dirstat_M && 434 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 435 git diff --dirstat=0 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 436 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 437 ' 438 439 test_expect_success '-X0' ' 440 git diff -X0 HEAD^..HEAD >actual_diff_dirstat && 441 test_cmp expect_diff_dirstat actual_diff_dirstat && 442 git diff -X0 -M HEAD^..HEAD >actual_diff_dirstat_M && 443 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 444 git diff -X0 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 445 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 446 ' 447 448 test_expect_success 'diff.dirstat=0' ' 449 git -c diff.dirstat=0 diff --dirstat HEAD^..HEAD >actual_diff_dirstat && 450 test_cmp expect_diff_dirstat actual_diff_dirstat && 451 git -c diff.dirstat=0 diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M && 452 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 453 git -c diff.dirstat=0 diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 454 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 455 ' 456 457 cat <expect_diff_dirstat 458 2.1% changed/ 459 10.8% dst/copy/changed/ 460 10.8% dst/copy/rearranged/ 461 10.8% dst/copy/unchanged/ 462 32.5% dst/copy/ 463 10.8% dst/move/changed/ 464 10.8% dst/move/rearranged/ 465 10.8% dst/move/unchanged/ 466 32.5% dst/move/ 467 65.1% dst/ 468 0.0% rearranged/ 469 10.8% src/move/changed/ 470 10.8% src/move/rearranged/ 471 10.8% src/move/unchanged/ 472 32.5% src/move/ 473 EOF 474 475 cat <expect_diff_dirstat_M 476 5.8% changed/ 477 29.3% dst/copy/changed/ 478 29.3% dst/copy/rearranged/ 479 29.3% dst/copy/unchanged/ 480 88.0% dst/copy/ 481 5.8% dst/move/changed/ 482 0.1% dst/move/rearranged/ 483 5.9% dst/move/ 484 94.0% dst/ 485 0.1% rearranged/ 486 EOF 487 488 cat <expect_diff_dirstat_CC 489 32.6% changed/ 490 32.6% dst/copy/changed/ 491 0.6% dst/copy/rearranged/ 492 33.3% dst/copy/ 493 32.6% dst/move/changed/ 494 0.6% dst/move/rearranged/ 495 33.3% dst/move/ 496 66.6% dst/ 497 0.6% rearranged/ 498 EOF 499 500 test_expect_success '--dirstat=0 --cumulative' ' 501 git diff --dirstat=0 --cumulative HEAD^..HEAD >actual_diff_dirstat && 502 test_cmp expect_diff_dirstat actual_diff_dirstat && 503 git diff --dirstat=0 --cumulative -M HEAD^..HEAD >actual_diff_dirstat_M && 504 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 505 git diff --dirstat=0 --cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 506 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 507 ' 508 509 test_expect_success '--dirstat=0,cumulative' ' 510 git diff --dirstat=0,cumulative HEAD^..HEAD >actual_diff_dirstat && 511 test_cmp expect_diff_dirstat actual_diff_dirstat && 512 git diff --dirstat=0,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M && 513 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 514 git diff --dirstat=0,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 515 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 516 ' 517 518 test_expect_success '-X0,cumulative' ' 519 git diff -X0,cumulative HEAD^..HEAD >actual_diff_dirstat && 520 test_cmp expect_diff_dirstat actual_diff_dirstat && 521 git diff -X0,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M && 522 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 523 git diff -X0,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 524 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 525 ' 526 527 test_expect_success 'diff.dirstat=0,cumulative' ' 528 git -c diff.dirstat=0,cumulative diff --dirstat HEAD^..HEAD >actual_diff_dirstat && 529 test_cmp expect_diff_dirstat actual_diff_dirstat && 530 git -c diff.dirstat=0,cumulative diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M && 531 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 532 git -c diff.dirstat=0,cumulative diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 533 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 534 ' 535 536 test_expect_success 'diff.dirstat=0 & --dirstat=cumulative' ' 537 git -c diff.dirstat=0 diff --dirstat=cumulative HEAD^..HEAD >actual_diff_dirstat && 538 test_cmp expect_diff_dirstat actual_diff_dirstat && 539 git -c diff.dirstat=0 diff --dirstat=cumulative -M HEAD^..HEAD >actual_diff_dirstat_M && 540 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 541 git -c diff.dirstat=0 diff --dirstat=cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 542 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 543 ' 544 545 cat <expect_diff_dirstat 546 9.0% changed/ 547 9.0% dst/copy/changed/ 548 9.0% dst/copy/rearranged/ 549 9.0% dst/copy/unchanged/ 550 9.0% dst/move/changed/ 551 9.0% dst/move/rearranged/ 552 9.0% dst/move/unchanged/ 553 9.0% rearranged/ 554 9.0% src/move/changed/ 555 9.0% src/move/rearranged/ 556 9.0% src/move/unchanged/ 557 EOF 558 559 cat <expect_diff_dirstat_M 560 14.2% changed/ 561 14.2% dst/copy/changed/ 562 14.2% dst/copy/rearranged/ 563 14.2% dst/copy/unchanged/ 564 14.2% dst/move/changed/ 565 14.2% dst/move/rearranged/ 566 14.2% rearranged/ 567 EOF 568 569 cat <expect_diff_dirstat_CC 570 16.6% changed/ 571 16.6% dst/copy/changed/ 572 16.6% dst/copy/rearranged/ 573 16.6% dst/move/changed/ 574 16.6% dst/move/rearranged/ 575 16.6% rearranged/ 576 EOF 577 578 test_expect_success '--dirstat-by-file' ' 579 git diff --dirstat-by-file HEAD^..HEAD >actual_diff_dirstat && 580 test_cmp expect_diff_dirstat actual_diff_dirstat && 581 git diff --dirstat-by-file -M HEAD^..HEAD >actual_diff_dirstat_M && 582 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 583 git diff --dirstat-by-file -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 584 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 585 ' 586 587 test_expect_success '--dirstat=files' ' 588 git diff --dirstat=files HEAD^..HEAD >actual_diff_dirstat && 589 test_cmp expect_diff_dirstat actual_diff_dirstat && 590 git diff --dirstat=files -M HEAD^..HEAD >actual_diff_dirstat_M && 591 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 592 git diff --dirstat=files -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 593 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 594 ' 595 596 test_expect_success 'diff.dirstat=files' ' 597 git -c diff.dirstat=files diff --dirstat HEAD^..HEAD >actual_diff_dirstat && 598 test_cmp expect_diff_dirstat actual_diff_dirstat && 599 git -c diff.dirstat=files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M && 600 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 601 git -c diff.dirstat=files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 602 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 603 ' 604 605 cat <expect_diff_dirstat 606 27.2% dst/copy/ 607 27.2% dst/move/ 608 27.2% src/move/ 609 EOF 610 611 cat <expect_diff_dirstat_M 612 14.2% changed/ 613 14.2% dst/copy/changed/ 614 14.2% dst/copy/rearranged/ 615 14.2% dst/copy/unchanged/ 616 14.2% dst/move/changed/ 617 14.2% dst/move/rearranged/ 618 14.2% rearranged/ 619 EOF 620 621 cat <expect_diff_dirstat_CC 622 16.6% changed/ 623 16.6% dst/copy/changed/ 624 16.6% dst/copy/rearranged/ 625 16.6% dst/move/changed/ 626 16.6% dst/move/rearranged/ 627 16.6% rearranged/ 628 EOF 629 630 test_expect_success '--dirstat-by-file=10' ' 631 git diff --dirstat-by-file=10 HEAD^..HEAD >actual_diff_dirstat && 632 test_cmp expect_diff_dirstat actual_diff_dirstat && 633 git diff --dirstat-by-file=10 -M HEAD^..HEAD >actual_diff_dirstat_M && 634 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 635 git diff --dirstat-by-file=10 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 636 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 637 ' 638 639 test_expect_success '--dirstat=files,10' ' 640 git diff --dirstat=files,10 HEAD^..HEAD >actual_diff_dirstat && 641 test_cmp expect_diff_dirstat actual_diff_dirstat && 642 git diff --dirstat=files,10 -M HEAD^..HEAD >actual_diff_dirstat_M && 643 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 644 git diff --dirstat=files,10 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 645 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 646 ' 647 648 test_expect_success 'diff.dirstat=10,files' ' 649 git -c diff.dirstat=10,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat && 650 test_cmp expect_diff_dirstat actual_diff_dirstat && 651 git -c diff.dirstat=10,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M && 652 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 653 git -c diff.dirstat=10,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 654 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 655 ' 656 657 cat <expect_diff_dirstat 658 9.0% changed/ 659 9.0% dst/copy/changed/ 660 9.0% dst/copy/rearranged/ 661 9.0% dst/copy/unchanged/ 662 27.2% dst/copy/ 663 9.0% dst/move/changed/ 664 9.0% dst/move/rearranged/ 665 9.0% dst/move/unchanged/ 666 27.2% dst/move/ 667 54.5% dst/ 668 9.0% rearranged/ 669 9.0% src/move/changed/ 670 9.0% src/move/rearranged/ 671 9.0% src/move/unchanged/ 672 27.2% src/move/ 673 EOF 674 675 cat <expect_diff_dirstat_M 676 14.2% changed/ 677 14.2% dst/copy/changed/ 678 14.2% dst/copy/rearranged/ 679 14.2% dst/copy/unchanged/ 680 42.8% dst/copy/ 681 14.2% dst/move/changed/ 682 14.2% dst/move/rearranged/ 683 28.5% dst/move/ 684 71.4% dst/ 685 14.2% rearranged/ 686 EOF 687 688 cat <expect_diff_dirstat_CC 689 16.6% changed/ 690 16.6% dst/copy/changed/ 691 16.6% dst/copy/rearranged/ 692 33.3% dst/copy/ 693 16.6% dst/move/changed/ 694 16.6% dst/move/rearranged/ 695 33.3% dst/move/ 696 66.6% dst/ 697 16.6% rearranged/ 698 EOF 699 700 test_expect_success '--dirstat-by-file --cumulative' ' 701 git diff --dirstat-by-file --cumulative HEAD^..HEAD >actual_diff_dirstat && 702 test_cmp expect_diff_dirstat actual_diff_dirstat && 703 git diff --dirstat-by-file --cumulative -M HEAD^..HEAD >actual_diff_dirstat_M && 704 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 705 git diff --dirstat-by-file --cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 706 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 707 ' 708 709 test_expect_success '--dirstat=files,cumulative' ' 710 git diff --dirstat=files,cumulative HEAD^..HEAD >actual_diff_dirstat && 711 test_cmp expect_diff_dirstat actual_diff_dirstat && 712 git diff --dirstat=files,cumulative -M HEAD^..HEAD >actual_diff_dirstat_M && 713 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 714 git diff --dirstat=files,cumulative -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 715 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 716 ' 717 718 test_expect_success 'diff.dirstat=cumulative,files' ' 719 git -c diff.dirstat=cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat && 720 test_cmp expect_diff_dirstat actual_diff_dirstat && 721 git -c diff.dirstat=cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M && 722 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 723 git -c diff.dirstat=cumulative,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 724 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 725 ' 726 727 cat <expect_diff_dirstat 728 27.2% dst/copy/ 729 27.2% dst/move/ 730 54.5% dst/ 731 27.2% src/move/ 732 EOF 733 734 cat <expect_diff_dirstat_M 735 14.2% changed/ 736 14.2% dst/copy/changed/ 737 14.2% dst/copy/rearranged/ 738 14.2% dst/copy/unchanged/ 739 42.8% dst/copy/ 740 14.2% dst/move/changed/ 741 14.2% dst/move/rearranged/ 742 28.5% dst/move/ 743 71.4% dst/ 744 14.2% rearranged/ 745 EOF 746 747 cat <expect_diff_dirstat_CC 748 16.6% changed/ 749 16.6% dst/copy/changed/ 750 16.6% dst/copy/rearranged/ 751 33.3% dst/copy/ 752 16.6% dst/move/changed/ 753 16.6% dst/move/rearranged/ 754 33.3% dst/move/ 755 66.6% dst/ 756 16.6% rearranged/ 757 EOF 758 759 test_expect_success '--dirstat=files,cumulative,10' ' 760 git diff --dirstat=files,cumulative,10 HEAD^..HEAD >actual_diff_dirstat && 761 test_cmp expect_diff_dirstat actual_diff_dirstat && 762 git diff --dirstat=files,cumulative,10 -M HEAD^..HEAD >actual_diff_dirstat_M && 763 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 764 git diff --dirstat=files,cumulative,10 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 765 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 766 ' 767 768 test_expect_success 'diff.dirstat=10,cumulative,files' ' 769 git -c diff.dirstat=10,cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat && 770 test_cmp expect_diff_dirstat actual_diff_dirstat && 771 git -c diff.dirstat=10,cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M && 772 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 773 git -c diff.dirstat=10,cumulative,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 774 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 775 ' 776 777 cat <expect_diff_dirstat 778 27.2% dst/copy/ 779 27.2% dst/move/ 780 54.5% dst/ 781 27.2% src/move/ 782 EOF 783 784 cat <expect_diff_dirstat_M 785 42.8% dst/copy/ 786 28.5% dst/move/ 787 71.4% dst/ 788 EOF 789 790 cat <expect_diff_dirstat_CC 791 33.3% dst/copy/ 792 33.3% dst/move/ 793 66.6% dst/ 794 EOF 795 796 test_expect_success '--dirstat=files,cumulative,16.7' ' 797 git diff --dirstat=files,cumulative,16.7 HEAD^..HEAD >actual_diff_dirstat && 798 test_cmp expect_diff_dirstat actual_diff_dirstat && 799 git diff --dirstat=files,cumulative,16.7 -M HEAD^..HEAD >actual_diff_dirstat_M && 800 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 801 git diff --dirstat=files,cumulative,16.7 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 802 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 803 ' 804 805 test_expect_success 'diff.dirstat=16.7,cumulative,files' ' 806 git -c diff.dirstat=16.7,cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat && 807 test_cmp expect_diff_dirstat actual_diff_dirstat && 808 git -c diff.dirstat=16.7,cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M && 809 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 810 git -c diff.dirstat=16.7,cumulative,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 811 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 812 ' 813 814 test_expect_success 'diff.dirstat=16.70,cumulative,files' ' 815 git -c diff.dirstat=16.70,cumulative,files diff --dirstat HEAD^..HEAD >actual_diff_dirstat && 816 test_cmp expect_diff_dirstat actual_diff_dirstat && 817 git -c diff.dirstat=16.70,cumulative,files diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M && 818 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 819 git -c diff.dirstat=16.70,cumulative,files diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 820 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 821 ' 822 823 test_expect_success '--dirstat=files,cumulative,27.2' ' 824 git diff --dirstat=files,cumulative,27.2 HEAD^..HEAD >actual_diff_dirstat && 825 test_cmp expect_diff_dirstat actual_diff_dirstat && 826 git diff --dirstat=files,cumulative,27.2 -M HEAD^..HEAD >actual_diff_dirstat_M && 827 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 828 git diff --dirstat=files,cumulative,27.2 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 829 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 830 ' 831 832 test_expect_success '--dirstat=files,cumulative,27.09' ' 833 git diff --dirstat=files,cumulative,27.09 HEAD^..HEAD >actual_diff_dirstat && 834 test_cmp expect_diff_dirstat actual_diff_dirstat && 835 git diff --dirstat=files,cumulative,27.09 -M HEAD^..HEAD >actual_diff_dirstat_M && 836 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 837 git diff --dirstat=files,cumulative,27.09 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 838 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 839 ' 840 841 cat <expect_diff_dirstat 842 10.6% dst/copy/changed/ 843 10.6% dst/copy/rearranged/ 844 10.6% dst/copy/unchanged/ 845 10.6% dst/move/changed/ 846 10.6% dst/move/rearranged/ 847 10.6% dst/move/unchanged/ 848 10.6% src/move/changed/ 849 10.6% src/move/rearranged/ 850 10.6% src/move/unchanged/ 851 EOF 852 853 cat <expect_diff_dirstat_M 854 5.2% changed/ 855 26.3% dst/copy/changed/ 856 26.3% dst/copy/rearranged/ 857 26.3% dst/copy/unchanged/ 858 5.2% dst/move/changed/ 859 5.2% dst/move/rearranged/ 860 5.2% rearranged/ 861 EOF 862 863 cat <expect_diff_dirstat_CC 864 16.6% changed/ 865 16.6% dst/copy/changed/ 866 16.6% dst/copy/rearranged/ 867 16.6% dst/move/changed/ 868 16.6% dst/move/rearranged/ 869 16.6% rearranged/ 870 EOF 871 872 test_expect_success '--dirstat=lines' ' 873 git diff --dirstat=lines HEAD^..HEAD >actual_diff_dirstat && 874 test_cmp expect_diff_dirstat actual_diff_dirstat && 875 git diff --dirstat=lines -M HEAD^..HEAD >actual_diff_dirstat_M && 876 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 877 git diff --dirstat=lines -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 878 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 879 ' 880 881 test_expect_success 'diff.dirstat=lines' ' 882 git -c diff.dirstat=lines diff --dirstat HEAD^..HEAD >actual_diff_dirstat && 883 test_cmp expect_diff_dirstat actual_diff_dirstat && 884 git -c diff.dirstat=lines diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M && 885 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 886 git -c diff.dirstat=lines diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 887 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 888 ' 889 890 cat <expect_diff_dirstat 891 2.1% changed/ 892 10.6% dst/copy/changed/ 893 10.6% dst/copy/rearranged/ 894 10.6% dst/copy/unchanged/ 895 10.6% dst/move/changed/ 896 10.6% dst/move/rearranged/ 897 10.6% dst/move/unchanged/ 898 2.1% rearranged/ 899 10.6% src/move/changed/ 900 10.6% src/move/rearranged/ 901 10.6% src/move/unchanged/ 902 EOF 903 904 cat <expect_diff_dirstat_M 905 5.2% changed/ 906 26.3% dst/copy/changed/ 907 26.3% dst/copy/rearranged/ 908 26.3% dst/copy/unchanged/ 909 5.2% dst/move/changed/ 910 5.2% dst/move/rearranged/ 911 5.2% rearranged/ 912 EOF 913 914 cat <expect_diff_dirstat_CC 915 16.6% changed/ 916 16.6% dst/copy/changed/ 917 16.6% dst/copy/rearranged/ 918 16.6% dst/move/changed/ 919 16.6% dst/move/rearranged/ 920 16.6% rearranged/ 921 EOF 922 923 test_expect_success '--dirstat=lines,0' ' 924 git diff --dirstat=lines,0 HEAD^..HEAD >actual_diff_dirstat && 925 test_cmp expect_diff_dirstat actual_diff_dirstat && 926 git diff --dirstat=lines,0 -M HEAD^..HEAD >actual_diff_dirstat_M && 927 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 928 git diff --dirstat=lines,0 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 929 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 930 ' 931 932 test_expect_success 'diff.dirstat=0,lines' ' 933 git -c diff.dirstat=0,lines diff --dirstat HEAD^..HEAD >actual_diff_dirstat && 934 test_cmp expect_diff_dirstat actual_diff_dirstat && 935 git -c diff.dirstat=0,lines diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M && 936 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 937 git -c diff.dirstat=0,lines diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC && 938 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC 939 ' 940 941 test_expect_success '--dirstat=future_param,lines,0 should fail loudly' ' 942 test_must_fail git diff --dirstat=future_param,lines,0 HEAD^..HEAD >actual_diff_dirstat 2>actual_error && 943 test_debug "cat actual_error" && 944 test_must_be_empty actual_diff_dirstat && 945 test_grep -q "future_param" actual_error && 946 test_grep -q "\--dirstat" actual_error 947 ' 948 949 test_expect_success '--dirstat=dummy1,cumulative,2dummy should report both unrecognized parameters' ' 950 test_must_fail git diff --dirstat=dummy1,cumulative,2dummy HEAD^..HEAD >actual_diff_dirstat 2>actual_error && 951 test_debug "cat actual_error" && 952 test_must_be_empty actual_diff_dirstat && 953 test_grep -q "dummy1" actual_error && 954 test_grep -q "2dummy" actual_error && 955 test_grep -q "\--dirstat" actual_error 956 ' 957 958 test_expect_success 'diff.dirstat=future_param,0,lines should warn, but still work' ' 959 git -c diff.dirstat=future_param,0,lines diff --dirstat HEAD^..HEAD >actual_diff_dirstat 2>actual_error && 960 test_debug "cat actual_error" && 961 test_cmp expect_diff_dirstat actual_diff_dirstat && 962 test_grep -q "future_param" actual_error && 963 test_grep -q "diff\\.dirstat" actual_error && 964 965 git -c diff.dirstat=future_param,0,lines diff --dirstat -M HEAD^..HEAD >actual_diff_dirstat_M 2>actual_error && 966 test_debug "cat actual_error" && 967 test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && 968 test_grep -q "future_param" actual_error && 969 test_grep -q "diff\\.dirstat" actual_error && 970 971 git -c diff.dirstat=future_param,0,lines diff --dirstat -C -C HEAD^..HEAD >actual_diff_dirstat_CC 2>actual_error && 972 test_debug "cat actual_error" && 973 test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC && 974 test_grep -q "future_param" actual_error && 975 test_grep -q "diff\\.dirstat" actual_error 976 ' 977 978 test_expect_success '--shortstat --dirstat should output only one dirstat' ' 979 git diff --shortstat --dirstat=changes HEAD^..HEAD >out && 980 grep " dst/copy/changed/$" out >actual_diff_shortstat_dirstat_changes && 981 test_line_count = 1 actual_diff_shortstat_dirstat_changes && 982 983 git diff --shortstat --dirstat=lines HEAD^..HEAD >out && 984 grep " dst/copy/changed/$" out >actual_diff_shortstat_dirstat_lines && 985 test_line_count = 1 actual_diff_shortstat_dirstat_lines && 986 987 git diff --shortstat --dirstat=files HEAD^..HEAD >out && 988 grep " dst/copy/changed/$" out >actual_diff_shortstat_dirstat_files && 989 test_line_count = 1 actual_diff_shortstat_dirstat_files 990 ' 991 992 test_done