{"thread":{"id":"283","subject":"Git cancel work","startedAt":"2005-04-24T04:34:44Z","lastAt":"2005-04-24T13:11:50Z","messageCount":6,"participants":["Dan Weber","Petr Baudis","Dan Holmsand"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"1480","messageId":"Pine.LNX.4.62.0504240033230.1980@mirrorlynx.com","threadId":"283","inReplyTo":null,"subject":"Git cancel work","fromName":"Dan Weber","fromEmail":"dan@mirrorlynx.com","sentAt":"2005-04-24T04:34:44Z","receivedAt":"2005-04-24T04:34:44Z","isPatch":false,"sender":{"key":"dan@mirrorlynx.com","avatar":null},"body":"\nI noticed that git cancel was always doing a full checkout.  So I figured, \n\"what about just checking out the modified files?\".  Attached is a patch \nto do so.\n\nDan\n\nLets not do a full checkout on git cancel\n\n---\ncommit 47197d9accb420ec55f6dfd63d990d4fb2537330\ntree e8f3699877dd220440808087632ef87cce2288a7\nparent c83b95297c2a6336c2007548f909769e0862b509\nauthor Dan Weber <dan@mirrorlynx.com> 1114316504 -0400\ncommitter Dan Weber <dan@mirrorlynx.com> 1114316504 -0400\n\nIndex: gitcancel.sh\n===================================================================\n--- 2aaf94eae20acc451553766f3c063bc46cfa75c6/gitcancel.sh  (mode:100755 sha1:26eecb50bc812211454e98d98e8818387ae97df5)\n+++ e8f3699877dd220440808087632ef87cce2288a7/gitcancel.sh  (mode:100755 sha1:c836b75bb8a7c461b2d0ad536d1c3bc2d2440ab4)\n@@ -2,6 +2,7 @@\n #\n # Cancels current edits in the working tree.\n # Copyright (c) Petr Baudis, 2005\n+# Copyright (c) Dan Weber, 2005\n #\n # This script reverts the working tree to a consistent state before\n # any changes to it (including merges etc) were done.\n@@ -26,5 +27,23 @@\n rm -f .git/blocked .git/merging .git/merging-sym .git/merge-base\n read-tree -m $(tree-id) || read-tree $(tree-id)\n \n-checkout-cache -f -a\n-update-cache --refresh\n+general() {\n+\tfor name in $(diff-cache -r $(tree-id)|awk '{print $4}')\n+\tdo\n+\t\tcheckout-cache -f $name\n+\tdone\n+\tupdate-cache --refresh\n+}\n+\n+full () {\n+\tcheckout-cache -f -a\n+\tupdate-cache --refresh\n+}\n+\n+\n+if [ \"$1\" == \"-a\" -o \"$1\" == \"--full\" -o \"$1\" == \"--all\" ]; then\n+\tfull\n+else\n+\tgeneral\n+fi\n+\n"},{"id":"1516","messageId":"20050424124930.GE1507@pasky.ji.cz","threadId":"283","inReplyTo":"Pine.LNX.4.62.0504240033230.1980@mirrorlynx.com","subject":"Re: Git cancel work","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-24T12:49:30Z","receivedAt":"2005-04-24T12:49:30Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Apr 24, 2005 at 06:34:44AM CEST, I got a letter\nwhere Dan Weber <dan@mirrorlynx.com> told me that...\n> I noticed that git cancel was always doing a full checkout.  So I figured, \n> \"what about just checking out the modified files?\".  Attached is a patch \n> to do so.\n\nBut that is what checkout-cache -f -a does:\n\n        if (!stat(path, &st)) {\n                unsigned changed = cache_match_stat(ce, &st);\n                if (!changed)\n                        return 0;\n\nin checkout_entry().\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"1517","messageId":"Pine.LNX.4.62.0504240859210.27230@mirrorlynx.com","threadId":"283","inReplyTo":"20050424124930.GE1507@pasky.ji.cz","subject":"Re: Git cancel work","fromName":"Dan Weber","fromEmail":"dan@mirrorlynx.com","sentAt":"2005-04-24T12:59:31Z","receivedAt":"2005-04-24T12:59:31Z","isPatch":false,"sender":{"key":"dan@mirrorlynx.com","avatar":null},"body":"\nWhy does it take so ridiculously long then?\n\nDan\n\nOn Sun, 24 Apr 2005, Petr Baudis wrote:\n\n> Dear diary, on Sun, Apr 24, 2005 at 06:34:44AM CEST, I got a letter\n> where Dan Weber <dan@mirrorlynx.com> told me that...\n>> I noticed that git cancel was always doing a full checkout.  So I figured,\n>> \"what about just checking out the modified files?\".  Attached is a patch\n>> to do so.\n>\n> But that is what checkout-cache -f -a does:\n>\n>        if (!stat(path, &st)) {\n>                unsigned changed = cache_match_stat(ce, &st);\n>                if (!changed)\n>                        return 0;\n>\n> in checkout_entry().\n>\n> -- \n> \t\t\t\tPetr \"Pasky\" Baudis\n> Stuff: http://pasky.or.cz/\n> C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n>\n"},{"id":"1518","messageId":"20050424130028.GG1507@pasky.ji.cz","threadId":"283","inReplyTo":"Pine.LNX.4.62.0504240859210.27230@mirrorlynx.com","subject":"Re: Git cancel work","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-24T13:00:29Z","receivedAt":"2005-04-24T13:00:29Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Apr 24, 2005 at 02:59:31PM CEST, I got a letter\nwhere Dan Weber <dan@mirrorlynx.com> told me that...\n> Why does it take so ridiculously long then?\n\nThat's strange.\n\nCould you show some time comparisons between the current and your\napproaches? (Please make sure the cache condition is about the same for\nboth tests; it makes many orders of magnitude difference.)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"1519","messageId":"Pine.LNX.4.62.0504240903400.29083@mirrorlynx.com","threadId":"283","inReplyTo":"20050424130028.GG1507@pasky.ji.cz","subject":"Re: Git cancel work","fromName":"Dan Weber","fromEmail":"dan@mirrorlynx.com","sentAt":"2005-04-24T13:04:03Z","receivedAt":"2005-04-24T13:04:03Z","isPatch":false,"sender":{"key":"dan@mirrorlynx.com","avatar":null},"body":"\n\nOn Sun, 24 Apr 2005, Petr Baudis wrote:\n\n> Dear diary, on Sun, Apr 24, 2005 at 02:59:31PM CEST, I got a letter\n> where Dan Weber <dan@mirrorlynx.com> told me that...\n>> Why does it take so ridiculously long then?\n>\n> That's strange.\n>\n> Could you show some time comparisons between the current and your\n> approaches? (Please make sure the cache condition is about the same for\n> both tests; it makes many orders of magnitude difference.)\n>\n\nNo need.  Go try running it on the linux kernel. The command git cancel.\n\nDan\n> -- \n> \t\t\t\tPetr \"Pasky\" Baudis\n> Stuff: http://pasky.or.cz/\n> C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n>\n"},{"id":"1521","messageId":"d4g5ld$4ns$1@sea.gmane.org","threadId":"283","inReplyTo":"Pine.LNX.4.62.0504240859210.27230@mirrorlynx.com","subject":"Re: Git cancel work","fromName":"Dan Holmsand","fromEmail":"holmsand@gmail.com","sentAt":"2005-04-24T13:11:50Z","receivedAt":"2005-04-24T13:11:50Z","isPatch":false,"sender":{"key":"holmsand@gmail.com","avatar":"https://gravatar.com/avatar/5c722084bafd85e754a02efad01fe69107eb6f393253c49232c5c9f7faa974df?d=mp&s=160"},"body":"Dan Weber wrote:\n> \n> Why does it take so ridiculously long then?\n\nPerhaps because you're using an older version of git-pasky? Newer \nversions use read-tree -m, which speeds up git cancel by several orders \nof magnitude for me.\n\nBtw. gitdiff.sh and gitseek.sh are still using read-tree without \"-m\", \nso they are still very slow.\n\nFor exampel, try \"git diff -p\" on the kernel. Compare with plain \"git diff\".\n\n/dan\n\n"}]}