]> git.ipfire.org Git - thirdparty/git.git/commit - pretty.c
pretty: make it easier to add new formats
authorWill Palmer <wmpalmer@gmail.com>
Sun, 2 May 2010 11:00:42 +0000 (12:00 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 May 2010 16:40:27 +0000 (09:40 -0700)
commit409578912cb21bdad4a75f34af7c0a815ac9d06b
tree90371a60fd23e2bd2b7c5bfe39bfebcac8141772
parentd599e0484f8ebac8cc50e9557a4c3d246826843d
pretty: make it easier to add new formats

As the first step towards creating aliases, we make it easier to add new
formats to the list of builtin formats. To do this, we move the
initialization of the formats array into a new function,
setup_commit_formats(), which we can easily extend later. Then, rather
than looping through only the list of known formats, we make a more
generic find_commit_format function, which will return the commit format
whose name is the shortest which is prefixed with the passed-in sought
format, the same rules which were more-or-less hard-coded in before.

Signed-off-by: Will Palmer <wmpalmer@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pretty.c