Re: Re* [PATCH] "not uptodate" changed to "has local changes"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 21, 2008, 07:07 UTC
- Message-ID
- <7v4p8s6spa.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <alpine.LNX.1.00.0805191523060.19665@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> writes:
Show 6 quoted lines
> On Mon, 19 May 2008, Junio C Hamano wrote: > >> Why does *everybody* keep missing the whole point of this patch? > > That section needs a comment stating that it's the scripting API, not just > an arbitrary set of messages.
Yeah, that is a very good explanation. Thanks for a constructive suggestion for improvements.
Here is an incremental on top of the one I sent out, in case people want to improve on it.
unpack-trees.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/unpack-trees.c b/unpack-trees.c index da3bdc8..0de5a31 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -8,7 +8,15 @@ #include "progress.h" #include "refs.h" -static struct unpack_trees_error_msgs unpack_default_errors = { +/* + * Error messages expected by scripts out of plumbing commands such as + * read-tree. Non-scripted Porcelain is not required to use these messages + * and in fact are encouraged to reword them to better suit their particular + * situation better. See how "git checkout" replaces not_uptodate_file to + * explain why it does not allow switching between branches when you have + * local changes, for example. + */ +static struct unpack_trees_error_msgs unpack_plumbing_errors = { /* would_overwrite */ "Entry '%s' would be overwritten by merge. Cannot merge.", @@ -28,7 +36,7 @@ static struct unpack_trees_error_msgs unpack_default_errors = { #define ERRORMSG(o,fld) \ ( ((o) && (o)->msgs.fld) \ ? ((o)->msgs.fld) \ - : (unpack_default_errors.fld) ) + : (unpack_plumbing_errors.fld) ) static void add_entry(struct unpack_trees_options *o, struct cache_entry *ce, unsigned int set, unsigned int clear)