{"thread":{"id":"1015","subject":"[PATCH 0/2] D/F conflicts fixes.","startedAt":"2005-06-23T23:20:36Z","lastAt":"2005-06-26T12:36:30Z","messageCount":19,"participants":["Junio C Hamano","Linus Torvalds","Martijn Kuipers"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"5195","messageId":"7vaclgfynv.fsf@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":null,"subject":"[PATCH 0/2] D/F conflicts fixes.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-23T23:20:36Z","receivedAt":"2005-06-23T23:20:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I'll be sending these two patches.\n\n    [PATCH 1/2] Add more tests for read-tree --emu23.\n    [PATCH 2/2] Fix oversimplified optimization for add_cache_entry().\n\n\n"},{"id":"5199","messageId":"7vmzpgejvp.fsf@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vaclgfynv.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH 1/2] Add more tests for read-tree --emu23.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-23T23:25:14Z","receivedAt":"2005-06-23T23:25:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This adds more tests for --emu23.  One is to show how it can\ncarry forward more local changes than the straightforward\ntwo-way fast forward, and another is to show the recent\novereager optimization of directory/file conflict check broke\nthings, which will be fixed in the next commit.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n t/t1001-read-tree-m-2way.sh       |   70 +++++++++++++++++++++++++---\n t/t1005-read-tree-m-2way-emu23.sh |   94 ++++++++++++++++++++++++++++++++++---\n 2 files changed, 150 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh\n--- a/t/t1001-read-tree-m-2way.sh\n+++ b/t/t1001-read-tree-m-2way.sh\n@@ -29,7 +29,6 @@ read_tree_twoway () {\n _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n _x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n compare_change () {\n-    \tcat current\n \tsed -n >current \\\n \t    -e '/^--- /d; /^+++ /d; /^@@ /d;' \\\n \t    -e 's/^\\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\\) '\"$_x40\"' /\\1 X /p' \\\n@@ -51,11 +50,22 @@ check_cache_at () {\n \tesac\n }\n \n+cat >bozbar-old <<\\EOF\n+This is a sample file used in two-way fast forward merge\n+tests.  Its second line ends with a magic word bozbar\n+which will be modified by the merged head to gnusto.\n+It has some extra lines so that external tools can\n+successfully merge independent changes made to later\n+lines (such as this one), avoiding line conflicts.\n+EOF\n+\n+sed -e 's/bozbar/gnusto (earlier bozbar)/' bozbar-old >bozbar-new\n+\n test_expect_success \\\n     setup \\\n     'echo frotz >frotz &&\n      echo nitfol >nitfol &&\n-     echo bozbar >bozbar &&\n+     cat bozbar-old >bozbar &&\n      echo rezrov >rezrov &&\n      echo yomin >yomin &&\n      git-update-cache --add nitfol bozbar rezrov &&\n@@ -63,7 +73,7 @@ test_expect_success \\\n      echo treeH $treeH &&\n      git-ls-tree $treeH &&\n \n-     echo gnusto >bozbar &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add frotz bozbar --force-remove rezrov &&\n      git-ls-files --stage >M.out &&\n      treeM=`git-write-tree` &&\n@@ -86,6 +96,8 @@ echo '+100644 X 0\tyomin' >expected\n test_expect_success \\\n     '4 - carry forward local addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      git-update-cache --add yomin &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >4.out || exit\n@@ -96,6 +108,8 @@ test_expect_success \\\n test_expect_success \\\n     '5 - carry forward local addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo yomin >yomin &&\n      git-update-cache --add yomin &&\n      echo yomin yomin >yomin &&\n@@ -108,6 +122,8 @@ test_expect_success \\\n test_expect_success \\\n     '6 - local addition already has the same.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      git-update-cache --add frotz &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >6.out &&\n@@ -117,6 +133,8 @@ test_expect_success \\\n test_expect_success \\\n     '7 - local addition already has the same.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz >frotz &&\n      git-update-cache --add frotz &&\n      echo frotz frotz >frotz &&\n@@ -128,6 +146,8 @@ test_expect_success \\\n test_expect_success \\\n     '8 - conflicting addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz frotz >frotz &&\n      git-update-cache --add frotz &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n@@ -135,6 +155,8 @@ test_expect_success \\\n test_expect_success \\\n     '9 - conflicting addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz frotz >frotz &&\n      git-update-cache --add frotz &&\n      echo frotz >frotz &&\n@@ -143,6 +165,8 @@ test_expect_success \\\n test_expect_success \\\n     '10 - path removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      read_tree_twoway $treeH $treeM &&\n@@ -152,6 +176,8 @@ test_expect_success \\\n test_expect_success \\\n     '11 - dirty path removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      echo rezrov rezrov >rezrov &&\n@@ -160,6 +186,8 @@ test_expect_success \\\n test_expect_success \\\n     '12 - unmatching local changes being removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n@@ -167,6 +195,8 @@ test_expect_success \\\n test_expect_success \\\n     '13 - unmatching local changes being removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      echo rezrov >rezrov &&\n@@ -180,6 +210,8 @@ EOF\n test_expect_success \\\n     '14 - unchanged in two heads.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo nitfol nitfol >nitfol &&\n      git-update-cache --add nitfol &&\n      read_tree_twoway $treeH $treeM &&\n@@ -191,6 +223,8 @@ test_expect_success \\\n test_expect_success \\\n     '15 - unchanged in two heads.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo nitfol nitfol >nitfol &&\n      git-update-cache --add nitfol &&\n      echo nitfol nitfol nitfol >nitfol &&\n@@ -203,6 +237,8 @@ test_expect_success \\\n test_expect_success \\\n     '16 - conflicting local change.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo bozbar bozbar >bozbar &&\n      git-update-cache --add bozbar &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n@@ -210,6 +246,8 @@ test_expect_success \\\n test_expect_success \\\n     '17 - conflicting local change.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo bozbar bozbar >bozbar &&\n      git-update-cache --add bozbar &&\n      echo bozbar bozbar bozbar >bozbar &&\n@@ -218,7 +256,9 @@ test_expect_success \\\n test_expect_success \\\n     '18 - local change already having a good result.' \\\n     'rm -f .git/index &&\n-     echo gnusto >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add bozbar &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >18.out &&\n@@ -228,7 +268,9 @@ test_expect_success \\\n test_expect_success \\\n     '19 - local change already having a good result, further modified.' \\\n     'rm -f .git/index &&\n-     echo gnusto >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add bozbar &&\n      echo gnusto gnusto >bozbar &&\n      read_tree_twoway $treeH $treeM &&\n@@ -239,7 +281,9 @@ test_expect_success \\\n test_expect_success \\\n     '20 - no local change, use new tree.' \\\n     'rm -f .git/index &&\n-     echo bozbar >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-old >bozbar &&\n      git-update-cache --add bozbar &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >20.out &&\n@@ -249,11 +293,23 @@ test_expect_success \\\n test_expect_success \\\n     '21 - no local change, dirty cache.' \\\n     'rm -f .git/index &&\n-     echo bozbar >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-old >bozbar &&\n      git-update-cache --add bozbar &&\n      echo gnusto gnusto >bozbar &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n \n+# This fails with straight two-way fast forward.\n+test_expect_success \\\n+    '22 - local change cache updated.' \\\n+    'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     sed -e \"s/such as/SUCH AS/\" bozbar-old >bozbar &&\n+     git-update-cache --add bozbar &&\n+     if read_tree_twoway $treeH $treeM; then false; else :; fi'\n+\n # Also make sure we did not break DF vs DF/DF case.\n test_expect_success \\\n     'DF vs DF/DF case setup.' \\\ndiff --git a/t/t1005-read-tree-m-2way-emu23.sh b/t/t1005-read-tree-m-2way-emu23.sh\n--- a/t/t1005-read-tree-m-2way-emu23.sh\n+++ b/t/t1005-read-tree-m-2way-emu23.sh\n@@ -32,7 +32,6 @@ read_tree_twoway () {\n _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n _x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n compare_change () {\n-    \tcat current\n \tsed -n >current \\\n \t    -e '/^--- /d; /^+++ /d; /^@@ /d;' \\\n \t    -e 's/^\\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\\) '\"$_x40\"' /\\1 X /p' \\\n@@ -60,11 +59,22 @@ check_stages () {\n     diff -u expected_stages current_stages\n }\n \n+cat >bozbar-old <<\\EOF\n+This is a sample file used in two-way fast forward merge\n+tests.  Its second line ends with a magic word bozbar\n+which will be modified by the merged head to gnusto.\n+It has some extra lines so that external tools can\n+successfully merge independent changes made to later\n+lines (such as this one), avoiding line conflicts.\n+EOF\n+\n+sed -e 's/bozbar/gnusto (earlier bozbar)/' bozbar-old >bozbar-new\n+\n test_expect_success \\\n     setup \\\n     'echo frotz >frotz &&\n      echo nitfol >nitfol &&\n-     echo bozbar >bozbar &&\n+     cat bozbar-old >bozbar &&\n      echo rezrov >rezrov &&\n      echo yomin >yomin &&\n      git-update-cache --add nitfol bozbar rezrov &&\n@@ -72,7 +82,7 @@ test_expect_success \\\n      echo treeH $treeH &&\n      git-ls-tree $treeH &&\n \n-     echo gnusto >bozbar &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add frotz bozbar --force-remove rezrov &&\n      git-ls-files --stage >M.out &&\n      treeM=`git-write-tree` &&\n@@ -106,6 +116,8 @@ echo '+100644 X 0\tyomin' >expected\n test_expect_success \\\n     '4 - carry forward local addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      git-update-cache --add yomin &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >4.out || exit\n@@ -118,6 +130,8 @@ test_expect_success \\\n test_expect_success \\\n     '5 - carry forward local addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo yomin >yomin &&\n      git-update-cache --add yomin &&\n      echo yomin yomin >yomin &&\n@@ -132,6 +146,8 @@ test_expect_success \\\n test_expect_success \\\n     '6 - local addition already has the same.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      git-update-cache --add frotz &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >6.out &&\n@@ -143,6 +159,8 @@ test_expect_success \\\n test_expect_success \\\n     '7 - local addition already has the same.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz >frotz &&\n      git-update-cache --add frotz &&\n      echo frotz frotz >frotz &&\n@@ -154,6 +172,8 @@ test_expect_success \\\n test_expect_success \\\n     '8 - conflicting addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz frotz >frotz &&\n      git-update-cache --add frotz &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n@@ -161,6 +181,8 @@ test_expect_success \\\n test_expect_success \\\n     '9 - conflicting addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz frotz >frotz &&\n      git-update-cache --add frotz &&\n      echo frotz >frotz &&\n@@ -169,6 +191,8 @@ test_expect_success \\\n test_expect_success \\\n     '10 - path removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      read_tree_twoway $treeH $treeM &&\n@@ -178,6 +202,8 @@ test_expect_success \\\n test_expect_success \\\n     '11 - dirty path removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      echo rezrov rezrov >rezrov &&\n@@ -186,6 +212,8 @@ test_expect_success \\\n test_expect_success \\\n     '12 - unmatching local changes being removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n@@ -193,6 +221,8 @@ test_expect_success \\\n test_expect_success \\\n     '13 - unmatching local changes being removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      echo rezrov >rezrov &&\n@@ -206,6 +236,8 @@ EOF\n test_expect_success \\\n     '14 - unchanged in two heads.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo nitfol nitfol >nitfol &&\n      git-update-cache --add nitfol &&\n      read_tree_twoway $treeH $treeM &&\n@@ -217,6 +249,8 @@ test_expect_success \\\n test_expect_success \\\n     '15 - unchanged in two heads.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo nitfol nitfol >nitfol &&\n      git-update-cache --add nitfol &&\n      echo nitfol nitfol nitfol >nitfol &&\n@@ -233,6 +267,8 @@ test_expect_success \\\n test_expect_success \\\n     '16 - conflicting local change.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo bozbar bozbar >bozbar &&\n      git-update-cache --add bozbar &&\n      git-read-tree --emu23 $treeH $treeM &&\n@@ -249,6 +285,8 @@ EOF\n test_expect_success \\\n     '17 - conflicting local change.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo bozbar bozbar >bozbar &&\n      git-update-cache --add bozbar &&\n      echo bozbar bozbar bozbar >bozbar &&\n@@ -257,7 +295,9 @@ test_expect_success \\\n test_expect_success \\\n     '18 - local change already having a good result.' \\\n     'rm -f .git/index &&\n-     echo gnusto >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add bozbar &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >18.out &&\n@@ -267,7 +307,9 @@ test_expect_success \\\n test_expect_success \\\n     '19 - local change already having a good result, further modified.' \\\n     'rm -f .git/index &&\n-     echo gnusto >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add bozbar &&\n      echo gnusto gnusto >bozbar &&\n      read_tree_twoway $treeH $treeM &&\n@@ -278,7 +320,9 @@ test_expect_success \\\n test_expect_success \\\n     '20 - no local change, use new tree.' \\\n     'rm -f .git/index &&\n-     echo bozbar >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-old >bozbar &&\n      git-update-cache --add bozbar &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >20.out &&\n@@ -288,11 +332,31 @@ test_expect_success \\\n test_expect_success \\\n     '21 - no local change, dirty cache.' \\\n     'rm -f .git/index &&\n-     echo bozbar >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-old >bozbar &&\n      git-update-cache --add bozbar &&\n      echo gnusto gnusto >bozbar &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n \n+echo '-100644 X 0\tbozbar\n++100644 X 0\tbozbar' >expected\n+\n+# This fails with straight two-way fast forward, but emu23\n+# can merge them.\n+test_expect_success \\\n+    '22 - local change cache updated.' \\\n+    'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     sed -e \"s/such as/SUCH AS/\" bozbar-old >bozbar &&\n+     git-update-cache --add bozbar &&\n+     read_tree_twoway $treeH $treeM &&\n+     git-ls-files --stage >22.out || exit\n+     diff -u M.out 22.out >22diff.out\n+     compare_change 22diff.out &&\n+     check_cache_at bozbar clean'\n+\n # Also make sure we did not break DF vs DF/DF case.\n test_expect_success \\\n     'DF vs DF/DF case setup.' \\\n@@ -324,4 +388,20 @@ test_expect_success \\\n      check_cache_at DF/DF clean && # different from pure 2-way\n      :'\n \n+# Emu23 can grok I having more than H.  Make sure we did not\n+# botch the conflict tests (Linus code botches this test).\n+test_expect_success \\\n+    'DF vs DF/DF case test (#2).' \\\n+    'rm -f .git/index &&\n+     rm -fr DF &&\n+     mkdir DF &&\n+     echo DF/DF >DF/DF &&\n+     git-update-cache --add DF/DF &&\n+     # This should fail because I and H have a conflict\n+     # at DF.\n+     if git-read-tree --emu23 $treeDF $treeDFDF\n+     then true  ;# should be false\n+     else false ;# should be true\n+     fi'\n+\n test_done\n------------\n\n"},{"id":"5245","messageId":"7vvf439vdl.fsf@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vaclgfynv.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH 2/2] Fix oversimplified optimization for add_cache_entry().","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-24T23:40:22Z","receivedAt":"2005-06-24T23:40:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"An earlier change to optimize directory-file conflict check\nbroke what \"read-tree --emu23\" expects.  Introduce an explicit\nflag to tell add_cache_entry() not to check for conflicts and\nuse it when reading an existing tree into an empty stage ---\nby definition this case can never introduce such conflicts.\n\nResurrect the unoptimized directory-file conflict check code for\nnow as well.  The new one did not handle higher stages properly.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n cache.h                           |    1 \n read-cache.c                      |  177 +++++++++++++++++++------------------\n t/t1005-read-tree-m-2way-emu23.sh |    6 +\n tree.c                            |    2 \n 4 files changed, 95 insertions(+), 91 deletions(-)\n\ncb13405368b0132ec3b3edcda22d32d89e9c1f85\ndiff --git a/cache.h b/cache.h\n--- a/cache.h\n+++ b/cache.h\n@@ -130,6 +130,7 @@ extern int write_cache(int newfd, struct\n extern int cache_name_pos(const char *name, int namelen);\n #define ADD_CACHE_OK_TO_ADD 1\t\t/* Ok to add */\n #define ADD_CACHE_OK_TO_REPLACE 2\t/* Ok to replace file/directory */\n+#define ADD_CACHE_SKIP_DF_CHECK 4\t/* Ok to skip directory/file conflict checks */\n extern int add_cache_entry(struct cache_entry *ce, int option);\n extern int remove_cache_entry_at(int pos);\n extern int remove_file_from_cache(char *path);\ndiff --git a/read-cache.c b/read-cache.c\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -171,83 +171,6 @@ int ce_same_name(struct cache_entry *a, \n \treturn ce_namelen(b) == len && !memcmp(a->name, b->name, len);\n }\n \n-/*\n- * Do we have another file that has the beginning components being a\n- * proper superset of the name we're trying to add?\n- */\n-static int has_file_name(const struct cache_entry *ce, int pos, int ok_to_replace)\n-{\n-\tint retval = 0;\n-\tint len = ce_namelen(ce);\n-\tconst char *name = ce->name;\n-\n-\twhile (pos < active_nr) {\n-\t\tstruct cache_entry *p = active_cache[pos++];\n-\n-\t\tif (len >= ce_namelen(p))\n-\t\t\tbreak;\n-\t\tif (memcmp(name, p->name, len))\n-\t\t\tbreak;\n-\t\tif (p->name[len] != '/')\n-\t\t\tcontinue;\n-\t\tretval = -1;\n-\t\tif (!ok_to_replace)\n-\t\t\tbreak;\n-\t\tremove_cache_entry_at(--pos);\n-\t}\n-\treturn retval;\n-}\n-\n-/*\n- * Do we have another file with a pathname that is a proper\n- * subset of the name we're trying to add?\n- */\n-static int has_dir_name(const struct cache_entry *ce, int pos, int ok_to_replace)\n-{\n-\tint retval = 0;\n-\tconst char *name = ce->name;\n-\tconst char *slash = name + ce_namelen(ce);\n-\n-\tfor (;;) {\n-\t\tint len;\n-\n-\t\tfor (;;) {\n-\t\t\tif (*--slash == '/')\n-\t\t\t\tbreak;\n-\t\t\tif (slash <= ce->name)\n-\t\t\t\treturn retval;\n-\t\t}\n-\t\tlen = slash - name;\n-\n-\t\tpos = cache_name_pos(name, len);\n-\t\tif (pos >= 0) {\n-\t\t\tretval = -1;\n-\t\t\tif (ok_to_replace)\n-\t\t\t\tbreak;\n-\t\t\tremove_cache_entry_at(pos);\n-\t\t\tcontinue;\n-\t\t}\n-\n-\t\t/*\n-\t\t * Trivial optimization: if we find an entry that\n-\t\t * already matches the sub-directory, then we know\n-\t\t * we're ok, and we can exit\n-\t\t */\n-\t\tpos = -pos-1;\n-\t\tif (pos < active_nr) {\n-\t\t\tstruct cache_entry *p = active_cache[pos];\n-\t\t\tif (ce_namelen(p) <= len)\n-\t\t\t\tcontinue;\n-\t\t\tif (p->name[len] != '/')\n-\t\t\t\tcontinue;\n-\t\t\tif (memcmp(p->name, name, len))\n-\t\t\t\tcontinue;\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\treturn retval;\n-}\n-\n /* We may be in a situation where we already have path/file and path\n  * is being added, or we already have path and path/file is being\n  * added.  Either one would result in a nonsense tree that has path\n@@ -257,19 +180,98 @@ static int has_dir_name(const struct cac\n  * from the cache so the caller should recompute the insert position.\n  * When this happens, we return non-zero.\n  */\n-static int check_file_directory_conflict(const struct cache_entry *ce, int pos, int ok_to_replace)\n+static int check_file_directory_conflict(const struct cache_entry *ce,\n+\t\t\t\t\t int ok_to_replace)\n {\n+\tint pos, replaced = 0;\n+\tconst char *path = ce->name;\n+\tint namelen = strlen(path);\n+\tint stage = ce_stage(ce);\n+\tchar *pathbuf = xmalloc(namelen + 1);\n+\tchar *cp;\n+\n+\tmemcpy(pathbuf, path, namelen + 1);\n+\n \t/*\n-\t * We check if the path is a sub-path of a subsequent pathname\n-\t * first, since removing those will not change the position\n-\t * in the array\n+\t * We are inserting path/file.  Do they have path registered at\n+\t * the same stage?  We need to do this for all the levels of our\n+\t * subpath.\n \t */\n-\tint retval = has_file_name(ce, pos, ok_to_replace);\n-\t/*\n-\t * Then check if the path might have a clashing sub-directory\n-\t * before it.\n+\tcp = pathbuf;\n+\twhile (1) {\n+\t\tchar *ep = strchr(cp, '/');\n+\t\tint len;\n+\t\tif (!ep)\n+\t\t\tbreak;\n+\t\t*ep = 0;    /* first cut it at slash */\n+\t\tlen = ep - pathbuf;\n+\t\tpos = cache_name_pos(pathbuf,\n+\t\t\t\t     ntohs(create_ce_flags(len, stage)));\n+\t\tif (0 <= pos) {\n+\t\t\t/* Our leading path component is registered as a file,\n+\t\t\t * and we are trying to make it a directory.  This is\n+\t\t\t * bad.\n+\t\t\t */\n+\t\t\tif (!ok_to_replace) {\n+\t\t\t\tfree(pathbuf);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tfprintf(stderr, \"removing file '%s' to replace it with a directory to create '%s'.\\n\", pathbuf, path);\n+\t\t\tremove_cache_entry_at(pos);\n+\t\t\treplaced = 1;\n+\t\t}\n+\t\t*ep = '/';  /* then restore it and go downwards */\n+\t\tcp = ep + 1;\n+\t}\n+\tfree(pathbuf);\n+\n+\t/* Do we have an entry in the cache that makes our path a prefix\n+\t * of it?  That is, are we creating a file where they already expect\n+\t * a directory there?\n+\t */\n+\tpos = cache_name_pos(path,\n+\t\t\t     ntohs(create_ce_flags(namelen, stage)));\n+\n+\t/* (0 <= pos) cannot happen because add_cache_entry()\n+\t * should have taken care of that case.\n+\t */\n+\tpos = -pos-1;\n+\n+\t/* pos would point at an existing entry that would come immediately\n+\t * after our path.  It could be the same as our path in higher stage,\n+\t * or different path but in a lower stage.\n+\t *\n+\t * E.g. when we are inserting path at stage 2,\n+\t *\n+\t *        1 path\n+\t * pos->  3 path\n+\t *        2 path/file1\n+\t *        3 path/file1\n+\t *        2 path/file2\n+\t *        2 patho\n+\t *\n+\t * We need to examine pos, ignore it because it is at different\n+\t * stage, examine next to find the path/file at stage 2, and\n+\t * complain.  We need to do this until we are not the leading\n+\t * path of an existing entry anymore.\n \t */\n-\treturn retval + has_dir_name(ce, pos, ok_to_replace);\n+\n+\twhile (pos < active_nr) {\n+\t\tstruct cache_entry *other = active_cache[pos];\n+\t\tif (strncmp(other->name, path, namelen))\n+\t\t\tbreak; /* it is not our \"subdirectory\" anymore */\n+\t\tif ((ce_stage(other) == stage) &&\n+\t\t    other->name[namelen] == '/') {\n+\t\t\tif (!ok_to_replace)\n+\t\t\t\treturn -1;\n+\t\t\tfprintf(stderr, \"removing file '%s' under '%s' to be replaced with a file\\n\", other->name, path);\n+\t\t\tremove_cache_entry_at(pos);\n+\t\t\treplaced = 1;\n+\t\t\tcontinue; /* cycle without updating pos */\n+\t\t}\n+\t\tpos++;\n+\t}\n+\treturn replaced;\n }\n \n int add_cache_entry(struct cache_entry *ce, int option)\n@@ -277,6 +279,7 @@ int add_cache_entry(struct cache_entry *\n \tint pos;\n \tint ok_to_add = option & ADD_CACHE_OK_TO_ADD;\n \tint ok_to_replace = option & ADD_CACHE_OK_TO_REPLACE;\n+\tint skip_df_check = option & ADD_CACHE_SKIP_DF_CHECK;\n \tpos = cache_name_pos(ce->name, ntohs(ce->ce_flags));\n \n \t/* existing match? Just replace it */\n@@ -302,7 +305,7 @@ int add_cache_entry(struct cache_entry *\n \tif (!ok_to_add)\n \t\treturn -1;\n \n-\tif (!ce_stage(ce) && check_file_directory_conflict(ce, pos, ok_to_replace)) {\n+\tif (!skip_df_check && check_file_directory_conflict(ce, ok_to_replace)) {\n \t\tif (!ok_to_replace)\n \t\t\treturn -1;\n \t\tpos = cache_name_pos(ce->name, ntohs(ce->ce_flags));\ndiff --git a/t/t1005-read-tree-m-2way-emu23.sh b/t/t1005-read-tree-m-2way-emu23.sh\n--- a/t/t1005-read-tree-m-2way-emu23.sh\n+++ b/t/t1005-read-tree-m-2way-emu23.sh\n@@ -389,7 +389,7 @@ test_expect_success \\\n      :'\n \n # Emu23 can grok I having more than H.  Make sure we did not\n-# botch the conflict tests (Linus code botches this test).\n+# botch the conflict tests (fixed).\n test_expect_success \\\n     'DF vs DF/DF case test (#2).' \\\n     'rm -f .git/index &&\n@@ -400,8 +400,8 @@ test_expect_success \\\n      # This should fail because I and H have a conflict\n      # at DF.\n      if git-read-tree --emu23 $treeDF $treeDFDF\n-     then true  ;# should be false\n-     else false ;# should be true\n+     then false\n+     else true\n      fi'\n \n test_done\ndiff --git a/tree.c b/tree.c\n--- a/tree.c\n+++ b/tree.c\n@@ -18,7 +18,7 @@ static int read_one_entry(unsigned char \n \tmemcpy(ce->name, base, baselen);\n \tmemcpy(ce->name + baselen, pathname, len+1);\n \tmemcpy(ce->sha1, sha1, 20);\n-\treturn add_cache_entry(ce, ADD_CACHE_OK_TO_ADD);\n+\treturn add_cache_entry(ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_SKIP_DF_CHECK);\n }\n \n static int read_tree_recursive(void *buffer, unsigned long size,\n------------\n\n"},{"id":"5246","messageId":"Pine.LNX.4.58.0506241755280.11175@ppc970.osdl.org","threadId":"1015","inReplyTo":"7vvf439vdl.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 2/2] Fix oversimplified optimization for add_cache_entry().","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-06-25T00:57:24Z","receivedAt":"2005-06-25T00:57:24Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 24 Jun 2005, Junio C Hamano wrote:\n> \n> Resurrect the unoptimized directory-file conflict check code for\n> now as well.  The new one did not handle higher stages properly.\n\nI really don't want to do this. \n\nCan you fix the \"optimized\" one instead? Currently the only \"optimization\"  \nis really to just not call it for any non-stage0 thing, the real advantage\nis that the old code was totally unreadable and did everything in one big \nthing. \n\nI'm ok with dropping the optimization, but I don't want to lose the \ncleanup of splitting that horrible old function into two.\n\n\t\tLinus\n"},{"id":"5248","messageId":"7vaclf6tw7.fsf@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"Pine.LNX.4.58.0506241755280.11175@ppc970.osdl.org","subject":"Re: [PATCH 2/2] Fix oversimplified optimization for add_cache_entry().","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-25T02:40:40Z","receivedAt":"2005-06-25T02:40:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n\nLT> I really don't want to do this. \nLT> Can you fix the \"optimized\" one instead?\n\nWill do.\n\n"},{"id":"5258","messageId":"7vmzpe4x08.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vaclf6tw7.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH 0/9] Fix oversimplified optimization for add_cache_entry().","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-25T09:16:23Z","receivedAt":"2005-06-25T09:16:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"JCH\" == Junio C Hamano <junkio@cox.net> writes:\n\n>>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\nLT> I really don't want to do this. \nLT> Can you fix the \"optimized\" one instead?\n\nJCH> Will do.\n\nI have this list which logically consists of three sets.  I am\nusing the new \"git rebase\" to maintain it and your not taking my\npatch stream gave me a good opportunity to test it ;-).\n\n  [PATCH 1/9] [RFC] fix date parsing for GIT raw commit timestamp format.\n  [PATCH 2/9] git-commit-script: get commit message from an existing one.\n  [PATCH 3/9] git-cherry: find commits not merged upstream.\n  [PATCH 4/9] git-rebase-script: rebase local commits to new upstream head.\n\nThese four are updated \"git rebase\" I've written while on-road\nwithout knowing about your git-patch-id; the updated one uses\ngit-patch-id to identify which are merged and which are not.\n\nTo carry earlier commit datetime forward, date.c needs to be\nfixed (PATCH 1/9, which I sent you separately Friday), and\nenhancing git-commit-script to be able to specify an existing\ncommit to slurp the commit message (and author & date\ninformation) was necessary (well, not strictly necessary, but\nthat is the way I am used to, which is stolen from JIT), which\nis PATCH 2/9.  PATCH 3/9 and PATCH 4/9 use git-patch-id to\nimplement the cherrypick/rebase.\n\n  [PATCH 5/9] Add more tests for read-tree --emu23.\n  [PATCH 6/9] git-merge-one-file-script: do not misinterpret rm failure\n  [PATCH 7/9] Fix oversimplified optimization for add_cache_entry().\n\nThese three are reworked D/F conflict fix.  PATCH 5/9 is the\nsame demonstration of what is broken in the current code.  The\nproblem fixed by PATCH 6/9 was discovered while I was trying out\nthe fixes.  PATCH 7/9 teaches your \"optimized\" has_file/has_dir\nimplementation to honor stages while they operate.\n\n  [PATCH 8/9] http-pull: documentation updates.\n  [PATCH 9/9] Add a bit of developer documentation to pull.h\n\nThese are resend.\n\n"},{"id":"5259","messageId":"7vfyv64ws3.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vmzpe4x08.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 1/9] fix date parsing for GIT raw commit timestamp format.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-25T09:21:16Z","receivedAt":"2005-06-25T09:21:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Usually all of the match_xxx routines in date.c fill tm\nstructure assuming that the parsed string talks about local\ntime, and parse_date routine compensates for it by adjusting the\nvalue with tz offset parsed out separately.  However, this logic\ndoes not work well when we feed GIT raw commit timestamp to it,\nbecause what match_digits gets is already in GMT.\n\nA good testcase is:\n\n    $ make test-date\n    $ ./test-date 'Fri Jun 24 16:55:27 2005 -0700' '1119657327 -0700'\n\nThese two timestamps represent the same time, but the second one\nwithout the fix this commit introduces gives you 7 hours off.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n date.c |   14 +++++++++-----\n 1 files changed, 9 insertions(+), 5 deletions(-)\n\ndff2db477c3d450350a0dfdce4fa3f9543206b86\ndiff --git a/date.c b/date.c\n--- a/date.c\n+++ b/date.c\n@@ -270,7 +270,7 @@ static int match_multi_number(unsigned l\n /*\n  * We've seen a digit. Time? Year? Date? \n  */\n-static int match_digit(char *date, struct tm *tm, int *offset)\n+static int match_digit(char *date, struct tm *tm, int *offset, int *tm_gmt)\n {\n \tint n;\n \tchar *end;\n@@ -283,8 +283,10 @@ static int match_digit(char *date, struc\n \t */\n \tif (num > 946684800) {\n \t\ttime_t time = num;\n-\t\tif (gmtime_r(&time, tm))\n+\t\tif (gmtime_r(&time, tm)) {\n+\t\t\t*tm_gmt = 1;\n \t\t\treturn end - date;\n+\t\t}\n \t}\n \n \t/*\n@@ -389,7 +391,7 @@ static int match_tz(char *date, int *off\n void parse_date(char *date, char *result, int maxlen)\n {\n \tstruct tm tm;\n-\tint offset, sign;\n+\tint offset, sign, tm_gmt;\n \ttime_t then;\n \n \tmemset(&tm, 0, sizeof(tm));\n@@ -398,6 +400,7 @@ void parse_date(char *date, char *result\n \ttm.tm_mday = -1;\n \ttm.tm_isdst = -1;\n \toffset = -1;\n+\ttm_gmt = 0;\n \n \tfor (;;) {\n \t\tint match = 0;\n@@ -410,7 +413,7 @@ void parse_date(char *date, char *result\n \t\tif (isalpha(c))\n \t\t\tmatch = match_alpha(date, &tm, &offset);\n \t\telse if (isdigit(c))\n-\t\t\tmatch = match_digit(date, &tm, &offset);\n+\t\t\tmatch = match_digit(date, &tm, &offset, &tm_gmt);\n \t\telse if ((c == '-' || c == '+') && isdigit(date[1]))\n \t\t\tmatch = match_tz(date, &offset);\n \n@@ -430,7 +433,8 @@ void parse_date(char *date, char *result\n \tif (then == -1)\n \t\treturn;\n \n-\tthen -= offset * 60;\n+\tif (!tm_gmt)\n+\t\tthen -= offset * 60;\n \n \tsign = '+';\n \tif (offset < 0) {\n------------\n\n"},{"id":"5260","messageId":"7vacle4wqq.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vmzpe4x08.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 2/9] git-commit-script: get commit message from an existing one.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-25T09:22:05Z","receivedAt":"2005-06-25T09:22:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"With -m flag specified, git-commit-script takes the commit\nmessage along with author information from an existing commit.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n git-commit-script |   75 +++++++++++++++++++++++++++++++++++++++++++++++------\n 1 files changed, 67 insertions(+), 8 deletions(-)\n\nda2ff8148a94b982c7ee369d5a37c4d20e8dd2a4\ndiff --git a/git-commit-script b/git-commit-script\n--- a/git-commit-script\n+++ b/git-commit-script\n@@ -1,12 +1,37 @@\n #!/bin/sh\n+#\n+# Copyright (c) 2005 Linus Torvalds\n+#\n+\n+usage () {\n+    echo 'git commit [-m existing-commit] [<path>...]'\n+    exit 1\n+}\n+\n : ${GIT_DIR=.git}\n-if [ ! -d $GIT_DIR ]; then\n+if [ ! -d \"$GIT_DIR\" ]; then\n \techo Not a git directory 1>&2\n \texit 1\n fi\n+while case \"$#\" in 0) break ;; esac\n+do\n+    case \"$1\" in\n+    -m) shift\n+        case \"$#\" in\n+\t0) usage ;;\n+\t*) use_commit=`git-rev-parse \"$1\"` ||\n+\t   exit ;;\n+\tesac\n+\t;;\n+    *)  break\n+        ;;\n+    esac\n+    shift\n+done\n+\n git-update-cache -q --refresh -- \"$@\" || exit 1\n PARENTS=\"-p HEAD\"\n-if [ ! -r $GIT_DIR/HEAD ]; then\n+if [ ! -r \"$GIT_DIR/HEAD\" ]; then\n \tif [ -z \"$(git-ls-files)\" ]; then\n \t\techo Nothing to commit 1>&2\n \t\texit 1\n@@ -20,7 +45,7 @@ if [ ! -r $GIT_DIR/HEAD ]; then\n \t) > .editmsg\n \tPARENTS=\"\"\n else\n-\tif [ -f $GIT_DIR/MERGE_HEAD ]; then\n+\tif [ -f \"$GIT_DIR/MERGE_HEAD\" ]; then\n \t\techo \"#\"\n \t\techo \"# It looks like your may be committing a MERGE.\"\n \t\techo \"# If this is not correct, please remove the file\"\n@@ -28,8 +53,38 @@ else\n \t\techo \"# and try again\"\n \t\techo \"#\"\n \t\tPARENTS=\"-p HEAD -p MERGE_HEAD\"\n-\tfi > .editmsg\n-\tgit-status-script >> .editmsg\n+\telif test \"$use_commit\" != \"\"\n+\tthen\n+\t\tpick_author_script='\n+\t\t/^author /{\n+\t\t\th\n+\t\t\ts/^author \\([^<]*\\) <[^>]*> .*$/\\1/\n+\t\t\ts/'\\''/'\\''\\'\\'\\''/g\n+\t\t\ts/.*/GIT_AUTHOR_NAME='\\''&'\\''/p\n+\n+\t\t\tg\n+\t\t\ts/^author [^<]* <\\([^>]*\\)> .*$/\\1/\n+\t\t\ts/'\\''/'\\''\\'\\'\\''/g\n+\t\t\ts/.*/GIT_AUTHOR_EMAIL='\\''&'\\''/p\n+\n+\t\t\tg\n+\t\t\ts/^author [^<]* <[^>]*> \\(.*\\)$/\\1/\n+\t\t\ts/'\\''/'\\''\\'\\'\\''/g\n+\t\t\ts/.*/GIT_AUTHOR_DATE='\\''&'\\''/p\n+\n+\t\t\tq\n+\t\t}\n+\t\t'\n+\t\tset_author_env=`git-cat-file commit \"$use_commit\" |\n+\t\tsed -ne \"$pick_author_script\"`\n+\t\teval \"$set_author_env\"\n+\t\texport GIT_AUTHOR_NAME\n+\t\texport GIT_AUTHOR_EMAIL\n+\t\texport GIT_AUTHOR_DATE\n+\t\tgit-cat-file commit \"$use_commit\" |\n+\t\tsed -e '1,/^$/d'\n+\tfi >.editmsg\n+\tgit-status-script >>.editmsg\n fi\n if [ \"$?\" != \"0\" ]\n then\n@@ -37,13 +92,17 @@ then\n \trm .editmsg\n \texit 1\n fi\n-${VISUAL:-${EDITOR:-vi}} .editmsg\n+case \"$use_commit\" in\n+'')\n+\t${VISUAL:-${EDITOR:-vi}} .editmsg\n+\t;;\n+esac\n grep -v '^#' < .editmsg | git-stripspace > .cmitmsg\n [ -s .cmitmsg ] && \n \ttree=$(git-write-tree) &&\n \tcommit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) &&\n-\techo $commit > $GIT_DIR/HEAD &&\n-\trm -f -- $GIT_DIR/MERGE_HEAD\n+\techo $commit > \"$GIT_DIR/HEAD\" &&\n+\trm -f -- \"$GIT_DIR/MERGE_HEAD\"\n ret=\"$?\"\n rm -f .cmitmsg .editmsg\n exit \"$ret\"\n------------\n\n"},{"id":"5261","messageId":"7v3br64wp8.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vmzpe4x08.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 3/9] git-cherry: find commits not merged upstream.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-25T09:22:59Z","receivedAt":"2005-06-25T09:22:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The git-cherry command helps the git-rebase script by finding\ncommits that have not been merged upstream.  Commits already\nincluded in upstream are prefixed with '-' (meaning \"drop from\nmy local pull\"), while commits missing from upstream are\nprefixed with '+' (meaning \"add to the updated upstream\").\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n Makefile   |    2 +\n git-cherry |   86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 87 insertions(+), 1 deletions(-)\n create mode 100755 git-cherry\n\n350e3957925c9b4404977bbd6f65bf68ba28d26f\ndiff --git a/Makefile b/Makefile\n--- a/Makefile\n+++ b/Makefile\n@@ -25,7 +25,7 @@ SCRIPTS=git git-apply-patch-script git-m\n \tgit-deltafy-script git-fetch-script git-status-script git-commit-script \\\n \tgit-log-script git-shortlog git-cvsimport-script git-diff-script \\\n \tgit-reset-script git-add-script git-checkout-script git-clone-script \\\n-\tgitk\n+\tgitk git-cherry\n \n PROG=   git-update-cache git-diff-files git-init-db git-write-tree \\\n \tgit-read-tree git-commit-tree git-cat-file git-fsck-cache \\\ndiff --git a/git-cherry b/git-cherry\nnew file mode 100755\n--- /dev/null\n+++ b/git-cherry\n@@ -0,0 +1,86 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2005 Junio C Hamano.\n+#\n+\n+usage=\"usage: $0 \"'<upstream> [<head>]\n+\n+             __*__*__*__*__> <upstream>\n+            /\n+  fork-point\n+            \\__+__+__+__+__+__+__+__> <head>\n+\n+Each commit between the fork-point and <head> is examined, and\n+compared against the change each commit between the fork-point and\n+<upstream> introduces.  If the change does not seem to be in the\n+upstream, it is shown on the standard output.\n+\n+The output is intended to be used as:\n+\n+    OLD_HEAD=$(git-rev-parse HEAD)\n+    git-rev-parse linus >${GIT_DIR-.}/HEAD\n+    git-cherry linus OLD_HEAD |\n+    while read commit\n+    do\n+        GIT_EXTERNAL_DIFF=git-apply-patch-script git-diff-tree -p \"$commit\" &&\n+\tgit-commit-script -m \"$commit\"\n+    done\n+'\n+\n+case \"$#\" in\n+1) linus=`git-rev-parse \"$1\"` &&\n+   junio=`git-rev-parse HEAD` || exit\n+   ;;\n+2) linus=`git-rev-parse \"$1\"` &&\n+   junio=`git-rev-parse \"$2\"` || exit\n+   ;;\n+*) echo >&2 \"$usage\"; exit 1 ;;\n+esac\n+\n+# Note that these list commits in reverse order;\n+# not that the order in inup matters...\n+inup=`git-rev-list ^$junio $linus` &&\n+ours=`git-rev-list $junio ^$linus` || exit\n+\n+tmp=.cherry-tmp$$\n+patch=$tmp-patch\n+mkdir $patch\n+trap \"rm -rf $tmp-*\" 0 1 2 3 15\n+\n+_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n+_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n+\n+for c in $inup\n+do\n+\tgit-diff-tree -p $c\n+done | git-patch-id |\n+while read id name\n+do\n+\techo $name >>$patch/$id\n+done\n+\n+LF='\n+'\n+\n+O=\n+for c in $ours\n+do\n+\tset x `git-diff-tree -p $c | git-patch-id`\n+\tif test \"$2\" != \"\"\n+\tthen\n+\t\tif test -f \"$patch/$2\"\n+\t\tthen\n+\t\t\tsign=-\n+\t\telse\n+\t\t\tsign=+\n+\t\tfi\n+\t\tcase \"$O\" in\n+\t\t'')\tO=\"$sign $c\" ;;\n+\t\t*)\tO=\"$sign $c$LF$O\" ;;\n+\t\tesac\n+\tfi\n+done\n+case \"$O\" in\n+'') ;;\n+*)  echo \"$O\" ;;\n+esac\n------------\n\n"},{"id":"5262","messageId":"7vwtoi3i3k.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vmzpe4x08.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 4/9] git-rebase-script: rebase local commits to new upstream head.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-25T09:23:43Z","receivedAt":"2005-06-25T09:23:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Using git-cherry, forward port local commits missing from the\nnew upstream head.  This also depends on \"-m\" flag support in\ngit-commit-script.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n Makefile          |    2 +-\n git-rebase-script |   49 +++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 50 insertions(+), 1 deletions(-)\n create mode 100755 git-rebase-script\n\n39830aca0319e04ed6c45203614543418974f877\ndiff --git a/Makefile b/Makefile\n--- a/Makefile\n+++ b/Makefile\n@@ -25,7 +25,7 @@ SCRIPTS=git git-apply-patch-script git-m\n \tgit-deltafy-script git-fetch-script git-status-script git-commit-script \\\n \tgit-log-script git-shortlog git-cvsimport-script git-diff-script \\\n \tgit-reset-script git-add-script git-checkout-script git-clone-script \\\n-\tgitk git-cherry\n+\tgitk git-cherry git-rebase-script\n \n PROG=   git-update-cache git-diff-files git-init-db git-write-tree \\\n \tgit-read-tree git-commit-tree git-cat-file git-fsck-cache \\\ndiff --git a/git-rebase-script b/git-rebase-script\nnew file mode 100755\n--- /dev/null\n+++ b/git-rebase-script\n@@ -0,0 +1,49 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2005 Junio C Hamano.\n+#\n+\n+usage=\"usage: $0 \"'<upstream> [<head>]\n+\n+Uses output from git-cherry to rebase local commits to the new head of\n+upstream tree.'\n+\n+: ${GIT_DIR=.git}\n+\n+case \"$#\" in\n+1) linus=`git-rev-parse \"$1\"` &&\n+   junio=`git-rev-parse HEAD` || exit\n+   ;;\n+2) linus=`git-rev-parse \"$1\"` &&\n+   junio=`git-rev-parse \"$2\"` || exit\n+   ;;\n+*) echo >&2 \"$usage\"; exit 1 ;;\n+esac\n+\n+git-read-tree -m -u $junio $linus &&\n+echo \"$linus\" >\"$GIT_DIR/HEAD\" || exit\n+\n+tmp=.rebase-tmp$$\n+fail=$tmp-fail\n+trap \"rm -rf $tmp-*\" 0 1 2 3 15\n+\n+>$fail\n+\n+git-cherry $linus $junio |\n+while read sign commit\n+do\n+\tcase \"$sign\" in\n+\t-) continue ;;\n+\tesac\n+\tS=`cat \"$GIT_DIR/HEAD\"` &&\n+        GIT_EXTERNAL_DIFF=git-apply-patch-script git-diff-tree -p $commit &&\n+\tgit-commit-script -m \"$commit\" || {\n+\t\techo $commit >>$fail\n+\t\tgit-read-tree --reset -u $S\n+\t}\n+done\n+if test -s $fail\n+then\n+\techo Some commits could not be rebased, check by hand:\n+\tcat $fail\n+fi\n------------\n\n"},{"id":"5266","messageId":"7vr7eq3i2n.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vmzpe4x08.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 5/9] Add more tests for read-tree --emu23.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-25T09:24:16Z","receivedAt":"2005-06-25T09:24:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This adds more tests for --emu23.  One is to show how it can\ncarry forward more local changes than the straightforward\ntwo-way fast forward, and another is to show the recent\novereager optimization of directory/file conflict check broke\nthings, which will be fixed in the next commit.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n t/t1001-read-tree-m-2way.sh       |   70 +++++++++++++++++++++++++---\n t/t1005-read-tree-m-2way-emu23.sh |   94 ++++++++++++++++++++++++++++++++++---\n 2 files changed, 150 insertions(+), 14 deletions(-)\n\n633115eb1338884fd9488fe57ef4ea2fb91559d5\ndiff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh\n--- a/t/t1001-read-tree-m-2way.sh\n+++ b/t/t1001-read-tree-m-2way.sh\n@@ -29,7 +29,6 @@ read_tree_twoway () {\n _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n _x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n compare_change () {\n-    \tcat current\n \tsed -n >current \\\n \t    -e '/^--- /d; /^+++ /d; /^@@ /d;' \\\n \t    -e 's/^\\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\\) '\"$_x40\"' /\\1 X /p' \\\n@@ -51,11 +50,22 @@ check_cache_at () {\n \tesac\n }\n \n+cat >bozbar-old <<\\EOF\n+This is a sample file used in two-way fast forward merge\n+tests.  Its second line ends with a magic word bozbar\n+which will be modified by the merged head to gnusto.\n+It has some extra lines so that external tools can\n+successfully merge independent changes made to later\n+lines (such as this one), avoiding line conflicts.\n+EOF\n+\n+sed -e 's/bozbar/gnusto (earlier bozbar)/' bozbar-old >bozbar-new\n+\n test_expect_success \\\n     setup \\\n     'echo frotz >frotz &&\n      echo nitfol >nitfol &&\n-     echo bozbar >bozbar &&\n+     cat bozbar-old >bozbar &&\n      echo rezrov >rezrov &&\n      echo yomin >yomin &&\n      git-update-cache --add nitfol bozbar rezrov &&\n@@ -63,7 +73,7 @@ test_expect_success \\\n      echo treeH $treeH &&\n      git-ls-tree $treeH &&\n \n-     echo gnusto >bozbar &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add frotz bozbar --force-remove rezrov &&\n      git-ls-files --stage >M.out &&\n      treeM=`git-write-tree` &&\n@@ -86,6 +96,8 @@ echo '+100644 X 0\tyomin' >expected\n test_expect_success \\\n     '4 - carry forward local addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      git-update-cache --add yomin &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >4.out || exit\n@@ -96,6 +108,8 @@ test_expect_success \\\n test_expect_success \\\n     '5 - carry forward local addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo yomin >yomin &&\n      git-update-cache --add yomin &&\n      echo yomin yomin >yomin &&\n@@ -108,6 +122,8 @@ test_expect_success \\\n test_expect_success \\\n     '6 - local addition already has the same.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      git-update-cache --add frotz &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >6.out &&\n@@ -117,6 +133,8 @@ test_expect_success \\\n test_expect_success \\\n     '7 - local addition already has the same.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz >frotz &&\n      git-update-cache --add frotz &&\n      echo frotz frotz >frotz &&\n@@ -128,6 +146,8 @@ test_expect_success \\\n test_expect_success \\\n     '8 - conflicting addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz frotz >frotz &&\n      git-update-cache --add frotz &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n@@ -135,6 +155,8 @@ test_expect_success \\\n test_expect_success \\\n     '9 - conflicting addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz frotz >frotz &&\n      git-update-cache --add frotz &&\n      echo frotz >frotz &&\n@@ -143,6 +165,8 @@ test_expect_success \\\n test_expect_success \\\n     '10 - path removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      read_tree_twoway $treeH $treeM &&\n@@ -152,6 +176,8 @@ test_expect_success \\\n test_expect_success \\\n     '11 - dirty path removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      echo rezrov rezrov >rezrov &&\n@@ -160,6 +186,8 @@ test_expect_success \\\n test_expect_success \\\n     '12 - unmatching local changes being removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n@@ -167,6 +195,8 @@ test_expect_success \\\n test_expect_success \\\n     '13 - unmatching local changes being removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      echo rezrov >rezrov &&\n@@ -180,6 +210,8 @@ EOF\n test_expect_success \\\n     '14 - unchanged in two heads.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo nitfol nitfol >nitfol &&\n      git-update-cache --add nitfol &&\n      read_tree_twoway $treeH $treeM &&\n@@ -191,6 +223,8 @@ test_expect_success \\\n test_expect_success \\\n     '15 - unchanged in two heads.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo nitfol nitfol >nitfol &&\n      git-update-cache --add nitfol &&\n      echo nitfol nitfol nitfol >nitfol &&\n@@ -203,6 +237,8 @@ test_expect_success \\\n test_expect_success \\\n     '16 - conflicting local change.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo bozbar bozbar >bozbar &&\n      git-update-cache --add bozbar &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n@@ -210,6 +246,8 @@ test_expect_success \\\n test_expect_success \\\n     '17 - conflicting local change.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo bozbar bozbar >bozbar &&\n      git-update-cache --add bozbar &&\n      echo bozbar bozbar bozbar >bozbar &&\n@@ -218,7 +256,9 @@ test_expect_success \\\n test_expect_success \\\n     '18 - local change already having a good result.' \\\n     'rm -f .git/index &&\n-     echo gnusto >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add bozbar &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >18.out &&\n@@ -228,7 +268,9 @@ test_expect_success \\\n test_expect_success \\\n     '19 - local change already having a good result, further modified.' \\\n     'rm -f .git/index &&\n-     echo gnusto >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add bozbar &&\n      echo gnusto gnusto >bozbar &&\n      read_tree_twoway $treeH $treeM &&\n@@ -239,7 +281,9 @@ test_expect_success \\\n test_expect_success \\\n     '20 - no local change, use new tree.' \\\n     'rm -f .git/index &&\n-     echo bozbar >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-old >bozbar &&\n      git-update-cache --add bozbar &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >20.out &&\n@@ -249,11 +293,23 @@ test_expect_success \\\n test_expect_success \\\n     '21 - no local change, dirty cache.' \\\n     'rm -f .git/index &&\n-     echo bozbar >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-old >bozbar &&\n      git-update-cache --add bozbar &&\n      echo gnusto gnusto >bozbar &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n \n+# This fails with straight two-way fast forward.\n+test_expect_success \\\n+    '22 - local change cache updated.' \\\n+    'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     sed -e \"s/such as/SUCH AS/\" bozbar-old >bozbar &&\n+     git-update-cache --add bozbar &&\n+     if read_tree_twoway $treeH $treeM; then false; else :; fi'\n+\n # Also make sure we did not break DF vs DF/DF case.\n test_expect_success \\\n     'DF vs DF/DF case setup.' \\\ndiff --git a/t/t1005-read-tree-m-2way-emu23.sh b/t/t1005-read-tree-m-2way-emu23.sh\n--- a/t/t1005-read-tree-m-2way-emu23.sh\n+++ b/t/t1005-read-tree-m-2way-emu23.sh\n@@ -32,7 +32,6 @@ read_tree_twoway () {\n _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n _x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n compare_change () {\n-    \tcat current\n \tsed -n >current \\\n \t    -e '/^--- /d; /^+++ /d; /^@@ /d;' \\\n \t    -e 's/^\\([-+][0-7][0-7][0-7][0-7][0-7][0-7]\\) '\"$_x40\"' /\\1 X /p' \\\n@@ -60,11 +59,22 @@ check_stages () {\n     diff -u expected_stages current_stages\n }\n \n+cat >bozbar-old <<\\EOF\n+This is a sample file used in two-way fast forward merge\n+tests.  Its second line ends with a magic word bozbar\n+which will be modified by the merged head to gnusto.\n+It has some extra lines so that external tools can\n+successfully merge independent changes made to later\n+lines (such as this one), avoiding line conflicts.\n+EOF\n+\n+sed -e 's/bozbar/gnusto (earlier bozbar)/' bozbar-old >bozbar-new\n+\n test_expect_success \\\n     setup \\\n     'echo frotz >frotz &&\n      echo nitfol >nitfol &&\n-     echo bozbar >bozbar &&\n+     cat bozbar-old >bozbar &&\n      echo rezrov >rezrov &&\n      echo yomin >yomin &&\n      git-update-cache --add nitfol bozbar rezrov &&\n@@ -72,7 +82,7 @@ test_expect_success \\\n      echo treeH $treeH &&\n      git-ls-tree $treeH &&\n \n-     echo gnusto >bozbar &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add frotz bozbar --force-remove rezrov &&\n      git-ls-files --stage >M.out &&\n      treeM=`git-write-tree` &&\n@@ -106,6 +116,8 @@ echo '+100644 X 0\tyomin' >expected\n test_expect_success \\\n     '4 - carry forward local addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      git-update-cache --add yomin &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >4.out || exit\n@@ -118,6 +130,8 @@ test_expect_success \\\n test_expect_success \\\n     '5 - carry forward local addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo yomin >yomin &&\n      git-update-cache --add yomin &&\n      echo yomin yomin >yomin &&\n@@ -132,6 +146,8 @@ test_expect_success \\\n test_expect_success \\\n     '6 - local addition already has the same.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      git-update-cache --add frotz &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >6.out &&\n@@ -143,6 +159,8 @@ test_expect_success \\\n test_expect_success \\\n     '7 - local addition already has the same.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz >frotz &&\n      git-update-cache --add frotz &&\n      echo frotz frotz >frotz &&\n@@ -154,6 +172,8 @@ test_expect_success \\\n test_expect_success \\\n     '8 - conflicting addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz frotz >frotz &&\n      git-update-cache --add frotz &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n@@ -161,6 +181,8 @@ test_expect_success \\\n test_expect_success \\\n     '9 - conflicting addition.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo frotz frotz >frotz &&\n      git-update-cache --add frotz &&\n      echo frotz >frotz &&\n@@ -169,6 +191,8 @@ test_expect_success \\\n test_expect_success \\\n     '10 - path removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      read_tree_twoway $treeH $treeM &&\n@@ -178,6 +202,8 @@ test_expect_success \\\n test_expect_success \\\n     '11 - dirty path removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      echo rezrov rezrov >rezrov &&\n@@ -186,6 +212,8 @@ test_expect_success \\\n test_expect_success \\\n     '12 - unmatching local changes being removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n@@ -193,6 +221,8 @@ test_expect_success \\\n test_expect_success \\\n     '13 - unmatching local changes being removed.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo rezrov rezrov >rezrov &&\n      git-update-cache --add rezrov &&\n      echo rezrov >rezrov &&\n@@ -206,6 +236,8 @@ EOF\n test_expect_success \\\n     '14 - unchanged in two heads.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo nitfol nitfol >nitfol &&\n      git-update-cache --add nitfol &&\n      read_tree_twoway $treeH $treeM &&\n@@ -217,6 +249,8 @@ test_expect_success \\\n test_expect_success \\\n     '15 - unchanged in two heads.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo nitfol nitfol >nitfol &&\n      git-update-cache --add nitfol &&\n      echo nitfol nitfol nitfol >nitfol &&\n@@ -233,6 +267,8 @@ test_expect_success \\\n test_expect_success \\\n     '16 - conflicting local change.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo bozbar bozbar >bozbar &&\n      git-update-cache --add bozbar &&\n      git-read-tree --emu23 $treeH $treeM &&\n@@ -249,6 +285,8 @@ EOF\n test_expect_success \\\n     '17 - conflicting local change.' \\\n     'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n      echo bozbar bozbar >bozbar &&\n      git-update-cache --add bozbar &&\n      echo bozbar bozbar bozbar >bozbar &&\n@@ -257,7 +295,9 @@ test_expect_success \\\n test_expect_success \\\n     '18 - local change already having a good result.' \\\n     'rm -f .git/index &&\n-     echo gnusto >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add bozbar &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >18.out &&\n@@ -267,7 +307,9 @@ test_expect_success \\\n test_expect_success \\\n     '19 - local change already having a good result, further modified.' \\\n     'rm -f .git/index &&\n-     echo gnusto >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-new >bozbar &&\n      git-update-cache --add bozbar &&\n      echo gnusto gnusto >bozbar &&\n      read_tree_twoway $treeH $treeM &&\n@@ -278,7 +320,9 @@ test_expect_success \\\n test_expect_success \\\n     '20 - no local change, use new tree.' \\\n     'rm -f .git/index &&\n-     echo bozbar >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-old >bozbar &&\n      git-update-cache --add bozbar &&\n      read_tree_twoway $treeH $treeM &&\n      git-ls-files --stage >20.out &&\n@@ -288,11 +332,31 @@ test_expect_success \\\n test_expect_success \\\n     '21 - no local change, dirty cache.' \\\n     'rm -f .git/index &&\n-     echo bozbar >bozbar &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     cat bozbar-old >bozbar &&\n      git-update-cache --add bozbar &&\n      echo gnusto gnusto >bozbar &&\n      if read_tree_twoway $treeH $treeM; then false; else :; fi'\n \n+echo '-100644 X 0\tbozbar\n++100644 X 0\tbozbar' >expected\n+\n+# This fails with straight two-way fast forward, but emu23\n+# can merge them.\n+test_expect_success \\\n+    '22 - local change cache updated.' \\\n+    'rm -f .git/index &&\n+     git-read-tree $treeH &&\n+     git-checkout-cache -u -f -q -a &&\n+     sed -e \"s/such as/SUCH AS/\" bozbar-old >bozbar &&\n+     git-update-cache --add bozbar &&\n+     read_tree_twoway $treeH $treeM &&\n+     git-ls-files --stage >22.out || exit\n+     diff -u M.out 22.out >22diff.out\n+     compare_change 22diff.out &&\n+     check_cache_at bozbar clean'\n+\n # Also make sure we did not break DF vs DF/DF case.\n test_expect_success \\\n     'DF vs DF/DF case setup.' \\\n@@ -324,4 +388,20 @@ test_expect_success \\\n      check_cache_at DF/DF clean && # different from pure 2-way\n      :'\n \n+# Emu23 can grok I having more than H.  Make sure we did not\n+# botch the conflict tests (Linus code botches this test).\n+test_expect_success \\\n+    'DF vs DF/DF case test (#2).' \\\n+    'rm -f .git/index &&\n+     rm -fr DF &&\n+     mkdir DF &&\n+     echo DF/DF >DF/DF &&\n+     git-update-cache --add DF/DF &&\n+     # This should fail because I and H have a conflict\n+     # at DF.\n+     if git-read-tree --emu23 $treeDF $treeDFDF\n+     then true  ;# should be false\n+     else false ;# should be true\n+     fi'\n+\n test_done\n------------\n\n"},{"id":"5265","messageId":"7vll4y3i1p.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vmzpe4x08.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 6/9] git-merge-one-file-script: do not misinterpret rm failure.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-25T09:24:50Z","receivedAt":"2005-06-25T09:24:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"When a merge adds a file DF and removes a directory there by\ndeleting a path DF/DF, git-merge-one-file-script can be called\nfor the removal of DF/DF when the path DF is already created by\n\"git-read-tree -m -u\".  When this happens, we get confused by a\nfailure return from 'rm -f -- \"$4\"' (where $4 is DF/DF); finding\nfile DF there the \"rm -f\" command complains that DF is not a\ndirectory.\n\nWhat we want to ensure is that there is no file DF/DF in this\ncase. Avoid getting ourselves confused by first checking if\nthere is a file, and only then try to remove it (and check for\nfailure from the \"rm\" command).\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n git-merge-one-file-script |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\n7edbb24f69809eb41de865701bc4f17774348043\ndiff --git a/git-merge-one-file-script b/git-merge-one-file-script\n--- a/git-merge-one-file-script\n+++ b/git-merge-one-file-script\n@@ -22,8 +22,11 @@ case \"${1:-.}${2:-.}${3:-.}\" in\n #\n \"$1..\" | \"$1.$1\" | \"$1$1.\")\n \techo \"Removing $4\"\n-\trm -f -- \"$4\" &&\n-\t\texec git-update-cache --remove -- \"$4\"\n+\tif test -f \"$4\"\n+\tthen\n+\t\trm -f -- \"$4\"\n+\tfi &&\n+\texec git-update-cache --remove -- \"$4\"\n \t;;\n \n #\n------------\n\n"},{"id":"5264","messageId":"7vfyv63i0m.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vmzpe4x08.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 7/9] Fix oversimplified optimization for add_cache_entry().","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-25T09:25:29Z","receivedAt":"2005-06-25T09:25:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"An earlier change to optimize directory-file conflict check\nbroke what \"read-tree --emu23\" expects.  This is fixed by this\ncommit.\n\n(1) Introduces an explicit flag to tell add_cache_entry() not to\n    check for conflicts and use it when reading an existing tree\n    into an empty stage --- by definition this case can never\n    introduce such conflicts.\n\n(2) Makes read-cache.c:has_file_name() and read-cache.c:has_dir_name()\n    aware of the cache stages, and flag conflict only with paths\n    in the same stage.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n cache.h                           |    1 +\n read-cache.c                      |   32 +++++++++++++++++++++-----------\n t/t1005-read-tree-m-2way-emu23.sh |   25 ++++++++++++++++++++-----\n tree.c                            |    2 +-\n 4 files changed, 43 insertions(+), 17 deletions(-)\n\n904dbb145f2f42227ea5b94752146ef8d4c2b153\ndiff --git a/cache.h b/cache.h\n--- a/cache.h\n+++ b/cache.h\n@@ -130,6 +130,7 @@ extern int write_cache(int newfd, struct\n extern int cache_name_pos(const char *name, int namelen);\n #define ADD_CACHE_OK_TO_ADD 1\t\t/* Ok to add */\n #define ADD_CACHE_OK_TO_REPLACE 2\t/* Ok to replace file/directory */\n+#define ADD_CACHE_SKIP_DFCHECK 4\t/* Ok to skip DF conflict checks */\n extern int add_cache_entry(struct cache_entry *ce, int option);\n extern int remove_cache_entry_at(int pos);\n extern int remove_file_from_cache(char *path);\ndiff --git a/read-cache.c b/read-cache.c\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -179,6 +179,7 @@ static int has_file_name(const struct ca\n {\n \tint retval = 0;\n \tint len = ce_namelen(ce);\n+\tint stage = ce_stage(ce);\n \tconst char *name = ce->name;\n \n \twhile (pos < active_nr) {\n@@ -188,6 +189,8 @@ static int has_file_name(const struct ca\n \t\t\tbreak;\n \t\tif (memcmp(name, p->name, len))\n \t\t\tbreak;\n+\t\tif (ce_stage(p) != stage)\n+\t\t\tcontinue;\n \t\tif (p->name[len] != '/')\n \t\t\tcontinue;\n \t\tretval = -1;\n@@ -205,6 +208,7 @@ static int has_file_name(const struct ca\n static int has_dir_name(const struct cache_entry *ce, int pos, int ok_to_replace)\n {\n \tint retval = 0;\n+\tint stage = ce_stage(ce);\n \tconst char *name = ce->name;\n \tconst char *slash = name + ce_namelen(ce);\n \n@@ -219,7 +223,7 @@ static int has_dir_name(const struct cac\n \t\t}\n \t\tlen = slash - name;\n \n-\t\tpos = cache_name_pos(name, len);\n+\t\tpos = cache_name_pos(name, ntohs(create_ce_flags(len, stage)));\n \t\tif (pos >= 0) {\n \t\t\tretval = -1;\n \t\t\tif (ok_to_replace)\n@@ -231,18 +235,23 @@ static int has_dir_name(const struct cac\n \t\t/*\n \t\t * Trivial optimization: if we find an entry that\n \t\t * already matches the sub-directory, then we know\n-\t\t * we're ok, and we can exit\n+\t\t * we're ok, and we can exit.\n \t\t */\n \t\tpos = -pos-1;\n-\t\tif (pos < active_nr) {\n+\t\twhile (pos < active_nr) {\n \t\t\tstruct cache_entry *p = active_cache[pos];\n-\t\t\tif (ce_namelen(p) <= len)\n-\t\t\t\tcontinue;\n-\t\t\tif (p->name[len] != '/')\n-\t\t\t\tcontinue;\n-\t\t\tif (memcmp(p->name, name, len))\n-\t\t\t\tcontinue;\n-\t\t\tbreak;\n+\t\t\tif ((ce_namelen(p) <= len) ||\n+\t\t\t    (p->name[len] != '/') ||\n+\t\t\t    memcmp(p->name, name, len))\n+\t\t\t\tbreak; /* not our subdirectory */\n+\t\t\tif (ce_stage(p) == stage)\n+\t\t\t\t/* p is at the same stage as our entry, and\n+\t\t\t\t * is a subdirectory of what we are looking\n+\t\t\t\t * at, so we cannot have conflicts at our\n+\t\t\t\t * level or anything shorter.\n+\t\t\t\t */\n+\t\t\t\treturn retval;\n+\t\t\tpos++;\n \t\t}\n \t}\n \treturn retval;\n@@ -277,6 +286,7 @@ int add_cache_entry(struct cache_entry *\n \tint pos;\n \tint ok_to_add = option & ADD_CACHE_OK_TO_ADD;\n \tint ok_to_replace = option & ADD_CACHE_OK_TO_REPLACE;\n+\tint skip_df_check = option & ADD_CACHE_SKIP_DFCHECK;\n \tpos = cache_name_pos(ce->name, ntohs(ce->ce_flags));\n \n \t/* existing match? Just replace it */\n@@ -302,7 +312,7 @@ int add_cache_entry(struct cache_entry *\n \tif (!ok_to_add)\n \t\treturn -1;\n \n-\tif (!ce_stage(ce) && check_file_directory_conflict(ce, pos, ok_to_replace)) {\n+\tif (!skip_df_check && check_file_directory_conflict(ce, pos, ok_to_replace)) {\n \t\tif (!ok_to_replace)\n \t\t\treturn -1;\n \t\tpos = cache_name_pos(ce->name, ntohs(ce->ce_flags));\ndiff --git a/t/t1005-read-tree-m-2way-emu23.sh b/t/t1005-read-tree-m-2way-emu23.sh\n--- a/t/t1005-read-tree-m-2way-emu23.sh\n+++ b/t/t1005-read-tree-m-2way-emu23.sh\n@@ -366,6 +366,7 @@ test_expect_success \\\n      treeDF=`git-write-tree` &&\n      echo treeDF $treeDF &&\n      git-ls-tree $treeDF &&\n+     git-ls-files --stage >DF.out\n \n      rm -f DF &&\n      mkdir DF &&\n@@ -377,7 +378,7 @@ test_expect_success \\\n      git-ls-files --stage >DFDF.out'\n \n test_expect_success \\\n-    'DF vs DF/DF case test.' \\\n+    'DF vs DF/DF case test (#1)' \\\n     'rm -f .git/index &&\n      rm -fr DF &&\n      echo DF >DF &&\n@@ -388,10 +389,24 @@ test_expect_success \\\n      check_cache_at DF/DF clean && # different from pure 2-way\n      :'\n \n+# The other way around\n+test_expect_success \\\n+    'DF vs DF/DF case test (#2)' \\\n+    'rm -f .git/index &&\n+     rm -fr DF &&\n+     mkdir DF &&\n+     echo DF/DF >DF/DF &&\n+     git-update-cache --add DF/DF &&\n+     read_tree_twoway $treeDFDF $treeDF &&\n+     git-ls-files --stage >DFDFcheck.out &&\n+     diff -u DF.out DFDFcheck.out &&\n+     check_cache_at DF clean && # different from pure 2-way\n+     :'\n+\n # Emu23 can grok I having more than H.  Make sure we did not\n-# botch the conflict tests (Linus code botches this test).\n+# botch the conflict tests (fixed).\n test_expect_success \\\n-    'DF vs DF/DF case test (#2).' \\\n+    'DF vs DF/DF case test (#3).' \\\n     'rm -f .git/index &&\n      rm -fr DF &&\n      mkdir DF &&\n@@ -400,8 +415,8 @@ test_expect_success \\\n      # This should fail because I and H have a conflict\n      # at DF.\n      if git-read-tree --emu23 $treeDF $treeDFDF\n-     then true  ;# should be false\n-     else false ;# should be true\n+     then false\n+     else true\n      fi'\n \n test_done\ndiff --git a/tree.c b/tree.c\n--- a/tree.c\n+++ b/tree.c\n@@ -18,7 +18,7 @@ static int read_one_entry(unsigned char \n \tmemcpy(ce->name, base, baselen);\n \tmemcpy(ce->name + baselen, pathname, len+1);\n \tmemcpy(ce->sha1, sha1, 20);\n-\treturn add_cache_entry(ce, ADD_CACHE_OK_TO_ADD);\n+\treturn add_cache_entry(ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_SKIP_DFCHECK);\n }\n \n static int read_tree_recursive(void *buffer, unsigned long size,\n------------\n\n"},{"id":"5263","messageId":"7vacle3hzu.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vmzpe4x08.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 8/9] http-pull: documentation updates.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-25T09:25:57Z","receivedAt":"2005-06-25T09:25:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Describe -w option.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n Documentation/git-http-pull.txt |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\nbce3da4d8421812b0eb1d433b0af0fc3fc9bb54a\ndiff --git a/Documentation/git-http-pull.txt b/Documentation/git-http-pull.txt\n--- a/Documentation/git-http-pull.txt\n+++ b/Documentation/git-http-pull.txt\n@@ -9,7 +9,7 @@ git-http-pull - Downloads a remote GIT r\n \n SYNOPSIS\n --------\n-'git-http-pull' [-c] [-t] [-a] [-v] [-d] [--recover] commit-id url\n+'git-http-pull' [-c] [-t] [-a] [-d] [-v] [-w filename] [--recover] commit-id url\n \n DESCRIPTION\n -----------\n@@ -30,7 +30,9 @@ Downloads a remote GIT repository via HT\n \tusual, to recover after earlier pull that was interrupted.\n -v::\n \tReport what is downloaded.\n-\n+-w::\n+        Writes the commit-id into the filename under $GIT_DIR/refs/ on\n+        the local end after the transfer is complete.\n \n Author\n ------\n------------\n\n"},{"id":"5267","messageId":"7v4qbm3hyy.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vmzpe4x08.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 9/9] Add a bit of developer documentation to pull.h","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-25T09:26:29Z","receivedAt":"2005-06-25T09:26:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Describe what to implement in fetch() and fetch_ref() for\npull backend writers a bit better.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n pull.h |   21 +++++++++++++++------\n 1 files changed, 15 insertions(+), 6 deletions(-)\n\n190061e326b73dcf76d301d8b17ce96c783d7251\ndiff --git a/pull.h b/pull.h\n--- a/pull.h\n+++ b/pull.h\n@@ -1,24 +1,33 @@\n #ifndef PULL_H\n #define PULL_H\n \n-/** To be provided by the particular implementation. **/\n+/*\n+ * Fetch object given SHA1 from the remote, and store it locally under\n+ * GIT_OBJECT_DIRECTORY.  Return 0 on success, -1 on failure.  To be\n+ * provided by the particular implementation.\n+ */\n extern int fetch(unsigned char *sha1);\n \n+/*\n+ * Fetch ref (relative to $GIT_DIR/refs) from the remote, and store\n+ * the 20-byte SHA1 in sha1.  Return 0 on success, -1 on failure.  To\n+ * be provided by the particular implementation.\n+ */\n extern int fetch_ref(char *ref, unsigned char *sha1);\n \n-/** If set, the ref filename to write the target value to. **/\n+/* If set, the ref filename to write the target value to. */\n extern const char *write_ref;\n \n-/** If set, the hash that the current value of write_ref must be. **/\n+/* If set, the hash that the current value of write_ref must be. */\n extern const unsigned char *current_ref;\n \n-/** Set to fetch the target tree. */\n+/* Set to fetch the target tree. */\n extern int get_tree;\n \n-/** Set to fetch the commit history. */\n+/* Set to fetch the commit history. */\n extern int get_history;\n \n-/** Set to fetch the trees in the commit history. **/\n+/* Set to fetch the trees in the commit history. */\n extern int get_all;\n \n /* Set to zero to skip the check for delta object base;\n------------\n\n"},{"id":"5271","messageId":"7vy88yvsjl.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"7vmzpe4x08.fsf_-_@assigned-by-dhcp.cox.net","subject":"[RFD] consider \"git\" wrapper semi-Porcelain","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-26T01:02:54Z","receivedAt":"2005-06-26T01:02:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Currently \"git\" wrapper suggests both low-level git-* commands\nand git-*-script commands as alternatives.  Earlier I stated\nthat git-*-script commands, like it or not, form a perfectly\ngood set of barebone Porcelain, as opposed to all the other\ncommands that do not end with \"script\" are low-level Plumbing.\nAfter reviewing the current set of commands and scripts again, I\nstill think this view holds true [*1*, *2*].\n\nI would propose the following, preferably before we go 1.0:\n\n (1) Do not suggest low-level Plumbing commands to \"git\" wrapper\n     users, and do not call anything but git-*-script from \"git\"\n     wrapper.  Once *-script Porcelain matures, hopefully\n     everyday workflow would not require access to low-level\n     Plumbing and can be done with git-*-script Porcelain.  When\n     people know the GIT way, they can also work it around\n     things that git-*-script Porcelain does not support well by\n     writing their own git-*-script in terms of Plumbing-ish\n     git-* commands, and if it is good enough for public\n     consumption, propose it for inclusion upstream.\n\n (2) Make an alias git-whatchanged-script that just \"exec\"s\n     git-whatchanged, to make things consistent.\n\n (3) Rename some git-*-script that are misnamed in the sense\n     that they are not useful standalone scripts but more of\n     Plumbing that happen to be written in shell [*3*].  I do\n     not particularly like this proposal, because this breaks\n     existing scripts.  However, if we go this route for\n     consistency, I would further suggest renaming Porcelain-ish\n     things git-*-cmd or something, call and suggest them from\n     \"git\" wrapper, regardless of which language they are\n     written in [*4*].\n\n\n[Footnotes]\n\n*1* One exception is git-whatchanged.\n\n*2* That is the reason I did not name git-cherry\n\"git-cherry-script\".  It is not useful standalone but meant to\nbe useful in scripting environment.\n\n*3* git-apply-patch-script (my fault) and\ngit-merge-one-file-script fall into this category.\n\n*4* Current naming and the proposal (1) above have a problem in\nthat they muddy the definition of what is \"script\": the name\n\"script\" were originally used because they were written in\nshell, and all of the Porcelain-ish things happen to be\n\"script\".  Writing Porcelain-ish things in shell should not be a\nrequirement.\n\n"},{"id":"5272","messageId":"Pine.LNX.4.58.0506251821050.19755@ppc970.osdl.org","threadId":"1015","inReplyTo":"7vy88yvsjl.fsf_-_@assigned-by-dhcp.cox.net","subject":"Re: [RFD] consider \"git\" wrapper semi-Porcelain","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-06-26T01:21:47Z","receivedAt":"2005-06-26T01:21:47Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sat, 25 Jun 2005, Junio C Hamano wrote:\n> \n> I would propose the following, preferably before we go 1.0:\n\nAgreed on all counts.\n\n\t\tLinus\n"},{"id":"5275","messageId":"7voe9ts4vt.fsf@assigned-by-dhcp.cox.net","threadId":"1015","inReplyTo":"Pine.LNX.4.58.0506251821050.19755@ppc970.osdl.org","subject":"Re: [RFD] consider \"git\" wrapper semi-Porcelain","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-06-26T12:02:14Z","receivedAt":"2005-06-26T12:02:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n\nLT> On Sat, 25 Jun 2005, Junio C Hamano wrote:\n>> \n>> I would propose the following, preferably before we go 1.0:\n\nLT> Agreed on all counts.\n\nWith holy Penguin pee blessings, I would send in a \"flag day\"\npatch sometime before July 4th weekend that:\n\n - renames most of the git-*-script to git-*-cmd;\n - renames git-whatchanged to git-whatchanged-cmd;\n - renames two misnamed git-*-script to git-*-helper\n\nwithout any backward compatibility warts.\n\nUnless people object and propose good transition plans, that\nis.\n\nThis message is for people who uses bare GIT and who writes\nPorcelain.  Please consider yourselves warned ;-).\n\n"},{"id":"5276","messageId":"42BEA14E.8010806@gmail.com","threadId":"1015","inReplyTo":"7voe9ts4vt.fsf@assigned-by-dhcp.cox.net","subject":"Re: [RFD] consider \"git\" wrapper semi-Porcelain","fromName":"Martijn Kuipers","fromEmail":"martijn.kuipers@gmail.com","sentAt":"2005-06-26T12:36:30Z","receivedAt":"2005-06-26T12:36:30Z","isPatch":false,"sender":{"key":"martijn.kuipers@gmail.com","avatar":"https://gravatar.com/avatar/bab8b7fab945f46d5a7c38c57f83e4d8608b0818246c99598028f4eadd4e17e1?d=mp&s=160"},"body":"Hi,\n\nJunio C Hamano wrote:\n\n> - renames most of the git-*-script to git-*-cmd;\n\nWouldn't this ruin the nice tab-completion? git-plumbing and \ngit-porcelain will only be distinctable from their last part.\nMaybe I understood wrong, but if people are supposed to \"just\" use \ngit-porcelain for every day use, then probably it would make more sense \nto rename to gitp-* for porcelain, as the tab-completion would work from \nthe first word , which would be less confusing for us mere users (yes, \nany alternative first word would work).\n\nKind regards,\nMartijn\n\n"}]}