Re: [PATCH] Builtin-commit: show on which branch a commit was added

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Pieter de Bie <pdebie@...>
Cc: Git Mailinglist <git@...>
Date: Sunday, September 7, 2008 - 1:27 am

Pieter de Bie <pdebie@ai.rug.nl> writes:


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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] Builtin-commit: show on which branch a commit wa..., Junio C Hamano, (Sun Sep 7, 1:27 am)
[PATCH] git commit: Reformat output somewhat, Andreas Ericsson, (Tue Sep 30, 5:52 am)
[PATCH 1/2] pretty.c: add %% format specifier, Pieter de Bie, (Sun Sep 7, 7:05 pm)