* [PATCH] Add suggestion to hard-to-understand error message
@ 2005-12-21 23:49 Johannes Schindelin
2005-12-22 1:15 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2005-12-21 23:49 UTC (permalink / raw)
To: git, junkio
Dummies like me do not understand readily that "remote object abcdef...
does not exist on local" means: "Hey, you did not pull this, did you?".
So, add "(pull first?)" to that message.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
Wow, my commit messages get longer, while the patches get shorter.
Odd.
send-pack.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
af2d86726fe961043d0c69c4fb727689a5903b63
diff --git a/send-pack.c b/send-pack.c
index 5bc2f01..643662a 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -233,7 +233,7 @@ static int send_pack(int in, int out, in
!ref->force) {
if (!has_sha1_file(ref->old_sha1)) {
error("remote '%s' object %s does not "
- "exist on local",
+ "exist on local (pull first?)",
ref->name, sha1_to_hex(ref->old_sha1));
ret = -2;
continue;
--
0.99.9.GIT
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Add suggestion to hard-to-understand error message
2005-12-21 23:49 [PATCH] Add suggestion to hard-to-understand error message Johannes Schindelin
@ 2005-12-22 1:15 ` Junio C Hamano
2005-12-22 10:03 ` Andreas Ericsson
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2005-12-22 1:15 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Dummies like me do not understand readily that "remote object abcdef...
> does not exist on local" means: "Hey, you did not pull this, did you?".
> So, add "(pull first?)" to that message.
I am ambivalent about this one. It is a special case of "remote
is not a strict subset of local" situation, so we might be
better if we just said the same as the other error message and
be done with it. On the other hand, the code does know the
difference of the two situations at this point, and it could be
argued that giving the same error is losing information.
Earlier I once rewound the "master" branch head by one commit
too much by mistake. The next push to the public server would
have given me a different error message, depending on whether I
pruned my private repository or not in between. For example,
after this sequence:
$ git commit -m 'initial'
$ git commit -m 'next'
$ git push remote master
$ git reset --hard HEAD^
$ git commit -m 'third but second'
If you do not prune at this point, then the remote commit "next"
still exists in the local repository (but not reachable). Then
$ git push remote master
would not say "pull first?". But if you prune local repository
before pushing, it would now say "pull first?".
In a sense, both are "pull first?" situation, and it probably is
more confusing to give different messages to the user in these
two cases. From the end-user point of view they are the same
"remote is not strict subset.".
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add suggestion to hard-to-understand error message
2005-12-22 1:15 ` Junio C Hamano
@ 2005-12-22 10:03 ` Andreas Ericsson
2005-12-22 19:27 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Ericsson @ 2005-12-22 10:03 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, git
Junio C Hamano wrote:
> In a sense, both are "pull first?" situation, and it probably is
> more confusing to give different messages to the user in these
> two cases. From the end-user point of view they are the same
> "remote is not strict subset.".
>
In non-git'ish, does this mean "you're not up to date, so pull before
pushing" ? If so, why not say so? I'm sure it could prevent a fair few
problems for users (not least those new to scm's).
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add suggestion to hard-to-understand error message
2005-12-22 10:03 ` Andreas Ericsson
@ 2005-12-22 19:27 ` Junio C Hamano
2005-12-22 20:41 ` [PATCH] send-pack: reword non-fast-forward " Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2005-12-22 19:27 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: git
Andreas Ericsson <ae@op5.se> writes:
> Junio C Hamano wrote:
>> In a sense, both are "pull first?" situation, and it probably is
>> more confusing to give different messages to the user in these
>> two cases. From the end-user point of view they are the same
>> "remote is not strict subset.".
>
> In non-git'ish, does this mean "you're not up to date, so pull before
> pushing" ? If so, why not say so? I'm sure it could prevent a fair few
> problems for users (not least those new to scm's).
Perhaps. I was suggesting to say that in *both* places, not
just one.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] send-pack: reword non-fast-forward error message.
2005-12-22 19:27 ` Junio C Hamano
@ 2005-12-22 20:41 ` Junio C Hamano
2005-12-22 20:53 ` Johannes Schindelin
2005-12-23 12:13 ` Andreas Ericsson
0 siblings, 2 replies; 7+ messages in thread
From: Junio C Hamano @ 2005-12-22 20:41 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: git, Johannes Schindelin
Junio C Hamano <junkio@cox.net> writes:
> Andreas Ericsson <ae@op5.se> writes:
>
>> Junio C Hamano wrote:
>>> In a sense, both are "pull first?" situation, and it probably is
>>> more confusing to give different messages to the user in these
>>> two cases. From the end-user point of view they are the same
>>> "remote is not strict subset.".
>>
>> In non-git'ish, does this mean "you're not up to date, so pull before
>> pushing" ? If so, why not say so? I'm sure it could prevent a fair few
>> problems for users (not least those new to scm's).
That is reasonable. How about this?
-- >8 --
Wnen refusing to push a head, we said cryptic "remote 'branch'
object X does not exist on local" or "remote ref 'branch' is not
a strict subset of local ref 'branch'". That was gittish.
Since the most likely reason this happens is because the pushed
head was not up-to-date, clarify the error message to say that
straight, and suggest pulling first.
First noticed by Johannes and seconded by Andreas.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
send-pack.c | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
69310a34cb6dcca32b08cf3ea9e91ab19354a874
diff --git a/send-pack.c b/send-pack.c
index 5bc2f01..0d41f9a 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -231,23 +231,21 @@ static int send_pack(int in, int out, in
if (!force_update &&
!is_zero_sha1(ref->old_sha1) &&
!ref->force) {
- if (!has_sha1_file(ref->old_sha1)) {
- error("remote '%s' object %s does not "
- "exist on local",
- ref->name, sha1_to_hex(ref->old_sha1));
- ret = -2;
- continue;
- }
-
- /* We assume that local is fsck-clean. Otherwise
- * you _could_ have an old tag which points at
- * something you do not have, which may or may not
- * be a commit.
- */
- if (!ref_newer(ref->peer_ref->new_sha1,
+ if (!has_sha1_file(ref->old_sha1) ||
+ !ref_newer(ref->peer_ref->new_sha1,
ref->old_sha1)) {
- error("remote ref '%s' is not a strict "
- "subset of local ref '%s'.", ref->name,
+ /* We do not have the remote ref, or
+ * we know that the remote ref is not
+ * an ancestor of what we are trying to
+ * push. Either way this can be losing
+ * commits at the remote end and likely
+ * we were not up to date to begin with.
+ */
+ error("remote '%s' is not a strict "
+ "subset of local ref '%s'. "
+ "maybe you are not up-to-date and "
+ "need to pull first?",
+ ref->name,
ref->peer_ref->name);
ret = -2;
continue;
--
1.0.GIT
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] send-pack: reword non-fast-forward error message.
2005-12-22 20:41 ` [PATCH] send-pack: reword non-fast-forward " Junio C Hamano
@ 2005-12-22 20:53 ` Johannes Schindelin
2005-12-23 12:13 ` Andreas Ericsson
1 sibling, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2005-12-22 20:53 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Andreas Ericsson, git
Hi,
On Thu, 22 Dec 2005, Junio C Hamano wrote:
> That is reasonable. How about this?
I like it.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] send-pack: reword non-fast-forward error message.
2005-12-22 20:41 ` [PATCH] send-pack: reword non-fast-forward " Junio C Hamano
2005-12-22 20:53 ` Johannes Schindelin
@ 2005-12-23 12:13 ` Andreas Ericsson
1 sibling, 0 replies; 7+ messages in thread
From: Andreas Ericsson @ 2005-12-23 12:13 UTC (permalink / raw)
To: git
Junio C Hamano wrote:
> Junio C Hamano <junkio@cox.net> writes:
>
>
>>Andreas Ericsson <ae@op5.se> writes:
>>
>>
>>>Junio C Hamano wrote:
>>>
>>>>In a sense, both are "pull first?" situation, and it probably is
>>>>more confusing to give different messages to the user in these
>>>>two cases. From the end-user point of view they are the same
>>>>"remote is not strict subset.".
>>>
>>>In non-git'ish, does this mean "you're not up to date, so pull before
>>>pushing" ? If so, why not say so? I'm sure it could prevent a fair few
>>>problems for users (not least those new to scm's).
>
>
> That is reasonable. How about this?
>
Me likes.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-12-23 12:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-21 23:49 [PATCH] Add suggestion to hard-to-understand error message Johannes Schindelin
2005-12-22 1:15 ` Junio C Hamano
2005-12-22 10:03 ` Andreas Ericsson
2005-12-22 19:27 ` Junio C Hamano
2005-12-22 20:41 ` [PATCH] send-pack: reword non-fast-forward " Junio C Hamano
2005-12-22 20:53 ` Johannes Schindelin
2005-12-23 12:13 ` Andreas Ericsson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).