Given the recent "reminder" discussion, I suspect people without $PS1 set
to show the current branch would like this, majority of others would be
neutral, while some may actively hate it for cluttering the output even
more. But I also suspect the initial annoyance the third camp may feel
will pass rather quickly after they get used to seeing these.
Style.
static char *get_commit_format_string(void)
Style.
const char *head = ...
Isn't this function crafting a format string for format_commit_message()?
What happens if your branch name has % in it?
API violation, I think; see strbuf_detach().
Style.
char *format = ...
I somehow suspect it might be much simpler, more contained and robust if you:
(1) chuck get_commit_format_string(), and leave all the existing code as-is;
(2) format "%h: %s" into buf here;
(3) call resolve_ref(HEAD) here to see if you are on detached HEAD (or
otherwise what branch you are on) after (2),
(4) find the first ':' in buf.buf and do your "on HEAD"/"on master"
magic, using the result from (3).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html