{"thread":{"id":"23871","subject":"Re: [PATCH RFC] Add a config verbose option fetch and push","startedAt":"2010-05-21T13:26:11Z","lastAt":"2010-05-22T14:15:39Z","messageCount":6,"participants":["Nathan W. Panike","Ævar Arnfjörð Bjarmason","Thomas Rast"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"142056","messageId":"4bf6b6f5.dd79dc0a.5533.2acd@mx.google.com","threadId":"23871","inReplyTo":null,"subject":"Re: [PATCH RFC] Add a config verbose option fetch and push","fromName":"Nathan W. Panike","fromEmail":"nathan.panike@gmail.com","sentAt":"2010-05-21T13:26:11Z","receivedAt":"2010-05-21T13:26:11Z","isPatch":true,"sender":{"key":"nathan.panike@gmail.com","avatar":"https://avatars.githubusercontent.com/u/389447?v=4"},"body":"---\n>> \n>> +fetch.verbose::\n>> +\tIf true, it is the same as setting \"-v\" on the command line. If it is\n>> +\tfalse or not defined, git will use the command line parameters to\n>> +\tdecide the verboseness of fetch.\n>> +\n> \n> Don't you usually use the configured option as the default, and \n> then let the command line options override it (e.g., by specifying\n> --no-verbose).\n> \n> //Peter\n> \n\nThis patch fixes this objection.\n\n Documentation/config.txt |    7 +++++++\n builtin/fetch.c          |    7 +++++++\n builtin/push.c           |    7 +++++++\n 3 files changed, 21 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 39140ba..fc88d02 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -860,6 +860,9 @@ fetch.unpackLimit::\n \tespecially on slow filesystems.  If not set, the value of\n \t`transfer.unpackLimit` is used instead.\n \n+fetch.verbose::\n+\tIf true, it is the same as setting \"-v\" on the command line.\n+\n format.attach::\n \tEnable multipart/mixed attachments as the default for\n \t'format-patch'.  The value can also be a double quoted string\n@@ -1495,6 +1498,10 @@ push.default::\n * `tracking` push the current branch to its upstream branch.\n * `current` push the current branch to a branch of the same name.\n \n+push.verbose::\n+\tIf true, it is the same as using the '-v' flag on the command\n+\tline.\n+\n rebase.stat::\n \tWhether to show a diffstat of what changed upstream since the last\n \trebase. False by default.\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 8470850..f4832fe 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -885,6 +885,12 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)\n \treturn exit_code;\n }\n \n+static int git_fetch_verbose_config(const char *var,const char *value, void *dummy)\n+{\n+\tif(!strcmp(\"fetch.verbose\",var))\n+\t\tverbosity = git_config_maybe_bool(NULL,value);\n+}\n+\n int cmd_fetch(int argc, const char **argv, const char *prefix)\n {\n \tint i;\n@@ -897,6 +903,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)\n \tfor (i = 1; i < argc; i++)\n \t\tstrbuf_addf(&default_rla, \" %s\", argv[i]);\n \n+\tgit_config(git_fetch_verbose_config,NULL);\n \targc = parse_options(argc, argv, prefix,\n \t\t\t     builtin_fetch_options, builtin_fetch_usage, 0);\n \ndiff --git a/builtin/push.c b/builtin/push.c\nindex f4358b9..e907b11 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -202,6 +202,12 @@ static int do_push(const char *repo, int flags)\n \treturn !!errs;\n }\n \n+static int git_push_verbose_config(const char *var, const char *value, void *d)\n+{\n+\tif(!strcmp(\"push.verbose\",var))\n+\t\tverbosity = git_config_maybe_bool(NULL,value);\n+}\n+\n int cmd_push(int argc, const char **argv, const char *prefix)\n {\n \tint flags = 0;\n@@ -229,6 +235,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)\n \t};\n \n \tgit_config(git_default_config, NULL);\n+\tgit_config(git_push_verbose_config, NULL);\n \targc = parse_options(argc, argv, prefix, options, push_usage, 0);\n \n \tif (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR))))\n-- \n1.7.1.97.gf85c7\n"},{"id":"142060","messageId":"AANLkTil-PDpdkcJaJn2FUrJrSIJ6lP0OcvY5l7HRorsa@mail.gmail.com","threadId":"23871","inReplyTo":"4bf6b6f5.dd79dc0a.5533.2acd@mx.google.com","subject":"Re: [PATCH RFC] Add a config verbose option fetch and push","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-05-21T17:10:22Z","receivedAt":"2010-05-21T17:10:22Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Since Peter Kjellerstedt wanted --ff-only, and you want --verbose. I\nwonder whether a better solution wouldn't be to farm this\nfunctionality out to the config parser.\n\nI.e. you'd do something like:\n\n    static struct option builtin_fetch_options[] = {\n        OPT__PROGRAM_NAME(\"fetch\"), /* this is new */\n\t    OPT__VERBOSITY(&verbosity),\n    \tOPT_BOOLEAN(0, \"all\", &all,\n\t    \t    \"fetch from all remotes\"),\n        ...\n\nAnd then in your .gitconfig:\n\n    [fetch \"option\"]\n        verbose = 1\n\nIs there any reason not to add such a general facility?\n"},{"id":"142086","messageId":"201005221244.32213.trast@student.ethz.ch","threadId":"23871","inReplyTo":"AANLkTil-PDpdkcJaJn2FUrJrSIJ6lP0OcvY5l7HRorsa@mail.gmail.com","subject":"Re: [PATCH RFC] Add a config verbose option fetch and push","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-05-22T10:44:31Z","receivedAt":"2010-05-22T10:44:31Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n> Since Peter Kjellerstedt wanted --ff-only, and you want --verbose. I\n> wonder whether a better solution wouldn't be to farm this\n> functionality out to the config parser.\n[...]\n>     [fetch \"option\"]\n>         verbose = 1\n> \n> Is there any reason not to add such a general facility?\n\nThat would completely ruin the scriptability of almost all commands.\nImagine the user added the following options as default:\n\n  add --edit\n  checkout --patch\n  cherry-pick --no-commit\n  commit --amend\n  pull --rebase\n\nI'm sure you can find one option that changes the command in something\ncompletely different *for every command*.\n\nIn fact even pull --ff-only has the same problem since it will refuse\nthe merge in cases where an unmodified pull would go through.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"142092","messageId":"AANLkTimQzAM7qA32FRFvQC1cx7UEEKtBxjU89whrSqF5@mail.gmail.com","threadId":"23871","inReplyTo":"201005221244.32213.trast@student.ethz.ch","subject":"Re: [PATCH RFC] Add a config verbose option fetch and push","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-05-22T12:01:29Z","receivedAt":"2010-05-22T12:01:29Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sat, May 22, 2010 at 10:44, Thomas Rast <trast@student.ethz.ch> wrote:\n> Ævar Arnfjörð Bjarmason wrote:\n> That would completely ruin the scriptability of almost all commands.\n> Imagine the user added the following options as default:\n>\n>  add --edit\n>  checkout --patch\n>  cherry-pick --no-commit\n>  commit --amend\n>  pull --rebase\n>\n> I'm sure you can find one option that changes the command in something\n> completely different *for every command*.\n\nSure. But so would adding this as git-add to your $PATH:\n\n    #!/bin/sh\n    /usr/lib/git-core/git-add --edit $@\n\nGit already has plenty of ways to shoot yourself in the foot. I don't\nsee how it's worse if that's done through some generalized facility\nwhich results in less special-case code in individual tools.\n"},{"id":"142098","messageId":"201005221534.18529.trast@student.ethz.ch","threadId":"23871","inReplyTo":"AANLkTimQzAM7qA32FRFvQC1cx7UEEKtBxjU89whrSqF5@mail.gmail.com","subject":"Re: [PATCH RFC] Add a config verbose option fetch and push","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-05-22T13:34:18Z","receivedAt":"2010-05-22T13:34:18Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n> On Sat, May 22, 2010 at 10:44, Thomas Rast <trast@student.ethz.ch> wrote:\n> > Ævar Arnfjörð Bjarmason wrote:\n> > That would completely ruin the scriptability of almost all commands.\n> > Imagine the user added the following options as default:\n> >  add --edit\n[...]\n> > I'm sure you can find one option that changes the command in something\n> > completely different *for every command*.\n> \n> Sure. But so would adding this as git-add to your $PATH:\n> \n>     #!/bin/sh\n>     /usr/lib/git-core/git-add --edit $@\n\nTwo points:\n\n* This way is not documented in git-config(1), as the proposed\n  interface would have to be; hence, it is not \"official\".\n\n* More importantly, it doesn't work; for builtins such as git-add, not\n  even if you put it under the `git --exec-path` (yes, I've tested\n  this).\n\n> Git already has plenty of ways to shoot yourself in the foot.\n\nCan't argue with that.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"142101","messageId":"AANLkTilmv7Kp0LxXXB7bCOs6F55ymnedRCeF4SKkdlJK@mail.gmail.com","threadId":"23871","inReplyTo":"201005221534.18529.trast@student.ethz.ch","subject":"Re: [PATCH RFC] Add a config verbose option fetch and push","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-05-22T14:15:39Z","receivedAt":"2010-05-22T14:15:39Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sat, May 22, 2010 at 13:34, Thomas Rast <trast@student.ethz.ch> wrote:\n> Ævar Arnfjörð Bjarmason wrote:\n>> On Sat, May 22, 2010 at 10:44, Thomas Rast <trast@student.ethz.ch> wrote:\n>> > Ævar Arnfjörð Bjarmason wrote:\n>> > That would completely ruin the scriptability of almost all commands.\n>> > Imagine the user added the following options as default:\n>> >  add --edit\n> [...]\n>> > I'm sure you can find one option that changes the command in something\n>> > completely different *for every command*.\n>>\n>> Sure. But so would adding this as git-add to your $PATH:\n>>\n>>     #!/bin/sh\n>>     /usr/lib/git-core/git-add --edit $@\n>\n> Two points:\n>\n> * This way is not documented in git-config(1), as the proposed\n>  interface would have to be; hence, it is not \"official\".\n>\n> * More importantly, it doesn't work; for builtins such as git-add, not\n>  even if you put it under the `git --exec-path` (yes, I've tested\n>  this).\n\nI actually tested it too and found that it didn't work. Then thought\n\"meh, it's pseudocode\" and pressed \"Send\".\n\nAside from the specific implementation it's easy to make that work the\nright way. You can alias the git command itself and munge its\narguments before passing them on to Git itself.\n\nAnyway, this feature isn't something I actually care about. I only\nwanted to suggest that if we're going to get lots of proposals to add\na specific config flag for some specific option in some specific\ntool. That maybe it would be easier for everyone if there was some\ngeneral facility to do so. It would cut down on special-case code in\nindividual tools.\n\n>> Git already has plenty of ways to shoot yourself in the foot.\n>\n> Can't argue with that.\n\nAnd perhaps a general facility might actually improve scriptability. A\ndetermined user is going to override Git anyway, even if that means\nsome gross hack involving munging $PATH and overriding of Git\nitself. At least if such users were pointed to a general facility\nscript writers could set GIT_IGNORE_CRAZY_USER_DIRECTIVES=1 or\nsomething like that.\n"}]}