{"thread":{"id":"11823","subject":"[PATCH] Fix \"git checkout -b foo ':/substring'\"","startedAt":"2008-02-02T03:06:56Z","lastAt":"2008-02-02T09:01:27Z","messageCount":3,"participants":["Junio C Hamano","Daniel Barkalow"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"67072","messageId":"7v1w7w6oq7.fsf@gitster.siamese.dyndns.org","threadId":"11823","inReplyTo":null,"subject":"[PATCH] Fix \"git checkout -b foo ':/substring'\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-02T03:06:56Z","receivedAt":"2008-02-02T03:06:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Because ':/substring' extended SHA1 expression cannot take\npostfix modifiers such as ^{tree} and ^{commit}, we would need\nto do it in multiple steps.  With the patch, you can start a new\nbranch from a randomly-picked commit whose message has the named\nstring in it.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * As we advertize that \":/string\" syntax is usable for any\n   command that wnats to take a commit object name in the\n   Release Notes, we might want to put this in 1.5.4 final.  It\n   looks simple and safe enough.\n\ndiff --git a/git-checkout.sh b/git-checkout.sh\nindex 5621c69..bd74d70 100755\n--- a/git-checkout.sh\n+++ b/git-checkout.sh\n@@ -71,7 +71,8 @@ while test $# != 0; do\n done\n \n arg=\"$1\"\n-if rev=$(git rev-parse --verify \"$arg^0\" 2>/dev/null)\n+rev=$(git rev-parse --verify \"$arg\" 2>/dev/null)\n+if rev=$(git rev-parse --verify \"$rev^0\" 2>/dev/null)\n then\n \t[ -z \"$rev\" ] && die \"unknown flag $arg\"\n \tnew_name=\"$arg\"\n@@ -82,11 +83,11 @@ then\n \tfi\n \tnew=\"$rev\"\n \tshift\n-elif rev=$(git rev-parse --verify \"$arg^{tree}\" 2>/dev/null)\n+elif rev=$(git rev-parse --verify \"$rev^{tree}\" 2>/dev/null)\n then\n \t# checking out selected paths from a tree-ish.\n \tnew=\"$rev\"\n-\tnew_name=\"$arg^{tree}\"\n+\tnew_name=\"$rev^{tree}\"\n \tshift\n fi\n [ \"$1\" = \"--\" ] && shift\n"},{"id":"67088","messageId":"alpine.LNX.1.00.0802020331210.13593@iabervon.org","threadId":"11823","inReplyTo":"7v1w7w6oq7.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Fix \"git checkout -b foo ':/substring'\"","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-02-02T08:32:32Z","receivedAt":"2008-02-02T08:32:32Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Fri, 1 Feb 2008, Junio C Hamano wrote:\n\n> Because ':/substring' extended SHA1 expression cannot take\n> postfix modifiers such as ^{tree} and ^{commit}, we would need\n> to do it in multiple steps.  With the patch, you can start a new\n> branch from a randomly-picked commit whose message has the named\n> string in it.\n\nCould we have a test for this? I'm not exactly sure how to use it, and I \nwant to make sure my C version works.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"67090","messageId":"7vprvf3f6g.fsf@gitster.siamese.dyndns.org","threadId":"11823","inReplyTo":"alpine.LNX.1.00.0802020331210.13593@iabervon.org","subject":"Re: [PATCH] Fix \"git checkout -b foo ':/substring'\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-02T09:01:27Z","receivedAt":"2008-02-02T09:01:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> writes:\n\n> Could we have a test for this? I'm not exactly sure how to use it, and I \n> want to make sure my C version works.\n\n$ git checkout -b newone ':/Initial revision of \"git\"'\n$ git log\ncommit e83c5163316f89bfbde7d9ab23ca2e25604af290\nAuthor: Linus Torvalds <torvalds@ppc970.osdl.org>\nDate:   Thu Apr 7 15:13:13 2005 -0700\n\n    Initial revision of \"git\", the information manager from hell\n\n;-)\n"}]}