{"thread":{"id":"28215","subject":"[PATCH] log: Do not decorate replacements with --no-replace-objects","startedAt":"2011-08-25T13:44:06Z","lastAt":"2011-08-25T21:22:21Z","messageCount":5,"participants":["Michael J Gruber","Nguyen Thai Ngoc Duy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"174227","messageId":"ad41e81daa6f9fc4654ae4c312f293202519a5d0.1314279822.git.git@drmicha.warpmail.net","threadId":"28215","inReplyTo":null,"subject":"[PATCH] log: Do not decorate replacements with --no-replace-objects","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-08-25T13:44:06Z","receivedAt":"2011-08-25T13:44:06Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"5267d29 (log: decorate \"replaced\" on to replaced commits, 2011-08-19)\nintroduced textual decorations for replaced commits, based on the\ndetection of refs/replace.\n\nMake it so that additionally the use of --no-replace-objects is\ndetected: I.e. replaced commits are only decorated as replaced when they\nare actually replaced.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nSorry for being late to the party. Trying to keep up.\n---\n log-tree.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 74fc20d..2066bb7 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -95,7 +95,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in\n \tstruct object *obj;\n \tenum decoration_type type = DECORATION_NONE;\n \n-\tif (!prefixcmp(refname, \"refs/replace/\")) {\n+\tif (read_replace_refs && !prefixcmp(refname, \"refs/replace/\")) {\n \t\tunsigned char original_sha1[20];\n \t\tif (get_sha1_hex(refname + 13, original_sha1)) {\n \t\t\twarning(\"invalid replace ref %s\", refname);\n-- \n1.7.6.845.gc3c05\n"},{"id":"174228","messageId":"CACsJy8BOhU7-aTN2TPRRoQ=_mSfbOstXFRfpyoPmrr_Gbqg0pg@mail.gmail.com","threadId":"28215","inReplyTo":"ad41e81daa6f9fc4654ae4c312f293202519a5d0.1314279822.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] log: Do not decorate replacements with --no-replace-objects","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-08-25T13:55:56Z","receivedAt":"2011-08-25T13:55:56Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/8/25 Michael J Gruber <git@drmicha.warpmail.net>:\n> Make it so that additionally the use of --no-replace-objects is\n> detected: I.e. replaced commits are only decorated as replaced when they\n> are actually replaced.\n\nYeah.. I forgot about this.\n\n> @@ -95,7 +95,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in\n>        struct object *obj;\n>        enum decoration_type type = DECORATION_NONE;\n>\n> -       if (!prefixcmp(refname, \"refs/replace/\")) {\n> +       if (read_replace_refs && !prefixcmp(refname, \"refs/replace/\")) {\n>                unsigned char original_sha1[20];\n>                if (get_sha1_hex(refname + 13, original_sha1)) {\n>                        warning(\"invalid replace ref %s\", refname);\n\nYou should put \"if (!read_replace_refs) return 0;\" inside \"if\n(!prefixcmp..\", otherwise it'll come to the ref decoration code below\nand my second paragraph in 5267d29's commit message will be reverted.\n\nI thought my patch was\n - simple\n - replace is rarely used\ntherefore neglected the tests. Perhaps you can also add a few tests\nhere. It's not that simple after all.\n-- \nDuy\n"},{"id":"174230","messageId":"4E566586.5010901@drmicha.warpmail.net","threadId":"28215","inReplyTo":"CACsJy8BOhU7-aTN2TPRRoQ=_mSfbOstXFRfpyoPmrr_Gbqg0pg@mail.gmail.com","subject":"Re: [PATCH] log: Do not decorate replacements with --no-replace-objects","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-08-25T15:08:54Z","receivedAt":"2011-08-25T15:08:54Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Nguyen Thai Ngoc Duy venit, vidit, dixit 25.08.2011 15:55:\n> 2011/8/25 Michael J Gruber <git@drmicha.warpmail.net>:\n>> Make it so that additionally the use of --no-replace-objects is\n>> detected: I.e. replaced commits are only decorated as replaced when they\n>> are actually replaced.\n> \n> Yeah.. I forgot about this.\n> \n>> @@ -95,7 +95,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in\n>>        struct object *obj;\n>>        enum decoration_type type = DECORATION_NONE;\n>>\n>> -       if (!prefixcmp(refname, \"refs/replace/\")) {\n>> +       if (read_replace_refs && !prefixcmp(refname, \"refs/replace/\")) {\n>>                unsigned char original_sha1[20];\n>>                if (get_sha1_hex(refname + 13, original_sha1)) {\n>>                        warning(\"invalid replace ref %s\", refname);\n> \n> You should put \"if (!read_replace_refs) return 0;\" inside \"if\n> (!prefixcmp..\", otherwise it'll come to the ref decoration code below\n> and my second paragraph in 5267d29's commit message will be reverted.\n\nRight, thanks for checking.\n\n> I thought my patch was\n>  - simple\n>  - replace is rarely used\n> therefore neglected the tests. Perhaps you can also add a few tests\n> here. It's not that simple after all.\n\nIt would take a bit to do so, but this is a fix to a recently introduced\nfeature, so it should go along quickly. v2 upcoming.\n\nMichael\n"},{"id":"174231","messageId":"739ff64bdbd0c099b3baf0755c0350de82c1ec0a.1314284204.git.git@drmicha.warpmail.net","threadId":"28215","inReplyTo":"4E566586.5010901@drmicha.warpmail.net","subject":"[PATCHv2] log: Do not decorate replacements with --no-replace-objects","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-08-25T15:09:30Z","receivedAt":"2011-08-25T15:09:30Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"5267d29 (log: decorate \"replaced\" on to replaced commits, 2011-08-19)\nintroduced textual decorations for replaced commits, based on the\ndetection of refs/replace.\n\nMake it so that additionally the use of --no-replace-objects is\ndetected: I.e. replaced commits are only decorated as replaced when they\nare actually replaced.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nSorry for being late to the party. Trying to keep up.\n---\n log-tree.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 74fc20d..f65f6b6 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -96,6 +96,8 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in\n \tenum decoration_type type = DECORATION_NONE;\n \n \tif (!prefixcmp(refname, \"refs/replace/\")) {\n+\t\tif (!read_replace_refs)\n+\t\t\treturn 0;\n \t\tunsigned char original_sha1[20];\n \t\tif (get_sha1_hex(refname + 13, original_sha1)) {\n \t\t\twarning(\"invalid replace ref %s\", refname);\n-- \n1.7.6.845.gc3c05\n"},{"id":"174270","messageId":"7vty95i3ua.fsf@alter.siamese.dyndns.org","threadId":"28215","inReplyTo":"739ff64bdbd0c099b3baf0755c0350de82c1ec0a.1314284204.git.git@drmicha.warpmail.net","subject":"Re: [PATCHv2] log: Do not decorate replacements with --no-replace-objects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-25T21:22:21Z","receivedAt":"2011-08-25T21:22:21Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks, both. Will apply.\n"}]}