{"thread":{"id":"13367","subject":"[PATCH] \"not uptodate\" changed to \"has local changes\"","startedAt":"2008-05-03T16:59:32Z","lastAt":"2008-05-21T07:07:29Z","messageCount":24,"participants":["Tim Harper","Mike Ralphson","André Goddard Rosa","Johannes Schindelin","Holger Schurig","Francis Moreau","Kevin Ballard","Steven Walter","Wincent Colaiuta","Matthieu Moy","Sverre Rabbelier","Junio C Hamano","Daniel Barkalow"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"75943","messageId":"1209833972-12256-1-git-send-email-timcharper@gmail.com","threadId":"13367","inReplyTo":null,"subject":"[PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Tim Harper","fromEmail":"timcharper@gmail.com","sentAt":"2008-05-03T16:59:32Z","receivedAt":"2008-05-03T16:59:32Z","isPatch":true,"sender":{"key":"timcharper@gmail.com","avatar":"https://gravatar.com/avatar/1a2e0c06c7862ff065ee6b1d53195333a5a0577c040ecb2856a150d8e0b00ecd?d=mp&s=160"},"body":"When doing a merge, the message says \"file.txt: needs update\", or \"file.txt: not uptodate, cannot merge\".   While internally 'uptodate' makes sense, from the outside it's a mystery.\n\nThis patch will make git a little more human friendly, reporting \"file.txt: has local changes\".\n---\n read-cache.c   |    2 +-\n unpack-trees.c |    2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/read-cache.c b/read-cache.c\nindex a92b25b..e890b27 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -999,7 +999,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p\n \t\t\t}\n \t\t\tif (quiet)\n \t\t\t\tcontinue;\n-\t\t\tprintf(\"%s: needs update\\n\", ce->name);\n+\t\t\tprintf(\"%s: has local changes\\n\", ce->name);\n \t\t\thas_errors = 1;\n \t\t\tcontinue;\n \t\t}\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex a59f475..1d67e08 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -427,7 +427,7 @@ static int verify_uptodate(struct cache_entry *ce,\n \tif (errno == ENOENT)\n \t\treturn 0;\n \treturn o->gently ? -1 :\n-\t\terror(\"Entry '%s' not uptodate. Cannot merge.\", ce->name);\n+\t\terror(\"Entry '%s' has local changes. Cannot merge.\", ce->name);\n }\n \n static void invalidate_ce_path(struct cache_entry *ce, struct unpack_trees_options *o)\n-- \n1.5.5.1\n"},{"id":"76203","messageId":"e2b179460805060631l506e2a6leaafc9c0acf3b05b@mail.gmail.com","threadId":"13367","inReplyTo":"1209833972-12256-1-git-send-email-timcharper@gmail.com","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Mike Ralphson","fromEmail":"mike.ralphson@gmail.com","sentAt":"2008-05-06T13:31:59Z","receivedAt":"2008-05-06T13:31:59Z","isPatch":true,"sender":{"key":"mike.ralphson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/21603?v=4"},"body":"2008/5/3 Tim Harper <timcharper@gmail.com>:\n> When doing a merge, the message says \"file.txt: needs update\", or \"file.txt: not uptodate, cannot merge\".   While internally 'uptodate' makes sense, from the outside it's a mystery.\n>\n>  This patch will make git a little more human friendly, reporting \"file.txt: has local changes\".\n\nDocumentation/git-checkout.txt should also change in this case,\notherwise users will see different output to that described and\npossibly get confused if following along with the examples.\n\nMike\n"},{"id":"77093","messageId":"b8bf37780805151914j65ce5406xc5e6b3d29e3bfb9b@mail.gmail.com","threadId":"13367","inReplyTo":"e2b179460805060631l506e2a6leaafc9c0acf3b05b@mail.gmail.com","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"André Goddard Rosa","fromEmail":"andre.goddard@gmail.com","sentAt":"2008-05-16T02:14:36Z","receivedAt":"2008-05-16T02:14:36Z","isPatch":true,"sender":{"key":"andre.goddard@gmail.com","avatar":null},"body":">>  This patch will make git a little more human friendly, reporting \"file.txt: has local changes\".\n>\n> Documentation/git-checkout.txt should also change in this case,\n> otherwise users will see different output to that described and\n> possibly get confused if following along with the examples.\n>\n\nI like the idea too.\n\n---\n[PATCH] \"not uptodate\" changed to \"has local changes\"\n\nUse more straightforward message for regular user.\n\nSigned-off-by: Andre Goddard Rosa <andre.goddard@gmail.com>\n\ndiff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt\nindex a644173..624dea6 100644\n--- a/Documentation/git-checkout.txt\n+++ b/Documentation/git-checkout.txt\n@@ -168,7 +168,7 @@ the above checkout would fail like this:\n +\n ------------\n $ git checkout mytopic\n-fatal: Entry 'frotz' not uptodate. Cannot merge.\n+fatal: Entry 'frotz' has local changes. Cannot merge.\n ------------\n +\n You can give the `-m` flag to the command, which would try a\n"},{"id":"77110","messageId":"alpine.DEB.1.00.0805161125320.30431@racer","threadId":"13367","inReplyTo":"b8bf37780805151914j65ce5406xc5e6b3d29e3bfb9b@mail.gmail.com","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-16T10:25:55Z","receivedAt":"2008-05-16T10:25:55Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 15 May 2008, André Goddard Rosa wrote:\n\n> >>  This patch will make git a little more human friendly, reporting \"file.txt: has local changes\".\n> >\n> > Documentation/git-checkout.txt should also change in this case,\n> > otherwise users will see different output to that described and\n> > possibly get confused if following along with the examples.\n> >\n> \n> I like the idea too.\n\nNo comment on the concern that it might break people's scripts?  None?\n\nCiao,\nDscho\n"},{"id":"77116","messageId":"200805161302.47865.hs4233@mail.mn-solutions.de","threadId":"13367","inReplyTo":"alpine.DEB.1.00.0805161125320.30431@racer","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Holger Schurig","fromEmail":"hs4233@mail.mn-solutions.de","sentAt":"2008-05-16T11:02:47Z","receivedAt":"2008-05-16T11:02:47Z","isPatch":true,"sender":{"key":"hs4233@mail.mn-solutions.de","avatar":null},"body":"> No comment on the concern that it might break people's\n> scripts?  None?\n\nScripts should look for exit values :-)\n"},{"id":"77119","messageId":"38b2ab8a0805160450s495aceddy3335d27f076aa64e@mail.gmail.com","threadId":"13367","inReplyTo":"200805161302.47865.hs4233@mail.mn-solutions.de","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2008-05-16T11:50:39Z","receivedAt":"2008-05-16T11:50:39Z","isPatch":true,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"On Fri, May 16, 2008 at 1:02 PM, Holger Schurig\n<hs4233@mail.mn-solutions.de> wrote:\n>> No comment on the concern that it might break people's\n>> scripts?  None?\n>\n> Scripts should look for exit values :-)\n\nexcept that they're not documented ;)\n\n-- \nFrancis\n"},{"id":"77120","messageId":"alpine.DEB.1.00.0805161322090.30431@racer","threadId":"13367","inReplyTo":"200805161302.47865.hs4233@mail.mn-solutions.de","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-16T12:22:36Z","receivedAt":"2008-05-16T12:22:36Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 16 May 2008, Holger Schurig wrote:\n\n> > No comment on the concern that it might break people's\n> > scripts?  None?\n> \n> Scripts should look for exit values :-)\n\nClever.  And which exit value would you exactly check to see _which_ file \nneeds an update?\n\nHth,\nDscho\n"},{"id":"77148","messageId":"1ED37CF1-EABD-4881-BA29-ED2CB1CE73FC@sb.org","threadId":"13367","inReplyTo":"alpine.DEB.1.00.0805161125320.30431@racer","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2008-05-16T17:12:39Z","receivedAt":"2008-05-16T17:12:39Z","isPatch":true,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"On May 16, 2008, at 6:25 AM, Johannes Schindelin wrote:\n\n> On Thu, 15 May 2008, André Goddard Rosa wrote:\n>\n>>>> This patch will make git a little more human friendly, reporting  \n>>>> \"file.txt: has local changes\".\n>>>\n>>> Documentation/git-checkout.txt should also change in this case,\n>>> otherwise users will see different output to that described and\n>>> possibly get confused if following along with the examples.\n>>>\n>>\n>> I like the idea too.\n>\n> No comment on the concern that it might break people's scripts?  None?\n\n\nHow about an ugly hack? Look to see if stdout is a tty, if so spit out  \nthe more human-readable version, otherwise spit out the old version >:-)\n\n-Kevin\n\n-- \nKevin Ballard\nhttp://kevin.sb.org\nkevin@sb.org\nhttp://www.tildesoft.com\n"},{"id":"77175","messageId":"b8bf37780805162030m4c961505nabd72e8f5bd08404@mail.gmail.com","threadId":"13367","inReplyTo":"1ED37CF1-EABD-4881-BA29-ED2CB1CE73FC@sb.org","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"André Goddard Rosa","fromEmail":"andre.goddard@gmail.com","sentAt":"2008-05-17T03:30:40Z","receivedAt":"2008-05-17T03:30:40Z","isPatch":true,"sender":{"key":"andre.goddard@gmail.com","avatar":null},"body":"On Fri, May 16, 2008 at 2:12 PM, Kevin Ballard <kevin@sb.org> wrote:\n> On May 16, 2008, at 6:25 AM, Johannes Schindelin wrote:\n>\n>> On Thu, 15 May 2008, André Goddard Rosa wrote:\n>>\n>>>>> This patch will make git a little more human friendly, reporting\n>>>>> \"file.txt: has local changes\".\n>>>>\n>>>> Documentation/git-checkout.txt should also change in this case,\n>>>> otherwise users will see different output to that described and\n>>>> possibly get confused if following along with the examples.\n>>>>\n>>>\n>>> I like the idea too.\n>>\n>> No comment on the concern that it might break people's scripts?  None?\n>\n>\n> How about an ugly hack? Look to see if stdout is a tty, if so spit out the\n> more human-readable version, otherwise spit out the old version >:-)\n\nIs this user interface set on stone? I think we should reserve the\nright to improve always.\n\nI would deprecate the current message, but I think that most users\ncannot find so much of a sense in the former message,\nalthough the script developer can easily change his scripts to search\nfor ´cannot merge´ instead.\n\nDo you have a better idea?\n\n---\n[PATCH] \"not uptodate\" changed to \"has local changes\"\n\nUse more straightforward message for regular user.\n\nSigned-off-by: Andre Goddard Rosa <andre.goddard@gmail.com>\n\ndiff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt\nindex a644173..624dea6 100644\n--- a/Documentation/git-checkout.txt\n+++ b/Documentation/git-checkout.txt\n@@ -168,7 +168,7 @@ the above checkout would fail like this:\n +\n ------------\n $ git checkout mytopic\n-fatal: Entry 'frotz' not uptodate. Cannot merge.\n+fatal: Entry 'frotz' not uptodate, it has local changes. Cannot merge.\n ------------\n +\n You can give the `-m` flag to the command, which would try a\n"},{"id":"77181","messageId":"alpine.DEB.1.00.0805171102480.30431@racer","threadId":"13367","inReplyTo":"b8bf37780805162030m4c961505nabd72e8f5bd08404@mail.gmail.com","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-17T10:04:09Z","receivedAt":"2008-05-17T10:04:09Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 17 May 2008, André Goddard Rosa wrote:\n\n> On Fri, May 16, 2008 at 2:12 PM, Kevin Ballard <kevin@sb.org> wrote:\n> > On May 16, 2008, at 6:25 AM, Johannes Schindelin wrote:\n> >\n> >> On Thu, 15 May 2008, André Goddard Rosa wrote:\n> >>\n> >>>>> This patch will make git a little more human friendly, reporting\n> >>>>> \"file.txt: has local changes\".\n> >>>>\n> >>>> Documentation/git-checkout.txt should also change in this case,\n> >>>> otherwise users will see different output to that described and\n> >>>> possibly get confused if following along with the examples.\n> >>>>\n> >>>\n> >>> I like the idea too.\n> >>\n> >> No comment on the concern that it might break people's scripts?  None?\n> >\n> >\n> > How about an ugly hack? Look to see if stdout is a tty, if so spit out the\n> > more human-readable version, otherwise spit out the old version >:-)\n> \n> Is this user interface set on stone? I think we should reserve the right \n> to improve always.\n\nUmm.\n\nAs has been mentioned, this is not a \"user interface\".  The message you \nare seeing comes from a _plumbing_ program, i.e. something _not_ meant for \nhuman consumption.\n\nI still think that it might be better to add a command line option with a \ncustom message, because that would _not_ break backwards-compatibility.\n\nThankyouverymuch,\nDscho\n"},{"id":"77190","messageId":"e06498070805170744l7ad213aeqb779b0c0381e1de4@mail.gmail.com","threadId":"13367","inReplyTo":"alpine.DEB.1.00.0805171102480.30431@racer","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Steven Walter","fromEmail":"stevenrwalter@gmail.com","sentAt":"2008-05-17T14:44:15Z","receivedAt":"2008-05-17T14:44:15Z","isPatch":true,"sender":{"key":"stevenrwalter@gmail.com","avatar":"https://avatars.githubusercontent.com/u/79127?v=4"},"body":"On Sat, May 17, 2008 at 6:04 AM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n>> Is this user interface set on stone? I think we should reserve the right\n>> to improve always.\n>\n> Umm.\n>\n> As has been mentioned, this is not a \"user interface\".  The message you\n> are seeing comes from a _plumbing_ program, i.e. something _not_ meant for\n> human consumption.\n>\n> I still think that it might be better to add a command line option with a\n> custom message, because that would _not_ break backwards-compatibility.\n\nWith this dedication to backwards-compatibility, we'll be at Windows\nVista quality in no time.\n-- \n-Steven Walter <stevenrwalter@gmail.com>\n"},{"id":"77192","messageId":"393B2C1A-49D3-48A7-BF7D-7938D212AF82@wincent.com","threadId":"13367","inReplyTo":"alpine.DEB.1.00.0805171102480.30431@racer","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-05-17T15:08:23Z","receivedAt":"2008-05-17T15:08:23Z","isPatch":true,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 17/5/2008, a las 12:04, Johannes Schindelin escribió:\n> Hi,\n>\n> On Sat, 17 May 2008, André Goddard Rosa wrote:\n>\n>> Is this user interface set on stone? I think we should reserve the  \n>> right\n>> to improve always.\n>\n> Umm.\n>\n> As has been mentioned, this is not a \"user interface\".  The message  \n> you\n> are seeing comes from a _plumbing_ program, i.e. something _not_  \n> meant for\n> human consumption.\n\nThat would indicate a problem, if stuff not intended for human  \nconsumption is being dished up for exactly that: human consumption.\n\n> I still think that it might be better to add a command line option  \n> with a\n> custom message, because that would _not_ break backwards- \n> compatibility.\n\nSounds like clutter to me. I'd instead favor just holding back this  \npatch until 1.6, when (minor) \"compatibility breaking\" changes would  \nbe acceptable.\n\nWincent\n"},{"id":"77194","messageId":"vpq63tdgd5a.fsf@bauges.imag.fr","threadId":"13367","inReplyTo":"393B2C1A-49D3-48A7-BF7D-7938D212AF82@wincent.com","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2008-05-17T15:32:01Z","receivedAt":"2008-05-17T15:32:01Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Wincent Colaiuta <win@wincent.com> writes:\n\n> That would indicate a problem, if stuff not intended for human\n> consumption is being dished up for exactly that: human consumption.\n\nThere have been other instances of this one, and the output of\ngit-update-index has been replaced by a call to \"git status\" in the\nporcelain.\n\n-- \nMatthieu\n"},{"id":"77195","messageId":"bd6139dc0805170912w14b7894fxfebe15c14e4c44ef@mail.gmail.com","threadId":"13367","inReplyTo":"e06498070805170744l7ad213aeqb779b0c0381e1de4@mail.gmail.com","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Sverre Rabbelier","fromEmail":"alturin@gmail.com","sentAt":"2008-05-17T16:12:15Z","receivedAt":"2008-05-17T16:12:15Z","isPatch":true,"sender":{"key":"alturin@gmail.com","avatar":null},"body":"On Sat, May 17, 2008 at 4:44 PM, Steven Walter <stevenrwalter@gmail.com> wrote:\n> With this dedication to backwards-compatibility, we'll be at Windows\n> Vista quality in no time.\n\nI very much agree here, given the nature of scripts (that is, being\nvery easy to update), I think we should try not to be too strict in\nbackwards-compatibility or we'll lose the flexibility that is very\nmuch needed when developing a Good Product (tm) As long as such\ncompatibility breaking changes are marked (in BIG LETTERS) in the\nchangelog/release notes I think that would be a 'sacrifice' we should\nconsider making.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"77199","messageId":"alpine.DEB.1.00.0805171939540.30431@racer","threadId":"13367","inReplyTo":"bd6139dc0805170912w14b7894fxfebe15c14e4c44ef@mail.gmail.com","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-17T18:44:03Z","receivedAt":"2008-05-17T18:44:03Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 17 May 2008, Sverre Rabbelier wrote:\n\n> On Sat, May 17, 2008 at 4:44 PM, Steven Walter <stevenrwalter@gmail.com> \n> wrote:\n>\n> > With this dedication to backwards-compatibility, we'll be at Windows \n> > Vista quality in no time.\n\nThat is silly at best, especially given that Vista is _not_ \nbackwards-compatible.  Not to mention that it is not forkable, because it \nis not Open Source.\n\n> I very much agree here, given the nature of scripts (that is, being very \n> easy to update), I think we should try not to be too strict in \n> backwards-compatibility or we'll lose the flexibility that is very much \n> needed when developing a Good Product (tm) As long as such compatibility \n> breaking changes are marked (in BIG LETTERS) in the changelog/release \n> notes I think that would be a 'sacrifice' we should consider making.\n\nHad you (one of our GSoc students) not replied, I would not even have \nbothered to say anything.\n\nBut I strongly disagree with the notion that it is okay to fsck with \nold-timers (who would be harmed by breaking backwards-incompatibility, \nand nobody else), especially given that it is mostly old-timers who turned \nGit into the Good Product(tm) it is.\n\nCiao,\nDscho\n"},{"id":"77200","messageId":"7v63tcda7e.fsf_-_@gitster.siamese.dyndns.org","threadId":"13367","inReplyTo":"bd6139dc0805170912w14b7894fxfebe15c14e4c44ef@mail.gmail.com","subject":"Re* [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-17T19:03:49Z","receivedAt":"2008-05-17T19:03:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Sverre Rabbelier\" <alturin@gmail.com> writes:\n\n> On Sat, May 17, 2008 at 4:44 PM, Steven Walter <stevenrwalter@gmail.com> wrote:\n>> With this dedication to backwards-compatibility, we'll be at Windows\n>> Vista quality in no time.\n>\n> I very much agree here, given the nature of scripts (that is, being\n> very easy to update), I think we should try not to be too strict in\n> backwards-compatibility or we'll lose the flexibility that is very\n> much needed when developing a Good Product (tm) As long as such\n> compatibility breaking changes are marked (in BIG LETTERS) in the\n> changelog/release notes I think that would be a 'sacrifice' we should\n> consider making.\n\nDon't feed the troll by responding to a cheap shot.\n\nThe plumbing output is sacred as it is an API.  We _could_ change it if it\nis broken in such a way that it cannot convey necessary information fully,\nbut we just do not _reword_ for the sake of rewording.  If somebody does\nnot like it, s/he is complaining too late.  S/he should have been here in\nearly May 2005 and make the language used by the API closer to what humans\nread.  S/he wasn't here.  Too bad, and it is too late.  \n\nAnd people who complain should look at a bigger picture.  Look at what was\nsuggested by one of them and think for five seconds:\n\n     $ git checkout mytopic\n    -fatal: Entry 'frotz' not uptodate. Cannot merge.\n    +fatal: Entry 'frotz' has local changes. Cannot merge.\n\nIf you do not see something wrong with this output, your brain has already\nbeen rotten with use of git for too long a time.  Nobody asked us to\n\"merge\" but why are we talking about \"Cannot merge\"?\n\nTry a different approach along this patch instead.\n\n    $ git-checkout pu\n    error: You have local changes to 'Makefile'; cannot switch branches.\n\nThere are other places that ask unpack_trees() to n-way merge, detect\nissues _and_ let it issue error message on its own, which people who\ncomplained in this thread can identify and improve, but I did this as a\ndemonstration and replaced only one message.\n\nYes I know about C99 structure initializers.  I'd love to use them but we\ntry to be nice to compilers without it.\n\n builtin-checkout.c |    2 ++\n unpack-trees.c     |   47 +++++++++++++++++++++++++++++++++--------------\n unpack-trees.h     |    9 +++++++++\n 3 files changed, 44 insertions(+), 14 deletions(-)\n\ndiff --git a/builtin-checkout.c b/builtin-checkout.c\nindex 10ec137..83da7ca 100644\n--- a/builtin-checkout.c\n+++ b/builtin-checkout.c\n@@ -236,6 +236,8 @@ static int merge_working_tree(struct checkout_opts *opts,\n \t\ttopts.src_index = &the_index;\n \t\ttopts.dst_index = &the_index;\n \n+\t\ttopts.msgs.not_uptodate_file = \"You have local changes to '%s'; cannot switch branches.\";\n+\n \t\trefresh_cache(REFRESH_QUIET);\n \n \t\tif (unmerged_cache()) {\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 1ab28fd..bec12dc 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -8,6 +8,28 @@\n #include \"progress.h\"\n #include \"refs.h\"\n \n+static struct unpack_trees_error_msgs unpack_default_errors = {\n+\t/* would_overwrite */\n+\t\"Entry '%s' would be overwritten by merge. Cannot merge.\",\n+\n+\t/* not_uptodate_file */ \n+\t\"Entry '%s' not uptodate. Cannot merge.\",\n+\n+\t/* not_uptodate_dir */\n+\t\"Updating '%s' would lose untracked files in it\",\n+\n+\t/* would_lose_untracked */\n+\t\"Untracked working tree file '%s' would be %s by merge.\",\n+\n+\t/* bind_overlap */\n+\t\"Entry '%s' overlaps with '%s'.  Cannot bind.\",\n+};\n+\n+#define ERRORMSG(o,fld) \\\n+\t( ((o) && (o)->msgs.fld) \\\n+\t? ((o)->msgs.fld) \\\n+\t: (unpack_default_errors.fld) )\n+\n static void add_entry(struct unpack_trees_options *o, struct cache_entry *ce,\n \tunsigned int set, unsigned int clear)\n {\n@@ -383,10 +405,9 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options\n \n /* Here come the merge functions */\n \n-static int reject_merge(struct cache_entry *ce)\n+static int reject_merge(struct cache_entry *ce, struct unpack_trees_options *o)\n {\n-\treturn error(\"Entry '%s' would be overwritten by merge. Cannot merge.\",\n-\t\t     ce->name);\n+\treturn error(ERRORMSG(o, would_overwrite), ce->name);\n }\n \n static int same(struct cache_entry *a, struct cache_entry *b)\n@@ -430,7 +451,7 @@ static int verify_uptodate(struct cache_entry *ce,\n \tif (errno == ENOENT)\n \t\treturn 0;\n \treturn o->gently ? -1 :\n-\t\terror(\"Entry '%s' not uptodate. Cannot merge.\", ce->name);\n+\t\terror(ERRORMSG(o, not_uptodate_file), ce->name);\n }\n \n static void invalidate_ce_path(struct cache_entry *ce, struct unpack_trees_options *o)\n@@ -517,8 +538,7 @@ static int verify_clean_subdirectory(struct cache_entry *ce, const char *action,\n \ti = read_directory(&d, ce->name, pathbuf, namelen+1, NULL);\n \tif (i)\n \t\treturn o->gently ? -1 :\n-\t\t\terror(\"Updating '%s' would lose untracked files in it\",\n-\t\t\t      ce->name);\n+\t\t\terror(ERRORMSG(o, not_uptodate_dir), ce->name);\n \tfree(pathbuf);\n \treturn cnt;\n }\n@@ -618,8 +638,7 @@ static int verify_absent(struct cache_entry *ce, const char *action,\n \t\t}\n \n \t\treturn o->gently ? -1 :\n-\t\t\terror(\"Untracked working tree file '%s' \"\n-\t\t\t      \"would be %s by merge.\", ce->name, action);\n+\t\t\terror(ERRORMSG(o, would_lose_untracked), ce->name, action);\n \t}\n \treturn 0;\n }\n@@ -751,7 +770,7 @@ int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o)\n \t/* #14, #14ALT, #2ALT */\n \tif (remote && !df_conflict_head && head_match && !remote_match) {\n \t\tif (index && !same(index, remote) && !same(index, head))\n-\t\t\treturn o->gently ? -1 : reject_merge(index);\n+\t\t\treturn o->gently ? -1 : reject_merge(index, o);\n \t\treturn merged_entry(remote, index, o);\n \t}\n \t/*\n@@ -759,7 +778,7 @@ int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o)\n \t * make sure that it matches head.\n \t */\n \tif (index && !same(index, head))\n-\t\treturn o->gently ? -1 : reject_merge(index);\n+\t\treturn o->gently ? -1 : reject_merge(index, o);\n \n \tif (head) {\n \t\t/* #5ALT, #15 */\n@@ -901,11 +920,11 @@ int twoway_merge(struct cache_entry **src, struct unpack_trees_options *o)\n \t\telse {\n \t\t\t/* all other failures */\n \t\t\tif (oldtree)\n-\t\t\t\treturn o->gently ? -1 : reject_merge(oldtree);\n+\t\t\t\treturn o->gently ? -1 : reject_merge(oldtree, o);\n \t\t\tif (current)\n-\t\t\t\treturn o->gently ? -1 : reject_merge(current);\n+\t\t\t\treturn o->gently ? -1 : reject_merge(current, o);\n \t\t\tif (newtree)\n-\t\t\t\treturn o->gently ? -1 : reject_merge(newtree);\n+\t\t\t\treturn o->gently ? -1 : reject_merge(newtree, o);\n \t\t\treturn -1;\n \t\t}\n \t}\n@@ -931,7 +950,7 @@ int bind_merge(struct cache_entry **src,\n \t\t\t     o->merge_size);\n \tif (a && old)\n \t\treturn o->gently ? -1 :\n-\t\t\terror(\"Entry '%s' overlaps with '%s'.  Cannot bind.\", a->name, old->name);\n+\t\t\terror(ERRORMSG(o, bind_overlap), a->name, old->name);\n \tif (!a)\n \t\treturn keep_entry(old, o);\n \telse\ndiff --git a/unpack-trees.h b/unpack-trees.h\nindex d436d6c..94e5672 100644\n--- a/unpack-trees.h\n+++ b/unpack-trees.h\n@@ -8,6 +8,14 @@ struct unpack_trees_options;\n typedef int (*merge_fn_t)(struct cache_entry **src,\n \t\tstruct unpack_trees_options *options);\n \n+struct unpack_trees_error_msgs {\n+\tconst char *would_overwrite;\n+\tconst char *not_uptodate_file;\n+\tconst char *not_uptodate_dir;\n+\tconst char *would_lose_untracked;\n+\tconst char *bind_overlap;\n+};\n+\n struct unpack_trees_options {\n \tunsigned int reset:1,\n \t\t     merge:1,\n@@ -23,6 +31,7 @@ struct unpack_trees_options {\n \tint pos;\n \tstruct dir_struct *dir;\n \tmerge_fn_t fn;\n+\tstruct unpack_trees_error_msgs msgs;\n \n \tint head_idx;\n \tint merge_size;\n"},{"id":"77201","messageId":"bd6139dc0805171314i29daf0det47d9ad8f9e7d76a7@mail.gmail.com","threadId":"13367","inReplyTo":"alpine.DEB.1.00.0805171939540.30431@racer","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Sverre Rabbelier","fromEmail":"alturin@gmail.com","sentAt":"2008-05-17T20:14:45Z","receivedAt":"2008-05-17T20:14:45Z","isPatch":true,"sender":{"key":"alturin@gmail.com","avatar":null},"body":"On Sat, May 17, 2008 at 8:44 PM, Johannes Schindelin > But I strongly\ndisagree with the notion that it is okay to fsck with\n> old-timers (who would be harmed by breaking backwards-incompatibility,\n> and nobody else), especially given that it is mostly old-timers who turned\n> Git into the Good Product(tm) it is.\n\nBut those old-timers can be updated can't they? Also, shouldn't we\nhave tests to see if they 'break' because of changes?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"77203","messageId":"bd6139dc0805171329i29b518a2l7b28e7e71756adac@mail.gmail.com","threadId":"13367","inReplyTo":"7v63tcda7e.fsf_-_@gitster.siamese.dyndns.org","subject":"Re: Re* [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Sverre Rabbelier","fromEmail":"alturin@gmail.com","sentAt":"2008-05-17T20:29:04Z","receivedAt":"2008-05-17T20:29:04Z","isPatch":true,"sender":{"key":"alturin@gmail.com","avatar":null},"body":"On Sat, May 17, 2008 at 9:03 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Don't feed the troll by responding to a cheap shot.\n\nYes, a cheap shot, but I think one trying to make a point.\n\n> The plumbing output is sacred as it is an API.  We _could_ change it if it\n> is broken in such a way that it cannot convey necessary information fully,\n> but we just do not _reword_ for the sake of rewording.  If somebody does\n> not like it, s/he is complaining too late.  S/he should have been here in\n> early May 2005 and make the language used by the API closer to what humans\n> read.  S/he wasn't here.  Too bad, and it is too late.\n\nMhh.. I guess I didn't realize how strongly git still is \"many\ncommands that are good at what they do\" that together form a coherent\nentity.\n\n> If you do not see something wrong with this output, your brain has already\n> been rotten with use of git for too long a time.  Nobody asked us to\n> \"merge\" but why are we talking about \"Cannot merge\"?\n\nVery good point, perhaps we should consider double-checking them all\nand improving them for one of the next 1.x releases.\n\n> Try a different approach along this patch instead.\n>\n>    $ git-checkout pu\n>    error: You have local changes to 'Makefile'; cannot switch branches.\n>\n> There are other places that ask unpack_trees() to n-way merge, detect\n> issues _and_ let it issue error message on its own, which people who\n> complained in this thread can identify and improve, but I did this as a\n> demonstration and replaced only one message.\n\nThe patch looks like a step in the right direction, but if there is\ninterest in improving the error messaging system why not do it right\nand make it generic. Instead of each file reinventing the wheel create\na more generic system that uses a configuration file (I think this was\nsuggested earlier). If we choose something like that, perhaps it would\nbe nice to add a 'scripting' mode, which provides with a CLI-like\nmessages instead of the usual human-readable ones (and thus less easy\nto parse).\n\n<snip patch>\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"77222","messageId":"bd6139dc0805180411k4a2edee3ueef178c141744b35@mail.gmail.com","threadId":"13367","inReplyTo":"200805181032.m4IAWjE0012832@mi0.bluebottle.com","subject":"Re: [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Sverre Rabbelier","fromEmail":"alturin@gmail.com","sentAt":"2008-05-18T11:11:07Z","receivedAt":"2008-05-18T11:11:07Z","isPatch":true,"sender":{"key":"alturin@gmail.com","avatar":null},"body":"On Sun, May 18, 2008 at 12:31 PM, しらいしななこ <nanako3@bluebottle.com> wrote:\n> What advantage are you bringing to the table for them to be worth bothering to update, other than \"if they update then they can get their scripts working again after you break them by rewording messages for no good reason\"? Why do you punish the old-timers for using the well established API?\n\nMy reason was that (perhaps not as much in this case, but I meant to\nspeak in general) the message is confusing/not clear enough.\n\n> Did you study Junio's patch before you responded to his message? The point of the suggestion was that he reworded the message given by git-checkout that is a porcelain command without breaking output from read-tree that is a plumbing command. In other words, you can improve output from porcelain commands without making unnecessary changes to plumbing.\n\nI hadn't read his e-mail when I was replying, my Internet has been\nplaying up lately (same for about half of the Netherlands due to a\nproblem at one of our biggest ISPs). I did reply to it though:\nhttp://thread.gmane.org/gmane.comp.version-control.git/81100\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"77258","messageId":"D925ECD3-1EE2-48EB-B1E5-2604C10AD643@wincent.com","threadId":"13367","inReplyTo":"7v63tcda7e.fsf_-_@gitster.siamese.dyndns.org","subject":"Re: Re* [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-05-19T06:55:43Z","receivedAt":"2008-05-19T06:55:43Z","isPatch":true,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 17/5/2008, a las 21:03, Junio C Hamano escribió:\n> +\t/* not_uptodate_file */\n> +\t\"Entry '%s' not uptodate. Cannot merge.\",\n\n\nMinor nit, \"uptodate\" is not a word. Should be either \"up-to-date\" or  \n\"up to date\"; most dictionaries list both.\n\nCheers,\nWincent\n"},{"id":"77278","messageId":"7vzlqm89tj.fsf@gitster.siamese.dyndns.org","threadId":"13367","inReplyTo":"D925ECD3-1EE2-48EB-B1E5-2604C10AD643@wincent.com","subject":"Re: Re* [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-19T17:47:52Z","receivedAt":"2008-05-19T17:47:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Wincent Colaiuta <win@wincent.com> writes:\n\n> El 17/5/2008, a las 21:03, Junio C Hamano escribió:\n>> +\t/* not_uptodate_file */\n>> +\t\"Entry '%s' not uptodate. Cannot merge.\",\n>\n>\n> Minor nit, \"uptodate\" is not a word. Should be either \"up-to-date\" or\n> \"up to date\"; most dictionaries list both.\n\nWhy does *everybody* keep missing the whole point of this patch?\n\nGrumble.\n"},{"id":"77281","messageId":"bd6139dc0805191128t13afc8ard051138083e2b694@mail.gmail.com","threadId":"13367","inReplyTo":"7vzlqm89tj.fsf@gitster.siamese.dyndns.org","subject":"Re: Re* [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Sverre Rabbelier","fromEmail":"alturin@gmail.com","sentAt":"2008-05-19T18:28:26Z","receivedAt":"2008-05-19T18:28:26Z","isPatch":true,"sender":{"key":"alturin@gmail.com","avatar":null},"body":"On Mon, May 19, 2008 at 7:47 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Why does *everybody* keep missing the whole point of this patch?\n\nIsn't it to make it possible to change the error messages at porcelain\nlevel while allowing the plumbing to remain backward compatibility?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"77283","messageId":"alpine.LNX.1.00.0805191523060.19665@iabervon.org","threadId":"13367","inReplyTo":"7vzlqm89tj.fsf@gitster.siamese.dyndns.org","subject":"Re: Re* [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-05-19T19:32:14Z","receivedAt":"2008-05-19T19:32:14Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Mon, 19 May 2008, Junio C Hamano wrote:\n\n> Wincent Colaiuta <win@wincent.com> writes:\n> \n> > El 17/5/2008, a las 21:03, Junio C Hamano escribió:\n> >> +\t/* not_uptodate_file */\n> >> +\t\"Entry '%s' not uptodate. Cannot merge.\",\n> >\n> >\n> > Minor nit, \"uptodate\" is not a word. Should be either \"up-to-date\" or\n> > \"up to date\"; most dictionaries list both.\n> \n> Why does *everybody* keep missing the whole point of this patch?\n\nThat section needs a comment stating that it's the scripting API, not just \nan arbitrary set of messages. For that matter, maybe those shouldn't be \nthe default set, but an alternate set used (as a group) by plumbing \nprograms; I don't think it's too likely that there will be a whole lot of \nnew plumbing programs, and new porcelain programs that don't specify \nanything probably ought to get something more generic.\n\n\t-Daniel\n*This .sig left intentionally blank*"},{"id":"77373","messageId":"7v4p8s6spa.fsf@gitster.siamese.dyndns.org","threadId":"13367","inReplyTo":"alpine.LNX.1.00.0805191523060.19665@iabervon.org","subject":"Re: Re* [PATCH] \"not uptodate\" changed to \"has local changes\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-21T07:07:29Z","receivedAt":"2008-05-21T07:07:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> writes:\n\n> On Mon, 19 May 2008, Junio C Hamano wrote:\n>\n>> Why does *everybody* keep missing the whole point of this patch?\n>\n> That section needs a comment stating that it's the scripting API, not just \n> an arbitrary set of messages.\n\nYeah, that is a very good explanation.  Thanks for a constructive\nsuggestion for improvements.\n\nHere is an incremental on top of the one I sent out, in case people want\nto improve on it.\n\n unpack-trees.c |   12 ++++++++++--\n 1 files changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex da3bdc8..0de5a31 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -8,7 +8,15 @@\n #include \"progress.h\"\n #include \"refs.h\"\n \n-static struct unpack_trees_error_msgs unpack_default_errors = {\n+/*\n+ * Error messages expected by scripts out of plumbing commands such as\n+ * read-tree.  Non-scripted Porcelain is not required to use these messages\n+ * and in fact are encouraged to reword them to better suit their particular\n+ * situation better.  See how \"git checkout\" replaces not_uptodate_file to\n+ * explain why it does not allow switching between branches when you have\n+ * local changes, for example.\n+ */\n+static struct unpack_trees_error_msgs unpack_plumbing_errors = {\n \t/* would_overwrite */\n \t\"Entry '%s' would be overwritten by merge. Cannot merge.\",\n \n@@ -28,7 +36,7 @@ static struct unpack_trees_error_msgs unpack_default_errors = {\n #define ERRORMSG(o,fld) \\\n \t( ((o) && (o)->msgs.fld) \\\n \t? ((o)->msgs.fld) \\\n-\t: (unpack_default_errors.fld) )\n+\t: (unpack_plumbing_errors.fld) )\n \n static void add_entry(struct unpack_trees_options *o, struct cache_entry *ce,\n \tunsigned int set, unsigned int clear)\n"}]}