[PATCH v4 0/5] Pretty formats for reflog data
DORMANTno replies
From: Thomas Rast <hidden>
Date: 2016-06-15 22:47:34
Revision v4 of 4 in this series.
Revisions (4)
- rfc [diff vs current]
- v2 [diff vs current]
- v3 [diff vs current]
- v4 current
Junio C Hamano wrote:
One solution to help the compiler catch this kind of semantic crash upon merging or applying code based on the old format_commit_message() would have been to change its function signature (or even the name), so that it would not go unnoticed that DATE_NORMAL that happens to be "0" is silently interpreted as (void *)0 == NULL.
Indeed, that would have been a good idea. (I still don't fully see the use of allowing an enum value as a pointer, but apparently the standard's that way.) I fixed the calls to format_commit_message(), but without changing the function signature compared to the last patch. I also decided not to put in the test case; the easiest I could come up with was the following: -- 8< --
diff --git i/t/t5001-archive-attr.sh w/t/t5001-archive-attr.sh
index 426b319..0950527 100755
--- i/t/t5001-archive-attr.sh
+++ w/t/t5001-archive-attr.sh@@ -4,7 +4,7 @@ test_description='git archive attribute tests' . ./test-lib.sh -SUBSTFORMAT=%H%n +SUBSTFORMAT=%H%ad%n test_expect_exists() { test_expect_success " $1 exists" "test -e $1" -- >8 --
which immediately fails most tests in the file because of segfaults
with the buggy series. However, it still wouldn't catch other broken
callers, if there were any, so I left it out.
Compared to v3, I also rebased the series on current master, which
conflicted with 7f98ebc (format_commit_message(): fix function
signature, 2009-10-15) so you now need that commit to apply it.
Finally, I squashed a revert of 0a0c342 (git-stash documentation:
mention default options for 'list', 2009-10-12) into 5/5 since there
are no more default options after my patch.
Thomas Rast (5):
Refactor pretty_print_commit arguments into a struct
reflog-walk: refactor the branch@{num} formatting
Introduce new pretty formats %g[sdD] for reflog information
stash list: use new %g formats instead of sed
stash list: drop the default limit of 10 stashes
Documentation/git-stash.txt | 3 +-
Documentation/pretty-formats.txt | 9 ++++
archive.c | 4 +-
builtin-branch.c | 3 +-
builtin-checkout.c | 3 +-
builtin-commit.c | 8 +++-
builtin-log.c | 3 +-
builtin-merge.c | 7 ++-
builtin-rev-list.c | 7 ++-
builtin-shortlog.c | 9 +++-
builtin-show-branch.c | 4 +-
commit.h | 20 ++++++---
git-stash.sh | 8 +---
log-tree.c | 25 ++++++-----
pretty.c | 44 ++++++++++++++------
reflog-walk.c | 83 ++++++++++++++++++++++++++++----------
reflog-walk.h | 8 ++++
t/t6006-rev-list-format.sh | 18 ++++++++
18 files changed, 189 insertions(+), 77 deletions(-)