{"thread":{"id":"23011","subject":"documentation of git read-tree","startedAt":"2010-03-13T22:32:43Z","lastAt":"2010-03-15T10:54:46Z","messageCount":3,"participants":["Christian Halstrick","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"136741","messageId":"8c627c4f1003131432g26598d22m9795177ab56a463e@mail.gmail.com","threadId":"23011","inReplyTo":null,"subject":"documentation of git read-tree","fromName":"Christian Halstrick","fromEmail":"christian.halstrick@gmail.com","sentAt":"2010-03-13T22:32:43Z","receivedAt":"2010-03-13T22:32:43Z","isPatch":false,"sender":{"key":"christian.halstrick@gmail.com","avatar":"https://gravatar.com/avatar/3598bf518644c7dc32d4dcd8e0554b6a313e12103011862402c83ae2854203ce?d=mp&s=160"},"body":"Hi,\n\nthe docu for \"git read-tree\" [1] talk about 21 \"carry forward\" rules.\nIn the tables describing the rules 4-21 the first column is named\n\"clean\". But the text doesn't explain exactly what \"clean\" means. I\ncan guess, but does anybody know?\n\nCiao\n  Chris\n\n[1] http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html\n"},{"id":"136823","messageId":"5fb2461fbc5266c8be5ba09c4d74b621c718374e.1268650319.git.git@drmicha.warpmail.net","threadId":"23011","inReplyTo":"8c627c4f1003131432g26598d22m9795177ab56a463e@mail.gmail.com","subject":"[PATCH 1/2] Documentation/git-read-tree: fix table layout","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-03-15T10:54:45Z","receivedAt":"2010-03-15T10:54:45Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Asciidoc takes the first non-space character in the first line of the\nparagraph as a reference point for preformatted layout, so adjust to\nthat to make the table align.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n Documentation/git-read-tree.txt |   20 ++++++++++----------\n 1 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt\nindex 567671c..5aaf0d5 100644\n--- a/Documentation/git-read-tree.txt\n+++ b/Documentation/git-read-tree.txt\n@@ -164,23 +164,23 @@ Here are the \"carry forward\" rules:\n \n         I (index)           H        M        Result\n        -------------------------------------------------------\n-      0 nothing             nothing  nothing  (does not happen)\n-      1 nothing             nothing  exists   use M\n-      2 nothing             exists   nothing  remove path from index\n-      3 nothing             exists   exists,  use M if \"initial checkout\"\n+     0  nothing             nothing  nothing  (does not happen)\n+     1  nothing             nothing  exists   use M\n+     2  nothing             exists   nothing  remove path from index\n+     3  nothing             exists   exists,  use M if \"initial checkout\"\n \t\t\t\t     H == M   keep index otherwise\n \t\t\t\t     exists   fail\n \t\t\t\t     H != M\n \n         clean I==H  I==M\n        ------------------\n-      4 yes   N/A   N/A     nothing  nothing  keep index\n-      5 no    N/A   N/A     nothing  nothing  keep index\n+     4  yes   N/A   N/A     nothing  nothing  keep index\n+     5  no    N/A   N/A     nothing  nothing  keep index\n \n-      6 yes   N/A   yes     nothing  exists   keep index\n-      7 no    N/A   yes     nothing  exists   keep index\n-      8 yes   N/A   no      nothing  exists   fail\n-      9 no    N/A   no      nothing  exists   fail\n+     6  yes   N/A   yes     nothing  exists   keep index\n+     7  no    N/A   yes     nothing  exists   keep index\n+     8  yes   N/A   no      nothing  exists   fail\n+     9  no    N/A   no      nothing  exists   fail\n \n      10 yes   yes   N/A     exists   nothing  remove path from index\n      11 no    yes   N/A     exists   nothing  fail\n-- \n1.7.0.1.300.gd855a\n"},{"id":"136824","messageId":"21871a4ad4a908765851d8854a8190fa16d944b8.1268650319.git.git@drmicha.warpmail.net","threadId":"23011","inReplyTo":"8c627c4f1003131432g26598d22m9795177ab56a463e@mail.gmail.com","subject":"[PATCH 2/2] Documentation/git-read-tree: clarify 2-tree merge","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-03-15T10:54:46Z","receivedAt":"2010-03-15T10:54:46Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Clarify the description of the 2-tree merge by defining the terms\nwhich are used in the table, and by applying some small linguistic\nchanges.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n Documentation/git-read-tree.txt |   28 +++++++++++++++-------------\n 1 files changed, 15 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt\nindex 5aaf0d5..88b20e3 100644\n--- a/Documentation/git-read-tree.txt\n+++ b/Documentation/git-read-tree.txt\n@@ -130,7 +130,7 @@ Single Tree Merge\n ~~~~~~~~~~~~~~~~~\n If only 1 tree is specified, 'git read-tree' operates as if the user did not\n specify `-m`, except that if the original index has an entry for a\n-given pathname, and the contents of the path matches with the tree\n+given pathname, and the contents of the path match with the tree\n being read, the stat info from the index is used. (In other words, the\n index's stat()s take precedence over the merged tree's).\n \n@@ -154,22 +154,24 @@ When two trees are specified, the user is telling 'git read-tree'\n the following:\n \n      1. The current index and work tree is derived from $H, but\n-        the user may have local changes in them since $H;\n+        the user may have local changes in them since $H.\n \n      2. The user wants to fast-forward to $M.\n \n In this case, the `git read-tree -m $H $M` command makes sure\n that no local change is lost as the result of this \"merge\".\n-Here are the \"carry forward\" rules:\n+Here are the \"carry forward\" rules, where \"I\" denotes the index,\n+\"clean\" means that index and work tree coincide, and \"exists\"/\"nothing\"\n+refer to the presence of a path in the specified commit:\n \n-        I (index)           H        M        Result\n+        I                   H        M        Result\n        -------------------------------------------------------\n      0  nothing             nothing  nothing  (does not happen)\n      1  nothing             nothing  exists   use M\n      2  nothing             exists   nothing  remove path from index\n-     3  nothing             exists   exists,  use M if \"initial checkout\"\n+     3  nothing             exists   exists,  use M if \"initial checkout\",\n \t\t\t\t     H == M   keep index otherwise\n-\t\t\t\t     exists   fail\n+\t\t\t\t     exists,  fail\n \t\t\t\t     H != M\n \n         clean I==H  I==M\n@@ -187,7 +189,7 @@ Here are the \"carry forward\" rules:\n      12 yes   no    N/A     exists   nothing  fail\n      13 no    no    N/A     exists   nothing  fail\n \n-        clean (H=M)\n+        clean (H==M)\n        ------\n      14 yes                 exists   exists   keep index\n      15 no                  exists   exists   keep index\n@@ -202,26 +204,26 @@ Here are the \"carry forward\" rules:\n      21 no    yes   no      exists   exists   fail\n \n In all \"keep index\" cases, the index entry stays as in the\n-original index file.  If the entry were not up to date,\n+original index file.  If the entry is not up to date,\n 'git read-tree' keeps the copy in the work tree intact when\n operating under the -u flag.\n \n When this form of 'git read-tree' returns successfully, you can\n-see what \"local changes\" you made are carried forward by running\n+see which of the \"local changes\" that you made were carried forward by running\n `git diff-index --cached $M`.  Note that this does not\n-necessarily match `git diff-index --cached $H` would have\n+necessarily match what `git diff-index --cached $H` would have\n produced before such a two tree merge.  This is because of cases\n 18 and 19 --- if you already had the changes in $M (e.g. maybe\n you picked it up via e-mail in a patch form), `git diff-index\n --cached $H` would have told you about the change before this\n merge, but it would not show in `git diff-index --cached $M`\n-output after two-tree merge.\n+output after the two-tree merge.\n \n-Case #3 is slightly tricky and needs explanation.  The result from this\n+Case 3 is slightly tricky and needs explanation.  The result from this\n rule logically should be to remove the path if the user staged the removal\n of the path and then switching to a new branch.  That however will prevent\n the initial checkout from happening, so the rule is modified to use M (new\n-tree) only when the contents of the index is empty.  Otherwise the removal\n+tree) only when the content of the index is empty.  Otherwise the removal\n of the path is kept as long as $H and $M are the same.\n \n 3-Way Merge\n-- \n1.7.0.1.300.gd855a\n"}]}