{"thread":{"id":"140","subject":"[script] ge: export commits as patches","startedAt":"2005-04-19T13:48:43Z","lastAt":"2005-04-20T17:21:43Z","messageCount":8,"participants":["Ingo Molnar","Petr Baudis","Greg KH","David A. Wheeler","Zlatko Calusic"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"819","messageId":"20050419134843.GA19146@elte.hu","threadId":"140","inReplyTo":null,"subject":"[script] ge: export commits as patches","fromName":"Ingo Molnar","fromEmail":"mingo@elte.hu","sentAt":"2005-04-19T13:48:43Z","receivedAt":"2005-04-19T13:48:43Z","isPatch":false,"sender":{"key":"mingo@elte.hu","avatar":null},"body":"\nis there any 'export commit as patch' support in git-pasky? I didnt find \nany such command (maybe it got added meanwhile), so i'm using the 'ge' \nhack below.\n\ne.g. i typically look at commits via 'git log', and then when i see \nsomething interesting, i look at the commit via the 'ge' script. E.g.  \n\"ge 834f6209b22af2941a8640f1e32b0f123c833061\" done in the kernel tree \nwill output a particular commit's header and the patch.\n\n\tIngo\n\n#!/bin/bash\n\nif [ $# != 1 ]; then\n echo 'ge <commit-ID>'\n exit -1\nfi\nTREE1=$(cat-file commit 2>/dev/null $1 | head -4 | grep ^tree | cut -d' ' -f2)\nif [ \"$TREE1\" = \"\" ]; then echo 'ge <commit-ID>'; exit -1; fi\nPARENT=$(cat-file commit 2>/dev/null $1 | head -4 | grep ^parent | cut -d' ' -f2)\nif [ \"$PARENT\" = \"\" ]; then echo 'ge <commit-ID>'; exit -1; fi\nTREE2=$(cat-file commit 2>/dev/null $PARENT | head -4 | grep ^tree | cut -d' ' -f2)\nif [ \"$TREE2\" = \"\" ]; then echo 'ge <commit-ID>'; exit -1; fi\n\ncat-file commit $1\necho\ngit diff -r $TREE2:$TREE1\n\n"},{"id":"836","messageId":"20050419170320.GG12757@pasky.ji.cz","threadId":"140","inReplyTo":"20050419134843.GA19146@elte.hu","subject":"Re: [script] ge: export commits as patches","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-19T17:03:20Z","receivedAt":"2005-04-19T17:03:20Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Apr 19, 2005 at 03:48:43PM CEST, I got a letter\nwhere Ingo Molnar <mingo@elte.hu> told me that...\n> is there any 'export commit as patch' support in git-pasky? I didnt find \n> any such command (maybe it got added meanwhile), so i'm using the 'ge' \n> hack below.\n> \n> e.g. i typically look at commits via 'git log', and then when i see \n> something interesting, i look at the commit via the 'ge' script. E.g.  \n> \"ge 834f6209b22af2941a8640f1e32b0f123c833061\" done in the kernel tree \n> will output a particular commit's header and the patch.\n\nNice idea. I will add it, probably as 'git patch'.\n\n> TREE1=$(cat-file commit 2>/dev/null $1 | head -4 | grep ^tree | cut -d' ' -f2)\n> if [ \"$TREE1\" = \"\" ]; then echo 'ge <commit-ID>'; exit -1; fi\n> PARENT=$(cat-file commit 2>/dev/null $1 | head -4 | grep ^parent | cut -d' ' -f2)\n> if [ \"$PARENT\" = \"\" ]; then echo 'ge <commit-ID>'; exit -1; fi\n> TREE2=$(cat-file commit 2>/dev/null $PARENT | head -4 | grep ^tree | cut -d' ' -f2)\n> if [ \"$TREE2\" = \"\" ]; then echo 'ge <commit-ID>'; exit -1; fi\n\ncommit-id and parent-id tools might be useful. ;-)\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":"852","messageId":"20050419185607.GA26756@elte.hu","threadId":"140","inReplyTo":"20050419170320.GG12757@pasky.ji.cz","subject":"Re: [script] ge: export commits as patches","fromName":"Ingo Molnar","fromEmail":"mingo@elte.hu","sentAt":"2005-04-19T18:56:07Z","receivedAt":"2005-04-19T18:56:07Z","isPatch":false,"sender":{"key":"mingo@elte.hu","avatar":null},"body":"\n* Petr Baudis <pasky@ucw.cz> wrote:\n\n> Dear diary, on Tue, Apr 19, 2005 at 03:48:43PM CEST, I got a letter\n> where Ingo Molnar <mingo@elte.hu> told me that...\n> > is there any 'export commit as patch' support in git-pasky? I didnt find \n> > any such command (maybe it got added meanwhile), so i'm using the 'ge' \n> > hack below.\n> > \n> > e.g. i typically look at commits via 'git log', and then when i see \n> > something interesting, i look at the commit via the 'ge' script. E.g.  \n> > \"ge 834f6209b22af2941a8640f1e32b0f123c833061\" done in the kernel tree \n> > will output a particular commit's header and the patch.\n> \n> Nice idea. I will add it, probably as 'git patch'.\n> \n> > TREE1=$(cat-file commit 2>/dev/null $1 | head -4 | grep ^tree | cut -d' ' -f2)\n> > if [ \"$TREE1\" = \"\" ]; then echo 'ge <commit-ID>'; exit -1; fi\n> > PARENT=$(cat-file commit 2>/dev/null $1 | head -4 | grep ^parent | cut -d' ' -f2)\n> > if [ \"$PARENT\" = \"\" ]; then echo 'ge <commit-ID>'; exit -1; fi\n> > TREE2=$(cat-file commit 2>/dev/null $PARENT | head -4 | grep ^tree | cut -d' ' -f2)\n> > if [ \"$TREE2\" = \"\" ]; then echo 'ge <commit-ID>'; exit -1; fi\n> \n> commit-id and parent-id tools might be useful. ;-)\n\nfind a cleaned up 'ge' script below.\n\nand please fix gitXnormid.sh to simply echo nothing and return with a -1 \nexit value when a nonsensical ID is passed to it. Right now the output \nis quite ugly if you do 'ge blah'.\n\n\tIngo\n\n#!/bin/bash\n\nusage ()\n{\n echo 'usage: ge <commit-ID>'\n exit -1\n}\n\nif [ $# != 1 ]; then\n usage\nfi\n\nME=    $(commit-id $1);      [ \"$ME\"     = \"\" ] && usage\nPARENT=$(parent-id $ME);     [ \"$PARENT\" = \"\" ] && usage\nTREE1= $(tree-id   $ME);     [ \"$TREE1\"  = \"\" ] && usage\nTREE2= $(tree-id   $PARENT); [ \"$TREE2\"  = \"\" ] && usage\n\ncat-file commit $ME\necho\ngit diff -r $TREE2:$TREE1\n\n"},{"id":"856","messageId":"20050419191128.GA4871@kroah.com","threadId":"140","inReplyTo":"20050419170320.GG12757@pasky.ji.cz","subject":"Re: [script] ge: export commits as patches","fromName":"Greg KH","fromEmail":"greg@kroah.com","sentAt":"2005-04-19T19:11:29Z","receivedAt":"2005-04-19T19:11:29Z","isPatch":false,"sender":{"key":"greg@kroah.com","avatar":"https://gravatar.com/avatar/5bb5aa0cc2e01c00ec899d11130c07796bc186e465bae57bc34873b13b72c7c8?d=mp&s=160"},"body":"On Tue, Apr 19, 2005 at 07:03:20PM +0200, Petr Baudis wrote:\n> Dear diary, on Tue, Apr 19, 2005 at 03:48:43PM CEST, I got a letter\n> where Ingo Molnar <mingo@elte.hu> told me that...\n> > is there any 'export commit as patch' support in git-pasky? I didnt find \n> > any such command (maybe it got added meanwhile), so i'm using the 'ge' \n> > hack below.\n> > \n> > e.g. i typically look at commits via 'git log', and then when i see \n> > something interesting, i look at the commit via the 'ge' script. E.g.  \n> > \"ge 834f6209b22af2941a8640f1e32b0f123c833061\" done in the kernel tree \n> > will output a particular commit's header and the patch.\n> \n> Nice idea. I will add it, probably as 'git patch'.\n\nAh, thanks for doing this.  'git patch' works great (but you might want\nto mention in the 'help' that you can give the commit id for the patch,\nif you don't want to see the HEAD patch.)\n\nthanks,\n\ngreg k-h\n"},{"id":"858","messageId":"20050419194108.GN12757@pasky.ji.cz","threadId":"140","inReplyTo":"20050419185607.GA26756@elte.hu","subject":"Re: [script] ge: export commits as patches","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-19T19:41:08Z","receivedAt":"2005-04-19T19:41:08Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Apr 19, 2005 at 08:56:07PM CEST, I got a letter\nwhere Ingo Molnar <mingo@elte.hu> told me that...\n> and please fix gitXnormid.sh to simply echo nothing and return with a -1 \n> exit value when a nonsensical ID is passed to it. Right now the output \n> is quite ugly if you do 'ge blah'.\n\nThat's a feature; you can do || exit 1. Put its stderr to /dev/null if\nyou want your own error reporting.\n\nBTW, I still think my gitpatch.sh is nicer. ;-)\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":"892","messageId":"42658C97.5090409@dwheeler.com","threadId":"140","inReplyTo":"20050419170320.GG12757@pasky.ji.cz","subject":"Re: [script] ge: export commits as patches","fromName":"David A. Wheeler","fromEmail":"dwheeler@dwheeler.com","sentAt":"2005-04-19T22:56:23Z","receivedAt":"2005-04-19T22:56:23Z","isPatch":false,"sender":{"key":"dwheeler@dwheeler.com","avatar":"https://avatars.githubusercontent.com/u/813150?v=4"},"body":"Petr Baudis wrote:\n\n>Dear diary, on Tue, Apr 19, 2005 at 03:48:43PM CEST, I got a letter\n>where Ingo Molnar <mingo@elte.hu> told me that...\n>  \n>\n>>is there any 'export commit as patch' support in git-pasky?\n>>    \n>>\n>\n>Nice idea. I will add it, probably as 'git patch'.\n>\n>  \n>\nEek!\n\nIt's a nice idea, and it'd be great as a subcommand.  But PLEASE\ndon't name it \"patch\".  I already know what \"patch\" does, \"patch\"\nACCEPTS a patch... it doesn't create one ;-).\n\nHow about naming it \"aspatch\" or \"asdiff\" instead?  Or something else\n(good names, anyone?).\n\n<soapbox_to_choir>Good externally-viewed names are critical... good\ncommand names that are similar to what people \"already know\"\ncan really help make the tool a joy to use.</soapbox_to_choir>\n\n--- David A. Wheeler\n\n\n"},{"id":"927","messageId":"4265BFC3.9080105@dwheeler.com","threadId":"140","inReplyTo":"20050419194108.GN12757@pasky.ji.cz","subject":"Re: [script] ge: export commits as patches","fromName":"David A. Wheeler","fromEmail":"dwheeler@dwheeler.com","sentAt":"2005-04-20T02:34:43Z","receivedAt":"2005-04-20T02:34:43Z","isPatch":false,"sender":{"key":"dwheeler@dwheeler.com","avatar":"https://avatars.githubusercontent.com/u/813150?v=4"},"body":"Forget my earlier \"aspatch\" proposal, that's a lousy name.\n\nHow about \"mkpatch\"?  Seems like a reasonable name for\na command that makes a patch.  GNU Arch uses that command name.\nCVS & Subversion basically do this as part of \"diff\"\n(which is another possibility).\n\n--- David A. Wheeler\n"},{"id":"1009","messageId":"dn7jix8iu0.fsf@magla.zg.iskon.hr","threadId":"140","inReplyTo":"20050419134843.GA19146@elte.hu","subject":"Re: [script] ge: export commits as patches","fromName":"Zlatko Calusic","fromEmail":"zlatko.calusic@iskon.hr","sentAt":"2005-04-20T17:21:43Z","receivedAt":"2005-04-20T17:21:43Z","isPatch":false,"sender":{"key":"zlatko.calusic@iskon.hr","avatar":null},"body":"Ingo Molnar <mingo@elte.hu> writes:\n\n> TREE1=$(cat-file commit 2>/dev/null $1 | head -4 | grep ^tree | cut -d' ' -f2)\n                                         --------------------------------------\n\nAnd to make it easier on your eyes, you can always rewrite stuff like\nthat (mentioned everywhere these days :)) like:\n\nTREE1=$(cat-file commit 2>/dev/null $1 | awk '/^tree/ {print $2}'\n                                         ------------------------\n\nNo, I'm definitely not trying to save some CPU cycles, CPU cycles are\ncheap, eyes are expensive! :)\n-- \nZlatko\n"}]}