--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>
This commit is contained in:

committed by
Junio C Hamano

parent
5fb41b883a
commit
204f01a2f7
@ -72,6 +72,10 @@ endif::git-format-patch[]
|
|||||||
a cut-off percent (3% by default) are not shown. The cut-off percent
|
a cut-off percent (3% by default) are not shown. The cut-off percent
|
||||||
can be set with `--dirstat=<limit>`. Changes in a child directory are not
|
can be set with `--dirstat=<limit>`. Changes in a child directory are not
|
||||||
counted for the parent directory, unless `--cumulative` is used.
|
counted for the parent directory, unless `--cumulative` is used.
|
||||||
|
+
|
||||||
|
Note that the `--dirstat` option computes the changes while ignoring
|
||||||
|
pure code movements within a file. In other words, rearranging lines
|
||||||
|
in a file is not counted as a change.
|
||||||
|
|
||||||
--dirstat-by-file[=<limit>]::
|
--dirstat-by-file[=<limit>]::
|
||||||
Same as `--dirstat`, but counts changed files instead of lines.
|
Same as `--dirstat`, but counts changed files instead of lines.
|
||||||
|
@ -80,18 +80,31 @@ test_expect_success setup '
|
|||||||
|
|
||||||
git config log.showroot false &&
|
git config log.showroot false &&
|
||||||
git commit --amend &&
|
git commit --amend &&
|
||||||
|
|
||||||
|
GIT_AUTHOR_DATE="2006-06-26 00:06:00 +0000" &&
|
||||||
|
GIT_COMMITTER_DATE="2006-06-26 00:06:00 +0000" &&
|
||||||
|
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&
|
||||||
|
git checkout -b rearrange initial &&
|
||||||
|
for i in B A; do echo $i; done >dir/sub &&
|
||||||
|
git add dir/sub &&
|
||||||
|
git commit -m "Rearranged lines in dir/sub" &&
|
||||||
|
git checkout master &&
|
||||||
|
|
||||||
git show-branch
|
git show-branch
|
||||||
'
|
'
|
||||||
|
|
||||||
: <<\EOF
|
: <<\EOF
|
||||||
! [initial] Initial
|
! [initial] Initial
|
||||||
* [master] Merge branch 'side'
|
* [master] Merge branch 'side'
|
||||||
! [side] Side
|
! [rearrange] Rearranged lines in dir/sub
|
||||||
---
|
! [side] Side
|
||||||
- [master] Merge branch 'side'
|
----
|
||||||
*+ [side] Side
|
+ [rearrange] Rearranged lines in dir/sub
|
||||||
* [master^] Second
|
- [master] Merge branch 'side'
|
||||||
+*+ [initial] Initial
|
* + [side] Side
|
||||||
|
* [master^] Third
|
||||||
|
* [master~2] Second
|
||||||
|
+*++ [initial] Initial
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
V=`git version | sed -e 's/^git version //' -e 's/\./\\./g'`
|
V=`git version | sed -e 's/^git version //' -e 's/\./\\./g'`
|
||||||
@ -287,6 +300,8 @@ diff --no-index --name-status -- dir2 dir
|
|||||||
diff --no-index dir dir3
|
diff --no-index dir dir3
|
||||||
diff master master^ side
|
diff master master^ side
|
||||||
diff --dirstat master~1 master~2
|
diff --dirstat master~1 master~2
|
||||||
|
# --dirstat doesn't notice changes that simply rearrange existing lines
|
||||||
|
diff --dirstat initial rearrange
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'log -S requires an argument' '
|
test_expect_success 'log -S requires an argument' '
|
||||||
|
2
t/t4013/diff.diff_--dirstat_initial_rearrange
Normal file
2
t/t4013/diff.diff_--dirstat_initial_rearrange
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$ git diff --dirstat initial rearrange
|
||||||
|
$
|
@ -1,7 +1,7 @@
|
|||||||
$ git format-patch --stdout --cover-letter -n initial..master^
|
$ git format-patch --stdout --cover-letter -n initial..master^
|
||||||
From 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0 Mon Sep 17 00:00:00 2001
|
From 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0 Mon Sep 17 00:00:00 2001
|
||||||
From: C O Mitter <committer@example.com>
|
From: C O Mitter <committer@example.com>
|
||||||
Date: Mon, 26 Jun 2006 00:05:00 +0000
|
Date: Mon, 26 Jun 2006 00:06:00 +0000
|
||||||
Subject: [DIFFERENT_PREFIX 0/2] *** SUBJECT HERE ***
|
Subject: [DIFFERENT_PREFIX 0/2] *** SUBJECT HERE ***
|
||||||
|
|
||||||
*** BLURB HERE ***
|
*** BLURB HERE ***
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
$ git log --decorate=full --all
|
$ git log --decorate=full --all
|
||||||
|
commit cd4e72fd96faed3f0ba949dc42967430374e2290 (refs/heads/rearrange)
|
||||||
|
Author: A U Thor <author@example.com>
|
||||||
|
Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
|
Rearranged lines in dir/sub
|
||||||
|
|
||||||
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD, refs/heads/master)
|
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD, refs/heads/master)
|
||||||
Merge: 9a6d494 c7a2ab9
|
Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
$ git log --decorate --all
|
$ git log --decorate --all
|
||||||
|
commit cd4e72fd96faed3f0ba949dc42967430374e2290 (rearrange)
|
||||||
|
Author: A U Thor <author@example.com>
|
||||||
|
Date: Mon Jun 26 00:06:00 2006 +0000
|
||||||
|
|
||||||
|
Rearranged lines in dir/sub
|
||||||
|
|
||||||
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD, master)
|
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD, master)
|
||||||
Merge: 9a6d494 c7a2ab9
|
Merge: 9a6d494 c7a2ab9
|
||||||
Author: A U Thor <author@example.com>
|
Author: A U Thor <author@example.com>
|
||||||
|
Reference in New Issue
Block a user