{"thread":{"id":"23411","subject":"[PATCH] Warn the users when more than 3 '-C' given.","startedAt":"2010-04-10T11:51:48Z","lastAt":"2010-04-12T06:48:47Z","messageCount":3,"participants":["Bo Yang","Junio C Hamano","Yann Dirson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"139145","messageId":"1270900308-20147-1-git-send-email-struggleyb.nku@gmail.com","threadId":"23411","inReplyTo":null,"subject":"[PATCH] Warn the users when more than 3 '-C' given.","fromName":"Bo Yang","fromEmail":"struggleyb.nku@gmail.com","sentAt":"2010-04-10T11:51:48Z","receivedAt":"2010-04-10T11:51:48Z","isPatch":true,"sender":{"key":"struggleyb.nku@gmail.com","avatar":"https://avatars.githubusercontent.com/u/233030?v=4"},"body":"Output a warning message to users when there are more than\n3 '-C' options given. And ignore the numeric argument value\nprovided by the additional '-C' options.\n\nSigned-off-by: Bo Yang <struggleyb.nku@gmail.com>\n---\n builtin/blame.c |    9 +++++++++\n 1 files changed, 9 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex fc15863..e8ed547 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -2165,6 +2165,15 @@ static int blame_copy_callback(const struct option *option, const char *arg, int\n \tint *opt = option->value;\n \n \t/*\n+\t * Warn the users when more than 3 '-C' options are given and\n+\t * ignore the corresponding numeric argument of it.\n+\t */\n+\tif (*opt & PICKAXE_BLAME_COPY_HARDEST) {\n+\t\twarning(\"The additional '-C' above 3 is not supported.\");\n+\t\treturn 0;\n+\t}\n+\n+\t/*\n \t * -C enables copy from removed files;\n \t * -C -C enables copy from existing files, but only\n \t *       when blaming a new file;\n-- \n1.7.0.2.273.gc2413.dirty\n"},{"id":"139183","messageId":"7vochrw285.fsf@alter.siamese.dyndns.org","threadId":"23411","inReplyTo":"1270900308-20147-1-git-send-email-struggleyb.nku@gmail.com","subject":"Re: [PATCH] Warn the users when more than 3 '-C' given.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-10T19:12:58Z","receivedAt":"2010-04-10T19:12:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bo Yang <struggleyb.nku@gmail.com> writes:\n\n> Output a warning message to users when there are more than\n> 3 '-C' options given. And ignore the numeric argument value\n> provided by the additional '-C' options.\n\nHow were you bitten by the lack of this warning?  You gave four or five to\nsee how output would change, spent sleepless nights but couldn't figure\nout what the differences between third and fourth levels are, and wasted\ntoo much time?\n\nIOW, what does this fix?\n\nI personally do not see much value in this patch.  It would be just a\nhindrance to remember to remove this hunk when somebody improves the\nalgorithm to add fourth level of detail to the inspection logic.\n"},{"id":"139310","messageId":"20100412084847.58ce8b8b@chalon.bertin.fr","threadId":"23411","inReplyTo":"7vochrw285.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Warn the users when more than 3 '-C' given.","fromName":"Yann Dirson","fromEmail":"dirson@bertin.fr","sentAt":"2010-04-12T06:48:47Z","receivedAt":"2010-04-12T06:48:47Z","isPatch":true,"sender":{"key":"dirson@bertin.fr","avatar":null},"body":"Le Sat, 10 Apr 2010 12:12:58 -0700,\nJunio C Hamano <gitster@pobox.com> a écrit :\n\n> Bo Yang <struggleyb.nku@gmail.com> writes:\n> \n> > Output a warning message to users when there are more than\n> > 3 '-C' options given. And ignore the numeric argument value\n> > provided by the additional '-C' options.\n> \n> How were you bitten by the lack of this warning?  You gave four or\n> five to see how output would change, spent sleepless nights but\n> couldn't figure out what the differences between third and fourth\n> levels are, and wasted too much time?\n\nThat sounding a bit harsh, I guess it is my turn to take the blame for\nsuggesting this in last week's thread :)\n\n\n> IOW, what does this fix?\n\nOne practical advantage of this warning would be, in the very case of\nadding meaning to an additional -C, that a user trying to use it on an\nolder version of git would get a warning that the program might not\nindeed to what the user requested.\n\nHowever, my first feeling was simply that, while it is usually harmless\nto let the user specify a flag several time, when it changes nothing,\nthe situation is different when repetition of the flag is important -\nit is closer to an invalid flag combination.\n\nIn fact, I even dislike that use of repetitive -C.  One could argue\nthat it is much like repetition of -v used in various programs to raise\nverbosity.  But well, in our case, it is much more than just increasing\nthe level of details, it makes it use a different mechanism - even if\neach time it is a superset of the previous one.\n\nAnd what if someone comes with an idea of a \"level of -C\" that indeed\nlays between two existing ones ?  Will we shift the meaning of the\nexisting ones ?  And what about one \"level\" that would not strictly fit\nin the existing \"superset\" chain ?\n\nWhat about instead using a more descriptive flag ?  That would be more\nverbose typing, but then we can still keep the existing flags for\nbackward compatibility, and we also have shell command-line completion.\n\nI'd think about something like:\n-C -C     -> -Cunmodified (that one also for diff)\n-C -C -C  -> -Chistory\n\nI could also argue that \"blame -M\" could also be better placed as a -C\nvariant (it is also supposed to detect some copies), and could have as\nfullname something like \"blame -Csamefile\".\n\n\n> I personally do not see much value in this patch.  It would be just a\n> hindrance to remember to remove this hunk when somebody improves the\n> algorithm to add fourth level of detail to the inspection logic.\n\nWell, the warning should trigger the 1st time that somebody tests his\nfourth -C, right ?\n\n-- \nYann\n"}]}