Git fork

--dirstat: Describe non-obvious differences relative to --stat or regular diff

Also add a testcase documenting the current behavior.

Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Johan Herland and committed by
Junio C Hamano
204f01a2 5fb41b88

+40 -7
+4
Documentation/diff-options.txt
··· 72 72 a cut-off percent (3% by default) are not shown. The cut-off percent 73 73 can be set with `--dirstat=<limit>`. Changes in a child directory are not 74 74 counted for the parent directory, unless `--cumulative` is used. 75 + + 76 + Note that the `--dirstat` option computes the changes while ignoring 77 + pure code movements within a file. In other words, rearranging lines 78 + in a file is not counted as a change. 75 79 76 80 --dirstat-by-file[=<limit>]:: 77 81 Same as `--dirstat`, but counts changed files instead of lines.
+21 -6
t/t4013-diff-various.sh
··· 80 80 81 81 git config log.showroot false && 82 82 git commit --amend && 83 + 84 + GIT_AUTHOR_DATE="2006-06-26 00:06:00 +0000" && 85 + GIT_COMMITTER_DATE="2006-06-26 00:06:00 +0000" && 86 + export GIT_AUTHOR_DATE GIT_COMMITTER_DATE && 87 + git checkout -b rearrange initial && 88 + for i in B A; do echo $i; done >dir/sub && 89 + git add dir/sub && 90 + git commit -m "Rearranged lines in dir/sub" && 91 + git checkout master && 92 + 83 93 git show-branch 84 94 ' 85 95 86 96 : <<\EOF 87 97 ! [initial] Initial 88 98 * [master] Merge branch 'side' 89 - ! [side] Side 90 - --- 91 - - [master] Merge branch 'side' 92 - *+ [side] Side 93 - * [master^] Second 94 - +*+ [initial] Initial 99 + ! [rearrange] Rearranged lines in dir/sub 100 + ! [side] Side 101 + ---- 102 + + [rearrange] Rearranged lines in dir/sub 103 + - [master] Merge branch 'side' 104 + * + [side] Side 105 + * [master^] Third 106 + * [master~2] Second 107 + +*++ [initial] Initial 95 108 EOF 96 109 97 110 V=`git version | sed -e 's/^git version //' -e 's/\./\\./g'` ··· 287 300 diff --no-index dir dir3 288 301 diff master master^ side 289 302 diff --dirstat master~1 master~2 303 + # --dirstat doesn't notice changes that simply rearrange existing lines 304 + diff --dirstat initial rearrange 290 305 EOF 291 306 292 307 test_expect_success 'log -S requires an argument' '
+2
t/t4013/diff.diff_--dirstat_initial_rearrange
··· 1 + $ git diff --dirstat initial rearrange 2 + $
+1 -1
t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^
··· 1 1 $ git format-patch --stdout --cover-letter -n initial..master^ 2 2 From 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0 Mon Sep 17 00:00:00 2001 3 3 From: C O Mitter <committer@example.com> 4 - Date: Mon, 26 Jun 2006 00:05:00 +0000 4 + Date: Mon, 26 Jun 2006 00:06:00 +0000 5 5 Subject: [DIFFERENT_PREFIX 0/2] *** SUBJECT HERE *** 6 6 7 7 *** BLURB HERE ***
+6
t/t4013/diff.log_--decorate=full_--all
··· 1 1 $ git log --decorate=full --all 2 + commit cd4e72fd96faed3f0ba949dc42967430374e2290 (refs/heads/rearrange) 3 + Author: A U Thor <author@example.com> 4 + Date: Mon Jun 26 00:06:00 2006 +0000 5 + 6 + Rearranged lines in dir/sub 7 + 2 8 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD, refs/heads/master) 3 9 Merge: 9a6d494 c7a2ab9 4 10 Author: A U Thor <author@example.com>
+6
t/t4013/diff.log_--decorate_--all
··· 1 1 $ git log --decorate --all 2 + commit cd4e72fd96faed3f0ba949dc42967430374e2290 (rearrange) 3 + Author: A U Thor <author@example.com> 4 + Date: Mon Jun 26 00:06:00 2006 +0000 5 + 6 + Rearranged lines in dir/sub 7 + 2 8 commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD, master) 3 9 Merge: 9a6d494 c7a2ab9 4 10 Author: A U Thor <author@example.com>