threads / patch / 10604

patcherrors: "strict subset" -> "ancestor"

Subject: [PATCH] errors: "strict subset" -> "ancestor"

## tl;dr

10 messages between Nov 3, 2007 and Nov 5, 2007. Diffs are folded; open one to read it.

replies: 9people: 5as markdown or json

J. Bruce Fields· Nov 3, 2007, 02:39 UTC · lore
From: J. Bruce Fields <bfields@citi.umich.edu>

The term "ancestor" is a bit more intuitive (and more consistent with the documentation) than the term "strict subset".

Also, remove superfluous "ref", capitalize, and add some carriage returns, changing:

	error: remote 'refs/heads/master' is not a strict subset of local ref 'refs/heads/master'. maybe you are not up-to-date and need to pull first?
	error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/git.git'
to:
	error: remote 'refs/heads/master' is not an ancestor of
	 local 'refs/heads/master'.
	 Maybe you are not up-to-date and need to pull first?
	error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/git.git'
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
---
 builtin-branch.c |    2 +-
 http-push.c      |    8 ++++----
 send-pack.c      |    6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)
Show changes to 3 files +8 −8

builtin-branch.c, http-push.c, send-pack.c

diff --git a/builtin-branch.c b/builtin-branch.c
index 3da8b55..e8de27e 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -142,7 +142,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
 
 		if (!force &&
 		    !in_merge_bases(rev, &head_rev, 1)) {
-			error("The branch '%s' is not a strict subset of "
+			error("The branch '%s' is not an ancestor of "
 				"your current HEAD.\n"
 				"If you are sure you want to delete it, "
 				"run 'git branch -D %s'.", argv[i], argv[i]);
diff --git a/http-push.c b/http-push.c
index c02a3af..5960d7c 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2241,7 +2241,7 @@ static int delete_remote_branch(char *pattern, int force)
 
 		/* Remote branch must be an ancestor of remote HEAD */
 		if (!verify_merge_base(head_sha1, remote_ref->old_sha1)) {
-			return error("The branch '%s' is not a strict subset of your current HEAD.\nIf you are sure you want to delete it, run:\n\t'git http-push -D %s %s'", remote_ref->name, remote->url, pattern);
+			return error("The branch '%s' is not an ancestor of your current HEAD.\nIf you are sure you want to delete it, run:\n\t'git http-push -D %s %s'", remote_ref->name, remote->url, pattern);
 		}
 	}
 
@@ -2424,9 +2424,9 @@ int main(int argc, char **argv)
 				 * 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 "
+				error("remote '%s' is not an ancestor of\n"
+				      " local '%s'.\n"
+				      " Maybe you are not up-to-date and "
 				      "need to pull first?",
 				      ref->name,
 				      ref->peer_ref->name);
diff --git a/send-pack.c b/send-pack.c
index 5e127a1..b74fd45 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -297,9 +297,9 @@ static int send_pack(int in, int out, struct remote *remote, int nr_refspec, cha
 				 * 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 "
+				error("remote '%s' is not an ancestor of\n"
+				      " local  '%s'.\n"
+				      " Maybe you are not up-to-date and "
 				      "need to pull first?",
 				      ref->name,
 				      ref->peer_ref->name);
-- 
1.5.3.5.475.g477d-dirty
Steffen Prohaska· Nov 3, 2007, 07:08 UTC · re: J. Bruce Fields · lore

Re: [PATCH] errors: "strict subset" -> "ancestor"

On Nov 3, 2007, at 3:39 AM, J. Bruce Fields wrote:
Show 14 quoted lines
> diff --git a/send-pack.c b/send-pack.c
> index 5e127a1..b74fd45 100644
> --- a/send-pack.c
> +++ b/send-pack.c
> @@ -297,9 +297,9 @@ static int send_pack(int in, int out, struct  
> remote *remote, int nr_refspec, cha
>  				 * 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 "
> +				error("remote '%s' is not an ancestor of\n"
> +				      " local  '%s'.\n"
Two spaces in a row after local and before '%s'.
	Steffen
David Symonds· Nov 3, 2007, 07:14 UTC · re: Steffen Prohaska · lore

Re: [PATCH] errors: "strict subset" -> "ancestor"

On 11/3/07, Steffen Prohaska <prohaska@zib.de> wrote:
Show 19 quoted lines
>
> On Nov 3, 2007, at 3:39 AM, J. Bruce Fields wrote:
>
> > diff --git a/send-pack.c b/send-pack.c
> > index 5e127a1..b74fd45 100644
> > --- a/send-pack.c
> > +++ b/send-pack.c
> > @@ -297,9 +297,9 @@ static int send_pack(int in, int out, struct
> > remote *remote, int nr_refspec, cha
> >                                * 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 "
> > +                             error("remote '%s' is not an ancestor of\n"
> > +                                   " local  '%s'.\n"
>
> Two spaces in a row after local and before '%s'.
So? That's presumably to align the remote and local strings.
Dave.
Steffen Prohaska· Nov 3, 2007, 07:24 UTC · re: David Symonds · lore

Re: [PATCH] errors: "strict subset" -> "ancestor"

On Nov 3, 2007, at 8:14 AM, David Symonds wrote:
Show 26 quoted lines
> On 11/3/07, Steffen Prohaska <prohaska@zib.de> wrote:
>>
>> On Nov 3, 2007, at 3:39 AM, J. Bruce Fields wrote:
>>
>>> diff --git a/send-pack.c b/send-pack.c
>>> index 5e127a1..b74fd45 100644
>>> --- a/send-pack.c
>>> +++ b/send-pack.c
>>> @@ -297,9 +297,9 @@ static int send_pack(int in, int out, struct
>>> remote *remote, int nr_refspec, cha
>>>                                * 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 "
>>> +                             error("remote '%s' is not an  
>>> ancestor of\n"
>>> +                                   " local  '%s'.\n"
>>
>> Two spaces in a row after local and before '%s'.
>
> So? That's presumably to align the remote and local strings.

They are not aligned. The second line is indented with one space. Look at examples in the commit message. The first line starts with "error:", which already destroys the alignment.

	Steffen
J. Bruce Fields· Nov 4, 2007, 21:59 UTC · re: Steffen Prohaska · lore
From: J. Bruce Fields <bfields@citi.umich.edu>

The term "ancestor" is a bit more intuitive (and more consistent with the documentation) than the term "strict subset".

Also, remove superfluous "ref", and capitalize, changing:
	error: remote 'refs/heads/master' is not a strict subset of local ref 'refs/heads/master'. maybe you are not up-to-date and need to pull first?
	error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/git.git'
to:
	error: remote 'refs/heads/master' is not an ancestor of
	 local 'refs/heads/master'.
	 Maybe you are not up-to-date and need to pull first?
	error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/git.git'
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
---
 builtin-branch.c |    2 +-
 http-push.c      |    8 ++++----
 send-pack.c      |    6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)
On Sat, Nov 03, 2007 at 08:24:29AM +0100, Steffen Prohaska wrote:
> They are not aligned. The second line is indented with one
> space. Look at examples in the commit message. The first line
> starts with "error:", which already destroys the alignment.

Yup, I think that's exactly what happened--I said "hey, maybe I should try aligning this and see what it looks like?", then saw the problem, then forgot to revert the extra space from everywhere.... Thanks for noticing. Here's an updated patch.--b.

Show changes to 3 files +8 −8

builtin-branch.c, http-push.c, send-pack.c

diff --git a/builtin-branch.c b/builtin-branch.c
index 3da8b55..e8de27e 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -142,7 +142,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
 
 		if (!force &&
 		    !in_merge_bases(rev, &head_rev, 1)) {
-			error("The branch '%s' is not a strict subset of "
+			error("The branch '%s' is not an ancestor of "
 				"your current HEAD.\n"
 				"If you are sure you want to delete it, "
 				"run 'git branch -D %s'.", argv[i], argv[i]);
diff --git a/http-push.c b/http-push.c
index c02a3af..5960d7c 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2241,7 +2241,7 @@ static int delete_remote_branch(char *pattern, int force)
 
 		/* Remote branch must be an ancestor of remote HEAD */
 		if (!verify_merge_base(head_sha1, remote_ref->old_sha1)) {
-			return error("The branch '%s' is not a strict subset of your current HEAD.\nIf you are sure you want to delete it, run:\n\t'git http-push -D %s %s'", remote_ref->name, remote->url, pattern);
+			return error("The branch '%s' is not an ancestor of your current HEAD.\nIf you are sure you want to delete it, run:\n\t'git http-push -D %s %s'", remote_ref->name, remote->url, pattern);
 		}
 	}
 
@@ -2424,9 +2424,9 @@ int main(int argc, char **argv)
 				 * 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 "
+				error("remote '%s' is not an ancestor of\n"
+				      " local '%s'.\n"
+				      " Maybe you are not up-to-date and "
 				      "need to pull first?",
 				      ref->name,
 				      ref->peer_ref->name);
diff --git a/send-pack.c b/send-pack.c
index 5e127a1..fbf2462 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -297,9 +297,9 @@ static int send_pack(int in, int out, struct remote *remote, int nr_refspec, cha
 				 * 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 "
+				error("remote '%s' is not an ancestor of\n"
+				      " local '%s'.\n"
+				      " Maybe you are not up-to-date and "
 				      "need to pull first?",
 				      ref->name,
 				      ref->peer_ref->name);
-- 
1.5.3.5.475.g477d-dirty
Wincent Colaiuta· Nov 5, 2007, 13:06 UTC · re: David Symonds · lore

Re: [PATCH] errors: "strict subset" -> "ancestor"

El 3/11/2007, a las 8:14, David Symonds escribió:
Show 25 quoted lines
> On 11/3/07, Steffen Prohaska <prohaska@zib.de> wrote:
>>
>> On Nov 3, 2007, at 3:39 AM, J. Bruce Fields wrote:
>>
>>> diff --git a/send-pack.c b/send-pack.c
>>> index 5e127a1..b74fd45 100644
>>> --- a/send-pack.c
>>> +++ b/send-pack.c
>>> @@ -297,9 +297,9 @@ static int send_pack(int in, int out, struct
>>> remote *remote, int nr_refspec, cha
>>>                               * 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 "
>>> +                             error("remote '%s' is not an  
>>> ancestor of\n"
>>> +                                   " local  '%s'.\n"
>>
>> Two spaces in a row after local and before '%s'.
>
> So? That's presumably to align the remote and local strings.
Kind of: it aligns "error:" with "local":
	error: remote 'refs/heads/master' is not an ancestor of
	 local 'refs/heads/master'.

Personal I think it would be better to align the right edges of "remote" and "local" so that it looks like the following; this more clearly shows the correspondence between the remote and local refs:

	error: remote 'refs/heads/master' is not an ancestor of
	        local 'refs/heads/master'.
Or alternatively:
	error: remote 'refs/heads/master' is not an ancestor of
	       local  'refs/heads/master'.

Cheers, Wincent

Jeff King· Nov 5, 2007, 21:28 UTC · re: Wincent Colaiuta · lore

Re: [PATCH] errors: "strict subset" -> "ancestor"

On Mon, Nov 05, 2007 at 02:06:35PM +0100, Wincent Colaiuta wrote:
> Kind of: it aligns "error:" with "local":
>
> 	error: remote 'refs/heads/master' is not an ancestor of
> 	 local 'refs/heads/master'.

FYI, in the thread 'more terse push output', there is discussion of eliminating this message entirely. So I wanted to point readers of this thread in that direction.

-Peff
Steffen Prohaska· Nov 3, 2007, 07:51 UTC · re: J. Bruce Fields · lore

Re: [PATCH] errors: "strict subset" -> "ancestor"

On Nov 3, 2007, at 3:39 AM, J. Bruce Fields wrote:
Show 21 quoted lines
> From: J. Bruce Fields <bfields@citi.umich.edu>
>
> The term "ancestor" is a bit more intuitive (and more consistent with
> the documentation) than the term "strict subset".
>
> Also, remove superfluous "ref", capitalize, and add some carriage
> returns, changing:
>
> 	error: remote 'refs/heads/master' is not a strict subset of local  
> ref 'refs/heads/master'. maybe you are not up-to-date and need to  
> pull first?
> 	error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/ 
> git.git'
>
> to:
>
> 	error: remote 'refs/heads/master' is not an ancestor of
> 	 local 'refs/heads/master'.
> 	 Maybe you are not up-to-date and need to pull first?
> 	error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/ 
> git.git'

Junio suggested in [1] (see also earlier messages in that thread) to replace the recommendation to pull with a hint where to look in the user manual.

[1] http://marc.info/?l=git&m=119398999317677&w=2

The point is, there are various ways to resolve the problem. pull is not necessarily the right solution. At least, you should consider to rebase. Or maybe just something else went wrong.

Nonetheless I think it could be a good idea to keep the most likely cases. So, how about

"Are you up-to-date? Did you forget to pull or rebase? See User's Manual for details."

I put it as questions to avoid making a suggestion. The questions should give sufficient hints for searching in the User's Manual. I haven't found the single section that would explain exactly the situation we're dealing with.

I attached the commit that originally introduced the suggestion.
	Steffen
commit 69310a34cb6dcca32b08cf3ea9e91ab19354a874
Author: Junio C Hamano <junkio@cox.net>
Date:   Thu Dec 22 12:39:39 2005 -0800
     send-pack: reword non-fast-forward error message.
     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>
J. Bruce Fields· Nov 4, 2007, 22:08 UTC · re: Steffen Prohaska · lore

Re: [PATCH] errors: "strict subset" -> "ancestor"

On Sat, Nov 03, 2007 at 08:51:29AM +0100, Steffen Prohaska wrote:
Show 33 quoted lines
>
> On Nov 3, 2007, at 3:39 AM, J. Bruce Fields wrote:
>
>> From: J. Bruce Fields <bfields@citi.umich.edu>
>>
>> The term "ancestor" is a bit more intuitive (and more consistent with
>> the documentation) than the term "strict subset".
>>
>> Also, remove superfluous "ref", capitalize, and add some carriage
>> returns, changing:
>>
>> 	error: remote 'refs/heads/master' is not a strict subset of local ref 
>> 'refs/heads/master'. maybe you are not up-to-date and need to pull first?
>> 	error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/git.git'
>>
>> to:
>>
>> 	error: remote 'refs/heads/master' is not an ancestor of
>> 	 local 'refs/heads/master'.
>> 	 Maybe you are not up-to-date and need to pull first?
>> 	error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/git.git'
>
>
> Junio suggested in [1] (see also earlier messages in that
> thread) to replace the recommendation to pull with a hint
> where to look in the user manual.
>
> [1] http://marc.info/?l=git&m=119398999317677&w=2
>
>
> The point is, there are various ways to resolve the problem.
> pull is not necessarily the right solution. At least, you should
> consider to rebase. Or maybe just something else went wrong.
Yeah, actually in my case I usually want to force....

So I think it's a good suggestion, but I'm putting it off for now as I'm not sure yet where to refer people to, and don't like making the error a lot longer.

Hm. I wonder if extra "help" commandline flags would be a way to get people extra guidance on particular situations without cluttering up the default messages ("not sure what to try next? Try -h notanancestor..." Maybe not.)

Show 11 quoted lines
>
> Nonetheless I think it could be a good idea to keep the most
> likely cases. So, how about
>
> "Are you up-to-date? Did you forget to pull or rebase? See User's Manual 
> for details."
>
> I put it as questions to avoid making a suggestion. The questions
> should give sufficient hints for searching in the User's Manual.
> I haven't found the single section that would explain exactly
> the situation we're dealing with.

Me neither. And I don't think a reference to the whole thing is helpful.

--b.
Steffen Prohaska· Nov 4, 2007, 23:13 UTC · re: J. Bruce Fields · lore

Re: [PATCH] errors: "strict subset" -> "ancestor"

On Nov 4, 2007, at 11:08 PM, J. Bruce Fields wrote:
Show 47 quoted lines
> On Sat, Nov 03, 2007 at 08:51:29AM +0100, Steffen Prohaska wrote:
>>
>> On Nov 3, 2007, at 3:39 AM, J. Bruce Fields wrote:
>>
>>> From: J. Bruce Fields <bfields@citi.umich.edu>
>>>
>>> The term "ancestor" is a bit more intuitive (and more consistent  
>>> with
>>> the documentation) than the term "strict subset".
>>>
>>> Also, remove superfluous "ref", capitalize, and add some carriage
>>> returns, changing:
>>>
>>> 	error: remote 'refs/heads/master' is not a strict subset of  
>>> local ref
>>> 'refs/heads/master'. maybe you are not up-to-date and need to  
>>> pull first?
>>> 	error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/ 
>>> git.git'
>>>
>>> to:
>>>
>>> 	error: remote 'refs/heads/master' is not an ancestor of
>>> 	 local 'refs/heads/master'.
>>> 	 Maybe you are not up-to-date and need to pull first?
>>> 	error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/ 
>>> git.git'
>>
>>
>> Junio suggested in [1] (see also earlier messages in that
>> thread) to replace the recommendation to pull with a hint
>> where to look in the user manual.
>>
>> [1] http://marc.info/?l=git&m=119398999317677&w=2
>>
>>
>> The point is, there are various ways to resolve the problem.
>> pull is not necessarily the right solution. At least, you should
>> consider to rebase. Or maybe just something else went wrong.
>
> Yeah, actually in my case I usually want to force....
>
> So I think it's a good suggestion, but I'm putting it off for now  
> as I'm
> not sure yet where to refer people to, and don't like making the  
> error a
> lot longer.

I agree. And it's probably a waste of time anyway, because sooner or later the mega-terse fetch output will be extended to push.

Show 6 quoted lines
> Hm.  I wonder if extra "help" commandline flags would be a way to get
> people extra guidance on particular situations without cluttering  
> up the
> default messages ("not sure what to try next?  Try -h  
> notanancestor..."
> Maybe not.)

The first step would be to describe the error messages in the manual (or the man pages), and provide hints how to resolve them. Currently we have no place we could link to, even if we had a mechanism to do so.

	Steffen

← back to recent threads