{"thread":{"id":"40616","subject":"ancestor and descendant ~ clarification needed","startedAt":"2015-10-22T09:06:03Z","lastAt":"2015-10-24T16:42:55Z","messageCount":7,"participants":["Xue Fuqiao","Etienne Girard","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"272089","messageId":"CAAF+z6HEeFEYD9R+6Uz3ebRYNMpy5Gh0Fo9EjpaTYwSbqyDLgQ@mail.gmail.com","threadId":"40616","inReplyTo":null,"subject":"ancestor and descendant ~ clarification needed","fromName":"Xue Fuqiao","fromEmail":"xfq.free@gmail.com","sentAt":"2015-10-22T09:06:03Z","receivedAt":"2015-10-22T09:06:03Z","isPatch":false,"sender":{"key":"xfq.free@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2863444?v=4"},"body":"Hi,\n\nIn Documentation/user-manual.txt:\n\n   In the following, we say that commit X is \"reachable\" from commit Y\n   if commit X is an ancestor of commit Y.  Equivalently, you could say\n   that Y is a descendant of X, or that there is a chain of parents\n   leading from commit Y to commit X.\n[...]\n   However, if the current branch is a descendant of the other--so every\n   commit present in the one is already contained in the other--then Git\n   just performs a \"fast-forward\"; the head of the current branch is\n   moved forward to point at the head of the merged-in branch, without\n   any new commits being created.\n\nI'm a Git newbie.  According to my understanding, the \"descendant\" in\nthe second paragraph above should be \"ancestor\".  I attempt to represent\nmy understanding using the following diagram (please see it in a\nmonospaced font):\n\n................................................\n\n         o--o--o <-- Branch A\n        /\n o--o--o <-- master\n\n................................................\n\n\"master\" is the current branch, and (as I understand it) it is an\nancestor of \"Branch A\", because there is a chain of parents leading from\n\"Branch A\" to master.  So \"Branch A\" (i.e., \"the other\" branch, or the\n\"merged-in\" branch) is a descendant of master.  I even set up a test\nrepository and attempted to test the above diagram with \"git merge-base\n--is-ancestor\" (and \"echo $?\"), but it seems to me that the master\nbranch is *not* a descendant of \"Branch A\".\n\nI hope you can understand my words here (English is not my native\nlanguage).  Can anyone point me in the right direction (what am I\nmissing)?\n"},{"id":"272096","messageId":"CAJA=mv4AdGmEOBNugEMemYNvhCqFqpoa0_qs1gpWRXvMJaSg_g@mail.gmail.com","threadId":"40616","inReplyTo":"CAAF+z6HEeFEYD9R+6Uz3ebRYNMpy5Gh0Fo9EjpaTYwSbqyDLgQ@mail.gmail.com","subject":"Re: ancestor and descendant ~ clarification needed","fromName":"Etienne Girard","fromEmail":"etienne.g.girard@gmail.com","sentAt":"2015-10-22T12:58:44Z","receivedAt":"2015-10-22T12:58:44Z","isPatch":false,"sender":{"key":"etienne.g.girard@gmail.com","avatar":null},"body":"Hello,\n\nI think you're right, branch A is a descendant of master. We could\nchange the misleading sentence to \"However, if the current branch is a\ndescendant of the other - if its head is a descendant of the other's\nhead - [...]\", to link back to the definition of descendant for\ncommits.\n\n2015-10-22 11:06 GMT+02:00 Xue Fuqiao <xfq.free@gmail.com>:\n> Hi,\n>\n> In Documentation/user-manual.txt:\n>\n>    In the following, we say that commit X is \"reachable\" from commit Y\n>    if commit X is an ancestor of commit Y.  Equivalently, you could say\n>    that Y is a descendant of X, or that there is a chain of parents\n>    leading from commit Y to commit X.\n> [...]\n>    However, if the current branch is a descendant of the other--so every\n>    commit present in the one is already contained in the other--then Git\n>    just performs a \"fast-forward\"; the head of the current branch is\n>    moved forward to point at the head of the merged-in branch, without\n>    any new commits being created.\n>\n> I'm a Git newbie.  According to my understanding, the \"descendant\" in\n> the second paragraph above should be \"ancestor\".  I attempt to represent\n> my understanding using the following diagram (please see it in a\n> monospaced font):\n>\n> ................................................\n>\n>          o--o--o <-- Branch A\n>         /\n>  o--o--o <-- master\n>\n> ................................................\n>\n> \"master\" is the current branch, and (as I understand it) it is an\n> ancestor of \"Branch A\", because there is a chain of parents leading from\n> \"Branch A\" to master.  So \"Branch A\" (i.e., \"the other\" branch, or the\n> \"merged-in\" branch) is a descendant of master.  I even set up a test\n> repository and attempted to test the above diagram with \"git merge-base\n> --is-ancestor\" (and \"echo $?\"), but it seems to me that the master\n> branch is *not* a descendant of \"Branch A\".\n>\n> I hope you can understand my words here (English is not my native\n> language).  Can anyone point me in the right direction (what am I\n> missing)?\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"272120","messageId":"xmqqfv12r6vn.fsf@gitster.mtv.corp.google.com","threadId":"40616","inReplyTo":"CAAF+z6HEeFEYD9R+6Uz3ebRYNMpy5Gh0Fo9EjpaTYwSbqyDLgQ@mail.gmail.com","subject":"Re: ancestor and descendant ~ clarification needed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-10-22T20:22:04Z","receivedAt":"2015-10-22T20:22:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Xue Fuqiao <xfq.free@gmail.com> writes:\n\n> In Documentation/user-manual.txt:\n>\n>    In the following, we say that commit X is \"reachable\" from commit Y\n>    if commit X is an ancestor of commit Y.  Equivalently, you could say\n>    that Y is a descendant of X, or that there is a chain of parents\n>    leading from commit Y to commit X.\n> [...]\n>    However, if the current branch is a descendant of the other--so every\n>    commit present in the one is already contained in the other--then Git\n>    just performs a \"fast-forward\"; the head of the current branch is\n>    moved forward to point at the head of the merged-in branch, without\n>    any new commits being created.\n\nYeah, that is the other way around.\n\n (1) If the current branch is a descendant of the other--so every\n     commit present in the other branch is already contained in the\n     current branch--then merging the other branch into the current\n     branch is a no-op \"Already up-to-date!\".\n\n (2) If the current branch is an ancestor of the other--so every\n     commit present in the current branch is already contained in\n     the other branch--then merging the other branch into the\n     current branch can be fast-forwarded, by moving the tip of the\n     current branch to point at the commit at the tip of the other\n     branch, and by default Git does so, instead of creating an\n     unnecessary merge.\n"},{"id":"272134","messageId":"CAAF+z6H+wwCOhPCU-_Uh-Odc=411N+G+d_iE_AKX+JxVMDtsMQ@mail.gmail.com","threadId":"40616","inReplyTo":"xmqqfv12r6vn.fsf@gitster.mtv.corp.google.com","subject":"Re: ancestor and descendant ~ clarification needed","fromName":"Xue Fuqiao","fromEmail":"xfq.free@gmail.com","sentAt":"2015-10-23T07:29:05Z","receivedAt":"2015-10-23T07:29:05Z","isPatch":false,"sender":{"key":"xfq.free@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2863444?v=4"},"body":"Hi Junio,\n\nOn Fri, Oct 23, 2015 at 4:22 AM, Junio C Hamano <gitster@pobox.com> wrote:\n\n> Yeah, that is the other way around.\n>\n>  (1) If the current branch is a descendant of the other--so every\n>      commit present in the other branch is already contained in the\n>      current branch--then merging the other branch into the current\n>      branch is a no-op \"Already up-to-date!\".\n>\n>  (2) If the current branch is an ancestor of the other--so every\n>      commit present in the current branch is already contained in\n>      the other branch--then merging the other branch into the\n>      current branch can be fast-forwarded, by moving the tip of the\n>      current branch to point at the commit at the tip of the other\n>      branch, and by default Git does so, instead of creating an\n>      unnecessary merge.\n\nI see.  Thank you.  What do you think about the following minor patch\nfor user-manual.txt?  I can send a more formal one using format-patch\nand send-email if needed.\n\ndiff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt\nindex 1b7987e..d68df13 100644\n--- a/Documentation/user-manual.txt\n+++ b/Documentation/user-manual.txt\n@@ -1431,11 +1431,11 @@ differently.  Normally, a merge results in a\nmerge commit, with two\n parents, one pointing at each of the two lines of development that\n were merged.\n\n-However, if the current branch is a descendant of the other--so every\n-commit present in the one is already contained in the other--then Git\n-just performs a \"fast-forward\"; the head of the current branch is moved\n-forward to point at the head of the merged-in branch, without any new\n-commits being created.\n+However, if the current branch is an ancestor of the other--so every commit\n+present in the current branch is already contained in the other\nbranch--then Git\n+just performs a \"fast-forward\"; the head of the current branch is moved forward\n+to point at the head of the merged-in branch, without any new commits being\n+created.\n\n [[fixing-mistakes]]\n Fixing mistakes\n"},{"id":"272144","messageId":"xmqqsi51plpz.fsf@gitster.mtv.corp.google.com","threadId":"40616","inReplyTo":"CAAF+z6H+wwCOhPCU-_Uh-Odc=411N+G+d_iE_AKX+JxVMDtsMQ@mail.gmail.com","subject":"Re: ancestor and descendant ~ clarification needed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-10-23T16:56:40Z","receivedAt":"2015-10-23T16:56:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Xue Fuqiao <xfq.free@gmail.com> writes:\n\n> Hi Junio,\n>\n> On Fri, Oct 23, 2015 at 4:22 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n>> Yeah, that is the other way around.\n>>\n>>  (1) If the current branch is a descendant of the other--so every\n>>      commit present in the other branch is already contained in the\n>>      current branch--then merging the other branch into the current\n>>      branch is a no-op \"Already up-to-date!\".\n>>\n>>  (2) If the current branch is an ancestor of the other--so every\n>>      commit present in the current branch is already contained in\n>>      the other branch--then merging the other branch into the\n>>      current branch can be fast-forwarded, by moving the tip of the\n>>      current branch to point at the commit at the tip of the other\n>>      branch, and by default Git does so, instead of creating an\n>>      unnecessary merge.\n>\n> I see.  Thank you.  What do you think about the following minor patch\n> for user-manual.txt?\n\nWhile the updated text is more correct than the original, I do not\nknow if that is sufficient, or we would also want to mention the\n\"Already up-to-date!\" case here while at it.\n\n> -However, if the current branch is a descendant of the other--so every\n> -commit present in the one is already contained in the other--then Git\n> -just performs a \"fast-forward\"; the head of the current branch is moved\n> -forward to point at the head of the merged-in branch, without any new\n> -commits being created.\n> +However, if the current branch is an ancestor of the other--so every commit\n> +present in the current branch is already contained in the other\n> branch--then Git\n> +just performs a \"fast-forward\"; the head of the current branch is moved forward\n> +to point at the head of the merged-in branch, without any new commits being\n> +created.\n"},{"id":"272159","messageId":"CAAF+z6Guy4h8XDHkgkAmxLftfTTsXrDAd_ezFCQzdiWncvVSTg@mail.gmail.com","threadId":"40616","inReplyTo":"xmqqsi51plpz.fsf@gitster.mtv.corp.google.com","subject":"Re: ancestor and descendant ~ clarification needed","fromName":"Xue Fuqiao","fromEmail":"xfq.free@gmail.com","sentAt":"2015-10-23T23:11:33Z","receivedAt":"2015-10-23T23:11:33Z","isPatch":false,"sender":{"key":"xfq.free@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2863444?v=4"},"body":"On Sat, Oct 24, 2015 at 12:56 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> I see.  Thank you.  What do you think about the following minor patch\n>> for user-manual.txt?\n>\n> While the updated text is more correct than the original, I do not\n> know if that is sufficient, or we would also want to mention the\n> \"Already up-to-date!\" case here while at it.\n\nI thought about that, and IMHO it's not needed.  The section name is\n\"Fast-forward merges\" and intends to introduce the \"fast-forward\"\nconcept, which is irrelevant to \"Already up-to-date!\".  Although the\n\"Already up-to-date!\" case isn't mentioned all over the manual, it's\npretty clear to me (as someone who isn't quite familiar with Git).\n\n>> -However, if the current branch is a descendant of the other--so every\n>> -commit present in the one is already contained in the other--then Git\n>> -just performs a \"fast-forward\"; the head of the current branch is moved\n>> -forward to point at the head of the merged-in branch, without any new\n>> -commits being created.\n>> +However, if the current branch is an ancestor of the other--so every commit\n>> +present in the current branch is already contained in the other\n>> branch--then Git\n>> +just performs a \"fast-forward\"; the head of the current branch is moved forward\n>> +to point at the head of the merged-in branch, without any new commits being\n>> +created.\n"},{"id":"272173","messageId":"xmqqy4esmd4g.fsf@gitster.mtv.corp.google.com","threadId":"40616","inReplyTo":"CAAF+z6Guy4h8XDHkgkAmxLftfTTsXrDAd_ezFCQzdiWncvVSTg@mail.gmail.com","subject":"Re: ancestor and descendant ~ clarification needed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-10-24T16:42:55Z","receivedAt":"2015-10-24T16:42:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Xue Fuqiao <xfq.free@gmail.com> writes:\n\n> On Sat, Oct 24, 2015 at 12:56 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>>> I see.  Thank you.  What do you think about the following minor patch\n>>> for user-manual.txt?\n>>\n>> While the updated text is more correct than the original, I do not\n>> know if that is sufficient, or we would also want to mention the\n>> \"Already up-to-date!\" case here while at it.\n>\n> I thought about that, and IMHO it's not needed.  The section name is\n> \"Fast-forward merges\" and intends to introduce the \"fast-forward\"\n> concept, which is irrelevant to \"Already up-to-date!\".\n\nOkay.\n"}]}