forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix "log" family not to be too agressive about showing notes
Giving "Notes" information in the default output format of "log" and "show" is a sensible progress (the user has asked for it by having the notes), but for some commands (e.g. "format-patch") spewing notes into the formatted commit log message without being asked is too aggressive. Enable notes output only for "log", "show", "whatchanged" by default and only when the user didn't ask any specific --pretty/--format from the command line; users can explicitly override this default with --show-notes and --no-notes option. Parts of tests are taken from Jeff King's fix. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
- Loading branch information
Showing
8 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,4 +147,61 @@ test_expect_success 'show -m and -F notes' ' | |
test_cmp expect-m-and-F output | ||
' | ||
|
||
cat >expect << EOF | ||
commit 15023535574ded8b1a89052b32673f84cf9582b8 | ||
tree e070e3af51011e47b183c33adf9736736a525709 | ||
parent 1584215f1d29c65e99c6c6848626553fdd07fd75 | ||
author A U Thor <[email protected]> 1112912173 -0700 | ||
committer C O Mitter <[email protected]> 1112912173 -0700 | ||
4th | ||
EOF | ||
test_expect_success 'git log --pretty=raw does not show notes' ' | ||
git log -1 --pretty=raw >output && | ||
test_cmp expect output | ||
' | ||
|
||
cat >>expect <<EOF | ||
Notes: | ||
spam | ||
$whitespace | ||
xyzzy | ||
$whitespace | ||
foo | ||
bar | ||
baz | ||
EOF | ||
test_expect_success 'git log --show-notes' ' | ||
git log -1 --pretty=raw --show-notes >output && | ||
test_cmp expect output | ||
' | ||
|
||
test_expect_success 'git log --no-notes' ' | ||
git log -1 --no-notes >output && | ||
! grep spam output | ||
' | ||
|
||
test_expect_success 'git format-patch does not show notes' ' | ||
git format-patch -1 --stdout >output && | ||
! grep spam output | ||
' | ||
|
||
test_expect_success 'git format-patch --show-notes does show notes' ' | ||
git format-patch --show-notes -1 --stdout >output && | ||
grep spam output | ||
' | ||
|
||
for pretty in "" raw short medium full fuller format:%s | ||
do | ||
case "$pretty" in | ||
"") p= not= negate="" ;; | ||
?*) p="--pretty=$pretty" not=" not" negate="!" ;; | ||
esac | ||
test_expect_success "git show $pretty does$not show notes" ' | ||
git show $p >output && | ||
eval "$negate grep spam output" | ||
' | ||
done | ||
|
||
test_done |