{"thread":{"id":"13354","subject":"BUG: \"git checkout\" displays Q-escaped commit titles","startedAt":"2008-05-02T13:39:03Z","lastAt":"2008-05-04T19:45:41Z","messageCount":4,"participants":["Teemu Likonen","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"75839","messageId":"20080502133903.GA3079@mithlond.arda.local","threadId":"13354","inReplyTo":null,"subject":"BUG: \"git checkout\" displays Q-escaped commit titles","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-05-02T13:39:03Z","receivedAt":"2008-05-02T13:39:03Z","isPatch":false,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"When commit message's first line (i.e. the title) contains non-Ascii\ncharacters \"git checkout <commit>\" displays this title in Q-escaped form\nwhich looks something like this: =?utf-8?q?=C3=84=C3=A4kk=C3=B6si=C3=A4?=\n\nSteps to reproduce:\n\n$ mkdir repo\n$ cd repo\n$ git init\n$ echo stuff >file\n$ git add file\n$ git commit -m \"Ääkkösiä\"\n$ git checkout $(git rev-list -1 HEAD)\nNote: moving to \"dc968d26f2fb74a6991c03798ee1d7aab458548a\" which isn't a local branch\nIf you want to create a new branch from this checkout, you may do so\n(now or later) by using -b with the checkout command again. Example:\n  git checkout -b <new_branch_name>\nHEAD is now at dc968d2... =?utf-8?q?=C3=84=C3=A4kk=C3=B6si=C3=A4?=\n"},{"id":"75843","messageId":"20080502140536.GA3518@sigill.intra.peff.net","threadId":"13354","inReplyTo":"20080502133903.GA3079@mithlond.arda.local","subject":"Re: BUG: \"git checkout\" displays Q-escaped commit titles","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-02T14:05:36Z","receivedAt":"2008-05-02T14:05:36Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 02, 2008 at 04:39:03PM +0300, Teemu Likonen wrote:\n\n> When commit message's first line (i.e. the title) contains non-Ascii\n> characters \"git checkout <commit>\" displays this title in Q-escaped form\n> which looks something like this: =?utf-8?q?=C3=84=C3=A4kk=C3=B6si=C3=A4?=\n\nDefinitely a bug. This patch fixes it, but I'm not sure it's the best\nsolution. It seems like pp_title_line should perhaps just be checking\nfor fmt == CMIT_FMT_EMAIL, but I'm not sure if that would break anything\nelse, and I don't have time to investigate further right now.\n\n-- >8 --\ncheckout: don't rfc2047-encode oneline on detached HEAD\n\nWhen calling pretty_print_commit, there is an implicit\nassumption that passing in a non-NULL \"subject\" variable\nfor oneline or email formats means that the output is part\nof a subject and therefore \"subject\" to rfc2047 encoding.\nThis is not the desired effect when reporting the movement\nof detached HEAD.\n---\n builtin-checkout.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-checkout.c b/builtin-checkout.c\nindex 14b2fe7..10ec137 100644\n--- a/builtin-checkout.c\n+++ b/builtin-checkout.c\n@@ -142,7 +142,7 @@ static void describe_detached_head(char *msg, struct commit *commit)\n \tstruct strbuf sb;\n \tstrbuf_init(&sb, 0);\n \tparse_commit(commit);\n-\tpretty_print_commit(CMIT_FMT_ONELINE, commit, &sb, 0, \"\", \"\", 0, 0);\n+\tpretty_print_commit(CMIT_FMT_ONELINE, commit, &sb, 0, NULL, NULL, 0, 0);\n \tfprintf(stderr, \"%s %s... %s\\n\", msg,\n \t\tfind_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV), sb.buf);\n \tstrbuf_release(&sb);\n-- \n1.5.5.1.221.ga481\n"},{"id":"75968","messageId":"7vlk2qsukd.fsf@gitster.siamese.dyndns.org","threadId":"13354","inReplyTo":"20080502140536.GA3518@sigill.intra.peff.net","subject":"Re: BUG: \"git checkout\" displays Q-escaped commit titles","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-04T01:54:10Z","receivedAt":"2008-05-04T01:54:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> .... It seems like pp_title_line should perhaps just be checking\n> for fmt == CMIT_FMT_EMAIL, but I'm not sure if that would break anything\n> else,...\n\nYeah, your patch obviously would fix the caller, as subject and\nafter_subject should not be given unless you are doing FMT_EMAIL.  But I\nalso think we should not even look at subject and after_subject unless fmt\nis CMIT_FMT_EMAIL inside pp_title_line().\n"},{"id":"76038","messageId":"20080504194541.GD13029@sigill.intra.peff.net","threadId":"13354","inReplyTo":"7vlk2qsukd.fsf@gitster.siamese.dyndns.org","subject":"Re: BUG: \"git checkout\" displays Q-escaped commit titles","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-04T19:45:41Z","receivedAt":"2008-05-04T19:45:41Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, May 03, 2008 at 06:54:10PM -0700, Junio C Hamano wrote:\n\n> > .... It seems like pp_title_line should perhaps just be checking\n> > for fmt == CMIT_FMT_EMAIL, but I'm not sure if that would break anything\n> > else,...\n> \n> Yeah, your patch obviously would fix the caller, as subject and\n> after_subject should not be given unless you are doing FMT_EMAIL.  But I\n> also think we should not even look at subject and after_subject unless fmt\n> is CMIT_FMT_EMAIL inside pp_title_line().\n\nIt took a look, and that feels a little wrong, too; we end up with a\nfunction that ignores half of its parameters based on the value of one\nof the other parameters, which makes me feel that it really should be\ntwo separate functions.\n\nSo maybe there is some heavier refactoring to be done there. In general,\nI think pretty_print has gotten a bit messy because of the increase in\nthe number of formats.  We might do better to turn it \"inside out\":\nrather than going sequentially through and switching each stage on the\nformat type, make a set of good utility functions and have each format\ntype implemented as a function that builds out of the utility\nprimitives.\n\nI also think we can turn several of the formats into --pretty=format:\naliases, which should make the code a lot simpler.  I had also wanted to\nadd a few features (one of them was giving pretty printing more context\nof the tree walk, so you could do things like --pretty=format:'Patch\nX/Y: %s' where X and Y would be substitutions for \"current number in\nwalk\" and \"total number in walk.\"\n\nI can try to take a look at that sometime in the next week or so, though\nI expect it is major enough surgery to be for the next release cycle.\n\n-Peff\n"}]}