{"thread":{"id":"19851","subject":"[PATCH] add: allow configurations to be overriden by command line","startedAt":"2009-06-18T09:17:54Z","lastAt":"2009-06-22T07:42:52Z","messageCount":7,"participants":["Stephen Boyd","Junio C Hamano","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"116551","messageId":"1245316674-32377-1-git-send-email-bebarino@gmail.com","threadId":"19851","inReplyTo":null,"subject":"[PATCH] add: allow configurations to be overriden by command line","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-06-18T09:17:54Z","receivedAt":"2009-06-18T09:17:54Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Don't call git_config after parsing the command line options, otherwise\nthe config settings will override any settings made by the command line.\n\nThis can be seen by setting add.ignore_errors and then specifying\n--no-ignore-errors when using git-add.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n builtin-add.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-add.c b/builtin-add.c\nindex c1b229a..56e5221 100644\n--- a/builtin-add.c\n+++ b/builtin-add.c\n@@ -298,6 +298,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)\n \tint add_new_files;\n \tint require_pathspec;\n \n+\tgit_config(add_config, NULL);\n+\n \targc = parse_options(argc, argv, prefix, builtin_add_options,\n \t\t\t  builtin_add_usage, PARSE_OPT_KEEP_ARGV0);\n \tif (patch_interactive)\n@@ -305,8 +307,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)\n \tif (add_interactive)\n \t\texit(interactive_add(argc - 1, argv + 1, prefix));\n \n-\tgit_config(add_config, NULL);\n-\n \tif (edit_interactive)\n \t\treturn(edit_patch(argc, argv, prefix));\n \targc--;\n-- \n1.6.3.2.306.g4f4fa\n"},{"id":"116583","messageId":"7vfxdxxzps.fsf@alter.siamese.dyndns.org","threadId":"19851","inReplyTo":"1245316674-32377-1-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH] add: allow configurations to be overriden by command line","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-06-18T16:40:15Z","receivedAt":"2009-06-18T16:40:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> Don't call git_config after parsing the command line options, otherwise\n> the config settings will override any settings made by the command line.\n\nAmusing.\n\nThis dates back to the original 0d78153 (Do \"git add\" as a builtin,\n2006-05-17).  It had two git_config() calls (one before command line\nparsing, and then another).\n\nThen 11be42a (Make git-mv a builtin, 2006-07-26) noticed this duplicate\ncalls, and removed the wrong one.\n\nThe calling sequence has been the same ever since; parse-opt-ification\n5c46f75 (Port builtin-add.c to use the new option parser., 2007-10-03) \ndid not affect it either.\n\nPerhaps this deserves a test.  It is an ancient breakage nobody noticed so\nfar.\n\nThanks\n"},{"id":"116593","messageId":"4A3A8412.7070705@gmail.com","threadId":"19851","inReplyTo":"7vfxdxxzps.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] add: allow configurations to be overriden by command line","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-06-18T18:14:42Z","receivedAt":"2009-06-18T18:14:42Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Junio C Hamano wrote:\n>\n> Perhaps this deserves a test.  It is an ancient breakage nobody noticed so\n> far\n\nI didn't think it would be very useful, which is why I left it out. But\nhey, at least it stops it from happening again. Squash it in if you want.\n\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 6ce8256..91c1f7a 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -242,4 +242,13 @@ test_expect_success 'git add to resolve conflicts on otherwise ignored path' '\n \tgit add track-this\n '\n \n+test_expect_success POSIXPERM '--no-ignore-errors overrides config' '\n+\tgit config add.ignore-errors 1 &&\n+\tgit reset --hard &&\n+\tdate >foo1 &&\n+\ttest_must_fail git add --verbose --no-ignore-errors . &&\n+\t! ( git ls-files foo1 | grep foo1 ) &&\n+\tgit config add.ignore-errors 0\n+'\n+\n test_done\n"},{"id":"116594","messageId":"7veitho0gu.fsf@alter.siamese.dyndns.org","threadId":"19851","inReplyTo":"4A3A8412.7070705@gmail.com","subject":"Re: [PATCH] add: allow configurations to be overriden by command line","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-06-18T18:34:09Z","receivedAt":"2009-06-18T18:34:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> I didn't think it would be very useful, which is why I left it out. But\n> hey, at least it stops it from happening again. Squash it in if you want.\n>\n> diff --git a/t/t3700-add.sh b/t/t3700-add.sh\n> index 6ce8256..91c1f7a 100755\n> --- a/t/t3700-add.sh\n> +++ b/t/t3700-add.sh\n> @@ -242,4 +242,13 @@ test_expect_success 'git add to resolve conflicts on otherwise ignored path' '\n>  \tgit add track-this\n>  '\n>  \n> +test_expect_success POSIXPERM '--no-ignore-errors overrides config' '\n> +\tgit config add.ignore-errors 1 &&\n> +\tgit reset --hard &&\n> +\tdate >foo1 &&\n> +\ttest_must_fail git add --verbose --no-ignore-errors . &&\n> +\t! ( git ls-files foo1 | grep foo1 ) &&\n> +\tgit config add.ignore-errors 0\n> +'\n> +\n>  test_done\n\nWhy do you need POSIXPERM for this?\n"},{"id":"116595","messageId":"4A3A8E73.1010807@gmail.com","threadId":"19851","inReplyTo":"7veitho0gu.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] add: allow configurations to be overriden by command line","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-06-18T18:58:59Z","receivedAt":"2009-06-18T18:58:59Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Junio C Hamano wrote:\n> Why do you need POSIXPERM for this?\n>   \n\nI copied a previous test and it was doing chmod 0 foo2. This test is\nactually depending on that earlier test which is probably bad style,\nsorry. Here's a more insulated version.\n\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 6ce8256..66bdc24 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -221,6 +221,19 @@ test_expect_success POSIXPERM 'git add (add.ignore-errors = false)' '\n        test_must_fail git add --verbose . &&\n        ! ( git ls-files foo1 | grep foo1 )\n '\n+rm -f foo2\n+\n+test_expect_success POSIXPERM '--no-ignore-errors overrides config' '\n+       git config add.ignore-errors 1 &&\n+       git reset --hard &&\n+       date >foo1 &&\n+       date >foo2 &&\n+       chmod 0 foo2 &&\n+       test_must_fail git add --verbose --no-ignore-errors . &&\n+       ! ( git ls-files foo1 | grep foo1 ) &&\n+       git config add.ignore-errors 0\n+'\n+rm -f foo2\n \n test_expect_success BSLASHPSPEC \"git add 'fo\\\\[ou\\\\]bar' ignores foobar\" '\n        git reset --hard &&\n"},{"id":"116742","messageId":"4A3F331E.5080301@viscovery.net","threadId":"19851","inReplyTo":"4A3A8E73.1010807@gmail.com","subject":"[PATCH] t3700-add: add a POSIXPERM prerequisite to a new test","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-06-22T07:30:38Z","receivedAt":"2009-06-22T07:30:38Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"From: Johannes Sixt <j6t@kdbg.org>\n\nThe new test does a 'chmod 0', which does not have the intended\neffect on Windows.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\nStephen Boyd schrieb:\n> Junio C Hamano wrote:\n>> Why do you need POSIXPERM for this?\n> \n> I copied a previous test and it was doing chmod 0 foo2.\n...\n> +test_expect_success POSIXPERM '--no-ignore-errors overrides config' '\n> +       git config add.ignore-errors 1 &&\n> +       git reset --hard &&\n> +       date >foo1 &&\n> +       date >foo2 &&\n> +       chmod 0 foo2 &&\n\nI can only guess that you missed this 'chmod 0' despite Stephen's\nexplanation and dropped POSIXPERM when you applied the patch.\n\n-- Hannes\n\n t/t3700-add.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 6ae5a2c..85eb0fb 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -223,7 +223,7 @@ test_expect_success POSIXPERM 'git add\n '\n rm -f foo2\n\n-test_expect_success '--no-ignore-errors overrides config' '\n+test_expect_success POSIXPERM '--no-ignore-errors overrides config' '\n        git config add.ignore-errors 1 &&\n        git reset --hard &&\n        date >foo1 &&\n-- \n1.6.3.2.1450.g146e1\n"},{"id":"116743","messageId":"7vab40g1dv.fsf@alter.siamese.dyndns.org","threadId":"19851","inReplyTo":"4A3F331E.5080301@viscovery.net","subject":"Re: [PATCH] t3700-add: add a POSIXPERM prerequisite to a new test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-06-22T07:42:52Z","receivedAt":"2009-06-22T07:42:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> From: Johannes Sixt <j6t@kdbg.org>\n>\n> The new test does a 'chmod 0', which does not have the intended\n> effect on Windows.\n>\n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n> Stephen Boyd schrieb:\n>> Junio C Hamano wrote:\n>>> Why do you need POSIXPERM for this?\n>> \n>> I copied a previous test and it was doing chmod 0 foo2.\n> ...\n>> +test_expect_success POSIXPERM '--no-ignore-errors overrides config' '\n>> +       git config add.ignore-errors 1 &&\n>> +       git reset --hard &&\n>> +       date >foo1 &&\n>> +       date >foo2 &&\n>> +       chmod 0 foo2 &&\n>\n> I can only guess that you missed this 'chmod 0' despite Stephen's\n> explanation and dropped POSIXPERM when you applied the patch.\n\nActually, I wanted to add the test to 'maint' and 'maint-$v' for values of\n$v that are lower than 1.6.3, so I did want to drop POSIXPERM on the\nbranch the patch initially applied; I forgot to make an evil merge when I\nmerged the result up, crossing 1.6.2/1.6.3 boundary..\n\nWill queue on 'maint'.  Thanks.\n"}]}