{"thread":{"id":"29770","subject":"Tilde spec - befuzzled","startedAt":"2012-02-28T09:07:41Z","lastAt":"2012-03-02T09:25:49Z","messageCount":10,"participants":["Luke Diamand","Andreas Ericsson","Thomas Rast","Junio C Hamano","Andrew Ardill","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"185594","messageId":"4F4C995D.9000504@diamand.org","threadId":"29770","inReplyTo":null,"subject":"Tilde spec - befuzzled","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2012-02-28T09:07:41Z","receivedAt":"2012-02-28T09:07:41Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"The documentation for caret and tilde specs is making my head hurt, even \nthough they always _do_ exactly what I want. And I thought I understood \nthem until I read more carefully.\n\n   A suffix '{caret}' to a revision parameter means the first parent of\n   that commit object.  '{caret}<n>' means the <n>th parent (i.e.\n   '<rev>{caret}'\n\nSo far, so good.\n\n'<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n   A suffix '{tilde}<n>' to a revision parameter means the commit\n   object that is the <n>th generation grand-parent of the named\n   commit object, following only the first parents.\n\nHang on, *grand*-parents?\n\nSo HEAD~1 won't give me the *parent* commit of HEAD, but the \n*grandparent* commit of HEAD (following only the first parents) ?\n\nHow do I get to the *parent* commit of HEAD?\nDoes that mean that HEAD~ != HEAD^\nAnd why does HEAD~1 always look exactly what I would naively call the \n'parent' of HEAD?\n\nI'm pretty sure I'm missing something very obvious. I think it must \nconfuse other people as well though, as it's quite easy to find webpages \naround that claim that tildes give the _parent_ commit.\n\nThanks\nLuke\n"},{"id":"185597","messageId":"4F4CA354.2070503@op5.se","threadId":"29770","inReplyTo":"4F4C995D.9000504@diamand.org","subject":"Re: Tilde spec - befuzzled","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2012-02-28T09:50:12Z","receivedAt":"2012-02-28T09:50:12Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"On 02/28/2012 10:07 AM, Luke Diamand wrote:\n> The documentation for caret and tilde specs is making my head hurt, even though they always _do_ exactly what I want. And I thought I understood them until I read more carefully.\n> \n> A suffix '{caret}' to a revision parameter means the first parent of\n> that commit object. '{caret}<n>' means the <n>th parent (i.e.\n> '<rev>{caret}'\n> \n> So far, so good.\n> \n> '<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n> A suffix '{tilde}<n>' to a revision parameter means the commit\n> object that is the <n>th generation grand-parent of the named\n> commit object, following only the first parents.\n> \n> Hang on, *grand*-parents?\n> \n\nReplace \"grand-parent\" with \"ancestor\" and your head might hurt a\nlittle less. Caret only ever describes parent, while tilde can\ndescribe either parent or n'th generation grand-parent. Since parent\nand grand-parent are all ancestors, that would be a better term.\n\nI believe this stems from the fact that most git-gurus use a single\ncaret to specify 'parent' and only go to the tilde when they want\ngrandparents. It might be because caret was implemented first, or\nbecause of english keyboard layout. On swedish keyboards, using tilde\nis far more convenient than using caret, so that's what I mostly use\nwhen I want the parent of a single-parent commit (it requires only\none hand and no thumb-acrobatics even on my laptop).\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"185602","messageId":"87zkc38a3v.fsf@thomas.inf.ethz.ch","threadId":"29770","inReplyTo":"4F4CA354.2070503@op5.se","subject":"Re: Tilde spec - befuzzled","fromName":"Thomas Rast","fromEmail":"trast@inf.ethz.ch","sentAt":"2012-02-28T11:34:44Z","receivedAt":"2012-02-28T11:34:44Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Andreas Ericsson <ae@op5.se> writes:\n\n> On 02/28/2012 10:07 AM, Luke Diamand wrote:\n>> The documentation for caret and tilde specs is making my head hurt, even though they always _do_ exactly what I want. And I thought I understood them until I read more carefully.\n>> \n>> A suffix '{caret}' to a revision parameter means the first parent of\n>> that commit object. '{caret}<n>' means the <n>th parent (i.e.\n>> '<rev>{caret}'\n>> \n>> So far, so good.\n>> \n>> '<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n>> A suffix '{tilde}<n>' to a revision parameter means the commit\n>> object that is the <n>th generation grand-parent of the named\n>> commit object, following only the first parents.\n>> \n>> Hang on, *grand*-parents?\n>> \n>\n> Replace \"grand-parent\" with \"ancestor\" and your head might hurt a\n> little less. Caret only ever describes parent, while tilde can\n> describe either parent or n'th generation grand-parent. Since parent\n> and grand-parent are all ancestors, that would be a better term.\n\nPerhaps we should reword it as \"n-th first-parent ancestor\"?  Barring\nconfusion about the position of the dashes, that leaves little room for\nerror.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"185657","messageId":"7vaa42zrw8.fsf@alter.siamese.dyndns.org","threadId":"29770","inReplyTo":"87zkc38a3v.fsf@thomas.inf.ethz.ch","subject":"Re: Tilde spec - befuzzled","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-28T19:20:39Z","receivedAt":"2012-02-28T19:20:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Rast <trast@inf.ethz.ch> writes:\n\n>>> '<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n>>> A suffix '{tilde}<n>' to a revision parameter means the commit\n>>> object that is the <n>th generation grand-parent of the named\n>>> commit object, following only the first parents.\n>>> \n>>> Hang on, *grand*-parents?\n>>> ...\n>\n> Perhaps we should reword it as \"n-th first-parent ancestor\"?  Barring\n> confusion about the position of the dashes, that leaves little room for\n> error.\n\nI think we could either go \"easier to read but not precise\"\n\n\t... that is the <n>th generation (grand-)parent of ...\n\nor \"may sound scary but correct\"\n\n\tthe ancestor reached by walking the first-parent chain <n> times\n\nI am not sure which bucket \"n-th first-parent ancestor\" falls into.\n"},{"id":"185688","messageId":"CAH5451m=6XhRj1osN_Dw7zKvAW-jtru+EbCkRvo8aNRMbJS6bA@mail.gmail.com","threadId":"29770","inReplyTo":"7vaa42zrw8.fsf@alter.siamese.dyndns.org","subject":"Re: Tilde spec - befuzzled","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2012-02-29T01:18:07Z","receivedAt":"2012-02-29T01:18:07Z","isPatch":false,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"On 29 February 2012 06:20, Junio C Hamano <gitster@pobox.com> wrote:\n> Thomas Rast <trast@inf.ethz.ch> writes:\n>\n>>>> '<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n>>>> A suffix '{tilde}<n>' to a revision parameter means the commit\n>>>> object that is the <n>th generation grand-parent of the named\n>>>> commit object, following only the first parents.\n>>>>\n>>>> Hang on, *grand*-parents?\n>>>> ...\n>>\n>> Perhaps we should reword it as \"n-th first-parent ancestor\"?  Barring\n>> confusion about the position of the dashes, that leaves little room for\n>> error.\n>\n> I think we could either go \"easier to read but not precise\"\n>\n>        ... that is the <n>th generation (grand-)parent of ...\n>\n> or \"may sound scary but correct\"\n>\n>        the ancestor reached by walking the first-parent chain <n> times\n>\n> I am not sure which bucket \"n-th first-parent ancestor\" falls into.\n\nThe terms might be too technical, however my understanding was that\nHEAD^n takes <n> steps along a breadth-first traversal of the commit\ntree rooted at HEAD, while HEAD~n uses a depth-first traversal.\n\nA better form for the description might come from that formulation of\nthe process, rather than the 'generational' formulation.\n\nRegards,\n\nAndrew Ardill\n"},{"id":"185702","messageId":"20120229073408.GA14181@sigill.intra.peff.net","threadId":"29770","inReplyTo":"CAH5451m=6XhRj1osN_Dw7zKvAW-jtru+EbCkRvo8aNRMbJS6bA@mail.gmail.com","subject":"Re: Tilde spec - befuzzled","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-02-29T07:34:08Z","receivedAt":"2012-02-29T07:34:08Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Feb 29, 2012 at 12:18:07PM +1100, Andrew Ardill wrote:\n\n> >>>> '<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n> >>>> A suffix '{tilde}<n>' to a revision parameter means the commit\n> >>>> object that is the <n>th generation grand-parent of the named\n> >>>> commit object, following only the first parents.\n> >>>>\n> >>>> Hang on, *grand*-parents?\n> >>>> ...\n> >>\n> >> Perhaps we should reword it as \"n-th first-parent ancestor\"?  Barring\n> >> confusion about the position of the dashes, that leaves little room for\n> >> error.\n> >\n> > I think we could either go \"easier to read but not precise\"\n> >\n> >        ... that is the <n>th generation (grand-)parent of ...\n> >\n> > or \"may sound scary but correct\"\n> >\n> >        the ancestor reached by walking the first-parent chain <n> times\n> >\n> > I am not sure which bucket \"n-th first-parent ancestor\" falls into.\n> \n> The terms might be too technical, however my understanding was that\n> HEAD^n takes <n> steps along a breadth-first traversal of the commit\n> tree rooted at HEAD, while HEAD~n uses a depth-first traversal.\n\nThe term breadth-first has me confused, as it implies that we will\ntraverse the breadth of the tree before descending to the next level of\ndepth. As if foo^3 would mean \"well, foo only has two parents, so go on\nto the next level of the tree\". It is really a breadth-only traversal,\nand the tilde is a depth-only traversal.\n\nAnyway, it seems to me the OP's confusion can be cleared up with\ns/grand-parent/ancestor/. Of course, while we are here, it might be\nworth expanding or improving the text if there are other confusing\naspects (which I'm not sure there are).\n\n-Peff\n"},{"id":"185715","messageId":"4F4DF02F.5050609@op5.se","threadId":"29770","inReplyTo":"CAH5451m=6XhRj1osN_Dw7zKvAW-jtru+EbCkRvo8aNRMbJS6bA@mail.gmail.com","subject":"Re: Tilde spec - befuzzled","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2012-02-29T09:30:23Z","receivedAt":"2012-02-29T09:30:23Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"On 02/29/2012 02:18 AM, Andrew Ardill wrote:\n> On 29 February 2012 06:20, Junio C Hamano<gitster@pobox.com>  wrote:\n>> Thomas Rast<trast@inf.ethz.ch>  writes:\n>>\n>>>>> '<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n>>>>> A suffix '{tilde}<n>' to a revision parameter means the commit\n>>>>> object that is the<n>th generation grand-parent of the named\n>>>>> commit object, following only the first parents.\n>>>>>\n>>>>> Hang on, *grand*-parents?\n>>>>> ...\n>>>\n>>> Perhaps we should reword it as \"n-th first-parent ancestor\"?  Barring\n>>> confusion about the position of the dashes, that leaves little room for\n>>> error.\n>>\n>> I think we could either go \"easier to read but not precise\"\n>>\n>>         ... that is the<n>th generation (grand-)parent of ...\n>>\n>> or \"may sound scary but correct\"\n>>\n>>         the ancestor reached by walking the first-parent chain<n>  times\n>>\n>> I am not sure which bucket \"n-th first-parent ancestor\" falls into.\n> \n> The terms might be too technical, however my understanding was that\n> HEAD^n takes<n>  steps along a breadth-first traversal of the commit\n> tree rooted at HEAD, while HEAD~n uses a depth-first traversal.\n> \n> A better form for the description might come from that formulation of\n> the process, rather than the 'generational' formulation.\n> \n\nI doubt it. Most non-programmers have no notion of the difference\nbetween breadth-first and depth-first. You have to work with trees \nor graphs in some form before breadth and depth become intuitive\nto read in tech docs.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"185716","messageId":"4F4DF096.9050905@op5.se","threadId":"29770","inReplyTo":"7vaa42zrw8.fsf@alter.siamese.dyndns.org","subject":"Re: Tilde spec - befuzzled","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2012-02-29T09:32:06Z","receivedAt":"2012-02-29T09:32:06Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"On 02/28/2012 08:20 PM, Junio C Hamano wrote:\n> Thomas Rast<trast@inf.ethz.ch>  writes:\n> \n>>>> '<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n>>>> A suffix '{tilde}<n>' to a revision parameter means the commit\n>>>> object that is the<n>th generation grand-parent of the named\n>>>> commit object, following only the first parents.\n>>>>\n>>>> Hang on, *grand*-parents?\n>>>> ...\n>>\n>> Perhaps we should reword it as \"n-th first-parent ancestor\"?  Barring\n>> confusion about the position of the dashes, that leaves little room for\n>> error.\n> \n> I think we could either go \"easier to read but not precise\"\n> \n> \t... that is the<n>th generation (grand-)parent of ...\n> \n\n(grand-)parent and ancestor are interchangeable while the parentheses\nremain, although the former looks a bit clumsier in text.\n\n> or \"may sound scary but correct\"\n> \n> \tthe ancestor reached by walking the first-parent chain<n>  times\n> \n> I am not sure which bucket \"n-th first-parent ancestor\" falls into.\n\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"185734","messageId":"7v8vjltpv1.fsf_-_@alter.siamese.dyndns.org","threadId":"29770","inReplyTo":"4F4DF096.9050905@op5.se","subject":"Re*: Tilde spec - befuzzled","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-29T19:13:22Z","receivedAt":"2012-02-29T19:13:22Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Ericsson <ae@op5.se> writes:\n\n> On 02/28/2012 08:20 PM, Junio C Hamano wrote:\n>> Thomas Rast<trast@inf.ethz.ch>  writes:\n>> \n>>>>> '<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n>>>>> A suffix '{tilde}<n>' to a revision parameter means the commit\n>>>>> object that is the<n>th generation grand-parent of the named\n>>>>> commit object, following only the first parents.\n>>>>>\n>>>>> Hang on, *grand*-parents?\n>>>>> ...\n>>>\n>>> Perhaps we should reword it as \"n-th first-parent ancestor\"?  Barring\n>>> confusion about the position of the dashes, that leaves little room for\n>>> error.\n>> \n>> I think we could either go \"easier to read but not precise\"\n>> \n>> \t... that is the<n>th generation (grand-)parent of ...\n>\n> (grand-)parent and ancestor are interchangeable while the parentheses\n> remain, although the former looks a bit clumsier in text.\n\nOk, then something like this...\n\n-- >8 --\nSubject: Documentation: do not assume that n > 1 in <rev>~$n\n\nWe explained <rev>~<n> as <n>th generation grand-parent, but a reader got\nconfused by the \"grand-\" part when <n> is 1.\n\nReword it with \"ancestor\"; with the \"generation\" and \"following only the\nfirst parents\" around there, what we try to describe should be clear\nenough now.\n\nNoticed-by: Luke Diamand <luke@diamand.org>\nHelped-by: Thomas Rast <trast@inf.ethz.ch>\nHelped-by: Andreas Ericsson <ae@op5.se>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/revisions.txt |    2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\nindex b290b61..1725661 100644\n--- a/Documentation/revisions.txt\n+++ b/Documentation/revisions.txt\n@@ -101,7 +101,7 @@ the '$GIT_DIR/refs' directory or from the '$GIT_DIR/packed-refs' file.\n \n '<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n   A suffix '{tilde}<n>' to a revision parameter means the commit\n-  object that is the <n>th generation grand-parent of the named\n+  object that is the <n>th generation ancestor of the named\n   commit object, following only the first parents.  I.e. '<rev>{tilde}3' is\n   equivalent to '<rev>{caret}{caret}{caret}' which is equivalent to\n   '<rev>{caret}1{caret}1{caret}1'.  See below for an illustration of\n"},{"id":"185895","messageId":"4F50921D.8050109@diamand.org","threadId":"29770","inReplyTo":"7v8vjltpv1.fsf_-_@alter.siamese.dyndns.org","subject":"Re: Re*: Tilde spec - befuzzled","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2012-03-02T09:25:49Z","receivedAt":"2012-03-02T09:25:49Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"On 29/02/12 19:13, Junio C Hamano wrote:\n> Andreas Ericsson<ae@op5.se>  writes:\n>\n>> On 02/28/2012 08:20 PM, Junio C Hamano wrote:\n>>> Thomas Rast<trast@inf.ethz.ch>   writes:\n>>>\n>>>>>> '<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n>>>>>> A suffix '{tilde}<n>' to a revision parameter means the commit\n>>>>>> object that is the<n>th generation grand-parent of the named\n>>>>>> commit object, following only the first parents.\n>>>>>>\n>>>>>> Hang on, *grand*-parents?\n>>>>>> ...\n>>>>\n>>>> Perhaps we should reword it as \"n-th first-parent ancestor\"?  Barring\n>>>> confusion about the position of the dashes, that leaves little room for\n>>>> error.\n>>>\n>>> I think we could either go \"easier to read but not precise\"\n>>>\n>>> \t... that is the<n>th generation (grand-)parent of ...\n>>\n>> (grand-)parent and ancestor are interchangeable while the parentheses\n>> remain, although the former looks a bit clumsier in text.\n>\n> Ok, then something like this...\n\nThis change works for me. Ack.\n\nThanks,\nLuke\n\n\n>\n> -- >8 --\n> Subject: Documentation: do not assume that n>  1 in<rev>~$n\n>\n> We explained<rev>~<n>  as<n>th generation grand-parent, but a reader got\n> confused by the \"grand-\" part when<n>  is 1.\n>\n> Reword it with \"ancestor\"; with the \"generation\" and \"following only the\n> first parents\" around there, what we try to describe should be clear\n> enough now.\n>\n> Noticed-by: Luke Diamand<luke@diamand.org>\n> Helped-by: Thomas Rast<trast@inf.ethz.ch>\n> Helped-by: Andreas Ericsson<ae@op5.se>\n> Signed-off-by: Junio C Hamano<gitster@pobox.com>\n> ---\n>   Documentation/revisions.txt |    2 +-\n>   1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\n> index b290b61..1725661 100644\n> --- a/Documentation/revisions.txt\n> +++ b/Documentation/revisions.txt\n> @@ -101,7 +101,7 @@ the '$GIT_DIR/refs' directory or from the '$GIT_DIR/packed-refs' file.\n>\n>   '<rev>{tilde}<n>', e.g. 'master{tilde}3'::\n>     A suffix '{tilde}<n>' to a revision parameter means the commit\n> -  object that is the<n>th generation grand-parent of the named\n> +  object that is the<n>th generation ancestor of the named\n>     commit object, following only the first parents.  I.e. '<rev>{tilde}3' is\n>     equivalent to '<rev>{caret}{caret}{caret}' which is equivalent to\n>     '<rev>{caret}1{caret}1{caret}1'.  See below for an illustration of\n"}]}