{"thread":{"id":"2903","subject":"[PATCH] Add suggestion to hard-to-understand error message","startedAt":"2005-12-21T23:49:02Z","lastAt":"2005-12-23T12:13:46Z","messageCount":7,"participants":["Johannes Schindelin","Junio C Hamano","Andreas Ericsson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"13909","messageId":"Pine.LNX.4.63.0512220048360.13453@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2903","inReplyTo":null,"subject":"[PATCH] Add suggestion to hard-to-understand error message","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-12-21T23:49:02Z","receivedAt":"2005-12-21T23:49:02Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nDummies like me do not understand readily that \"remote object abcdef...\ndoes not exist on local\" means: \"Hey, you did not pull this, did you?\".\nSo, add \"(pull first?)\" to that message.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n\tWow, my commit messages get longer, while the patches get shorter.\n\tOdd.\n\n send-pack.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\naf2d86726fe961043d0c69c4fb727689a5903b63\ndiff --git a/send-pack.c b/send-pack.c\nindex 5bc2f01..643662a 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -233,7 +233,7 @@ static int send_pack(int in, int out, in\n \t\t    !ref->force) {\n \t\t\tif (!has_sha1_file(ref->old_sha1)) {\n \t\t\t\terror(\"remote '%s' object %s does not \"\n-\t\t\t\t      \"exist on local\",\n+\t\t\t\t      \"exist on local (pull first?)\",\n \t\t\t\t      ref->name, sha1_to_hex(ref->old_sha1));\n \t\t\t\tret = -2;\n \t\t\t\tcontinue;\n-- \n0.99.9.GIT\n"},{"id":"13915","messageId":"7vd5jqvsn1.fsf@assigned-by-dhcp.cox.net","threadId":"2903","inReplyTo":"Pine.LNX.4.63.0512220048360.13453@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Add suggestion to hard-to-understand error message","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-22T01:15:46Z","receivedAt":"2005-12-22T01:15:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Dummies like me do not understand readily that \"remote object abcdef...\n> does not exist on local\" means: \"Hey, you did not pull this, did you?\".\n> So, add \"(pull first?)\" to that message.\n\nI am ambivalent about this one.  It is a special case of \"remote\nis not a strict subset of local\" situation, so we might be\nbetter if we just said the same as the other error message and\nbe done with it.  On the other hand, the code does know the\ndifference of the two situations at this point, and it could be\nargued that giving the same error is losing information.\n\nEarlier I once rewound the \"master\" branch head by one commit\ntoo much by mistake.  The next push to the public server would\nhave given me a different error message, depending on whether I\npruned my private repository or not in between.  For example,\nafter this sequence:\n\n    $ git commit -m 'initial'\n    $ git commit -m 'next'\n    $ git push remote master\n    $ git reset --hard HEAD^\n    $ git commit -m 'third but second'\n\nIf you do not prune at this point, then the remote commit \"next\"\nstill exists in the local repository (but not reachable).  Then\n\n    $ git push remote master\n\nwould not say \"pull first?\".  But if you prune local repository\nbefore pushing, it would now say \"pull first?\".\n\nIn a sense, both are \"pull first?\" situation, and it probably is\nmore confusing to give different messages to the user in these\ntwo cases.  From the end-user point of view they are the same\n\"remote is not strict subset.\".\n"},{"id":"13927","messageId":"43AA79EB.6040800@op5.se","threadId":"2903","inReplyTo":"7vd5jqvsn1.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Add suggestion to hard-to-understand error message","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2005-12-22T10:03:23Z","receivedAt":"2005-12-22T10:03:23Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> In a sense, both are \"pull first?\" situation, and it probably is\n> more confusing to give different messages to the user in these\n> two cases.  From the end-user point of view they are the same\n> \"remote is not strict subset.\".\n> \n\nIn non-git'ish, does this mean \"you're not up to date, so pull before \npushing\" ? If so, why not say so? I'm sure it could prevent a fair few \nproblems for users (not least those new to scm's).\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"13952","messageId":"7vek45lyor.fsf@assigned-by-dhcp.cox.net","threadId":"2903","inReplyTo":"43AA79EB.6040800@op5.se","subject":"Re: [PATCH] Add suggestion to hard-to-understand error message","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-22T19:27:32Z","receivedAt":"2005-12-22T19:27:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Ericsson <ae@op5.se> writes:\n\n> Junio C Hamano wrote:\n>> In a sense, both are \"pull first?\" situation, and it probably is\n>> more confusing to give different messages to the user in these\n>> two cases.  From the end-user point of view they are the same\n>> \"remote is not strict subset.\".\n>\n> In non-git'ish, does this mean \"you're not up to date, so pull before \n> pushing\" ? If so, why not say so? I'm sure it could prevent a fair few \n> problems for users (not least those new to scm's).\n\nPerhaps.  I was suggesting to say that in *both* places, not\njust one.\n"},{"id":"13957","messageId":"7vu0d0j24z.fsf_-_@assigned-by-dhcp.cox.net","threadId":"2903","inReplyTo":"7vek45lyor.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] send-pack: reword non-fast-forward error message.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-22T20:41:16Z","receivedAt":"2005-12-22T20:41:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Andreas Ericsson <ae@op5.se> writes:\n>\n>> Junio C Hamano wrote:\n>>> In a sense, both are \"pull first?\" situation, and it probably is\n>>> more confusing to give different messages to the user in these\n>>> two cases.  From the end-user point of view they are the same\n>>> \"remote is not strict subset.\".\n>>\n>> In non-git'ish, does this mean \"you're not up to date, so pull before \n>> pushing\" ? If so, why not say so? I'm sure it could prevent a fair few \n>> problems for users (not least those new to scm's).\n\nThat is reasonable.  How about this?\n\n-- >8 --\nWnen refusing to push a head, we said cryptic \"remote 'branch'\nobject X does not exist on local\" or \"remote ref 'branch' is not\na strict subset of local ref 'branch'\".  That was gittish.\n\nSince the most likely reason this happens is because the pushed\nhead was not up-to-date, clarify the error message to say that\nstraight, and suggest pulling first.\n\nFirst noticed by Johannes and seconded by Andreas.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n send-pack.c |   30 ++++++++++++++----------------\n 1 files changed, 14 insertions(+), 16 deletions(-)\n\n69310a34cb6dcca32b08cf3ea9e91ab19354a874\ndiff --git a/send-pack.c b/send-pack.c\nindex 5bc2f01..0d41f9a 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -231,23 +231,21 @@ static int send_pack(int in, int out, in\n \t\tif (!force_update &&\n \t\t    !is_zero_sha1(ref->old_sha1) &&\n \t\t    !ref->force) {\n-\t\t\tif (!has_sha1_file(ref->old_sha1)) {\n-\t\t\t\terror(\"remote '%s' object %s does not \"\n-\t\t\t\t      \"exist on local\",\n-\t\t\t\t      ref->name, sha1_to_hex(ref->old_sha1));\n-\t\t\t\tret = -2;\n-\t\t\t\tcontinue;\n-\t\t\t}\n-\n-\t\t\t/* We assume that local is fsck-clean.  Otherwise\n-\t\t\t * you _could_ have an old tag which points at\n-\t\t\t * something you do not have, which may or may not\n-\t\t\t * be a commit.\n-\t\t\t */\n-\t\t\tif (!ref_newer(ref->peer_ref->new_sha1,\n+\t\t\tif (!has_sha1_file(ref->old_sha1) ||\n+\t\t\t    !ref_newer(ref->peer_ref->new_sha1,\n \t\t\t\t       ref->old_sha1)) {\n-\t\t\t\terror(\"remote ref '%s' is not a strict \"\n-\t\t\t\t      \"subset of local ref '%s'.\", ref->name,\n+\t\t\t\t/* We do not have the remote ref, or\n+\t\t\t\t * we know that the remote ref is not\n+\t\t\t\t * an ancestor of what we are trying to\n+\t\t\t\t * push.  Either way this can be losing\n+\t\t\t\t * commits at the remote end and likely\n+\t\t\t\t * we were not up to date to begin with.\n+\t\t\t\t */\n+\t\t\t\terror(\"remote '%s' is not a strict \"\n+\t\t\t\t      \"subset of local ref '%s'. \"\n+\t\t\t\t      \"maybe you are not up-to-date and \"\n+\t\t\t\t      \"need to pull first?\",\n+\t\t\t\t      ref->name,\n \t\t\t\t      ref->peer_ref->name);\n \t\t\t\tret = -2;\n \t\t\t\tcontinue;\n-- \n1.0.GIT\n"},{"id":"13959","messageId":"Pine.LNX.4.63.0512222152550.5677@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2903","inReplyTo":"7vu0d0j24z.fsf_-_@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] send-pack: reword non-fast-forward error message.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-12-22T20:53:35Z","receivedAt":"2005-12-22T20:53:35Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 22 Dec 2005, Junio C Hamano wrote:\n\n> That is reasonable.  How about this?\n\nI like it.\n\nCiao,\nDscho\n"},{"id":"13981","messageId":"43ABE9FA.4010604@op5.se","threadId":"2903","inReplyTo":"7vu0d0j24z.fsf_-_@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] send-pack: reword non-fast-forward error message.","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2005-12-23T12:13:46Z","receivedAt":"2005-12-23T12:13:46Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Junio C Hamano <junkio@cox.net> writes:\n> \n> \n>>Andreas Ericsson <ae@op5.se> writes:\n>>\n>>\n>>>Junio C Hamano wrote:\n>>>\n>>>>In a sense, both are \"pull first?\" situation, and it probably is\n>>>>more confusing to give different messages to the user in these\n>>>>two cases.  From the end-user point of view they are the same\n>>>>\"remote is not strict subset.\".\n>>>\n>>>In non-git'ish, does this mean \"you're not up to date, so pull before \n>>>pushing\" ? If so, why not say so? I'm sure it could prevent a fair few \n>>>problems for users (not least those new to scm's).\n> \n> \n> That is reasonable.  How about this?\n> \n\nMe likes.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"}]}