* [PATCH] replace --edit: respect core.editor @ 2016-04-19 14:37 Johannes Schindelin 2016-04-19 16:22 ` Junio C Hamano 2016-04-20 6:38 ` [PATCH v2] " Johannes Schindelin 0 siblings, 2 replies; 10+ messages in thread From: Johannes Schindelin @ 2016-04-19 14:37 UTC (permalink / raw) To: Junio C Hamano; +Cc: git We simply need to read the config, is all. This fixes https://github.com/git-for-windows/git/issues/733 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- builtin/replace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/replace.c b/builtin/replace.c index 748c6ca..02b13f6 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -475,6 +475,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix) return replace_object(argv[0], argv[1], force); case MODE_EDIT: + git_config(git_default_config, NULL); if (argc != 1) usage_msg_opt("-e needs exactly one argument", git_replace_usage, options); -- 2.8.1.206.g8b39b4a ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] replace --edit: respect core.editor 2016-04-19 14:37 [PATCH] replace --edit: respect core.editor Johannes Schindelin @ 2016-04-19 16:22 ` Junio C Hamano 2016-04-20 3:53 ` Jeff King 2016-04-20 6:33 ` Johannes Schindelin 2016-04-20 6:38 ` [PATCH v2] " Johannes Schindelin 1 sibling, 2 replies; 10+ messages in thread From: Junio C Hamano @ 2016-04-19 16:22 UTC (permalink / raw) To: Jeff King, Christian Couder; +Cc: git, Johannes Schindelin "git blame -L475,6 builtin/replace.c" points at b892bb45 (replace: add --edit option, 2014-04-26) and the commit log message names two people who can review this change, so that is what I am doing here. Johannes Schindelin <johannes.schindelin@gmx.de> writes: > We simply need to read the config, is all. > > This fixes https://github.com/git-for-windows/git/issues/733 > > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> > --- > builtin/replace.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/builtin/replace.c b/builtin/replace.c > index 748c6ca..02b13f6 100644 > --- a/builtin/replace.c > +++ b/builtin/replace.c > @@ -475,6 +475,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix) > return replace_object(argv[0], argv[1], force); > > case MODE_EDIT: > + git_config(git_default_config, NULL); > if (argc != 1) > usage_msg_opt("-e needs exactly one argument", > git_replace_usage, options); The placement of git_config() makes me wonder why. I can understand "we only know edit mode needs config, and we know it will never affect other modes to have the new call here", and it would be good for an emergency patch for ancient maintenance track that will not get any other changes or enhancements. I do not think it is a sound reasoning to maintain the codefor the longer term, though. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] replace --edit: respect core.editor 2016-04-19 16:22 ` Junio C Hamano @ 2016-04-20 3:53 ` Jeff King 2016-04-20 5:51 ` Christian Couder 2016-04-20 6:33 ` Johannes Schindelin 1 sibling, 1 reply; 10+ messages in thread From: Jeff King @ 2016-04-20 3:53 UTC (permalink / raw) To: Junio C Hamano; +Cc: Christian Couder, git, Johannes Schindelin On Tue, Apr 19, 2016 at 09:22:37AM -0700, Junio C Hamano wrote: > Johannes Schindelin <johannes.schindelin@gmx.de> writes: > > > We simply need to read the config, is all. > > > > This fixes https://github.com/git-for-windows/git/issues/733 > > > > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> > > --- > > builtin/replace.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/builtin/replace.c b/builtin/replace.c > > index 748c6ca..02b13f6 100644 > > --- a/builtin/replace.c > > +++ b/builtin/replace.c > > @@ -475,6 +475,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix) > > return replace_object(argv[0], argv[1], force); > > > > case MODE_EDIT: > > + git_config(git_default_config, NULL); > > if (argc != 1) > > usage_msg_opt("-e needs exactly one argument", > > git_replace_usage, options); > > The placement of git_config() makes me wonder why. > > I can understand "we only know edit mode needs config, and we know > it will never affect other modes to have the new call here", and it > would be good for an emergency patch for ancient maintenance track > that will not get any other changes or enhancements. I do not think > it is a sound reasoning to maintain the codefor the longer term, > though. Yeah. I agree the patch here is not wrong, but I would prefer to just have git-replace load the config when it starts. It's _possible_ that something might break or misbehave, but IMHO any program which breaks when git_default_config() is run is probably in need of fixing. And I cannot recall any reason we did not read config when "--edit" was added; we just didn't think of it. -Peff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] replace --edit: respect core.editor 2016-04-20 3:53 ` Jeff King @ 2016-04-20 5:51 ` Christian Couder 2016-04-20 6:37 ` Johannes Schindelin 0 siblings, 1 reply; 10+ messages in thread From: Christian Couder @ 2016-04-20 5:51 UTC (permalink / raw) To: Jeff King; +Cc: Junio C Hamano, git, Johannes Schindelin On Wed, Apr 20, 2016 at 5:53 AM, Jeff King <peff@peff.net> wrote: > On Tue, Apr 19, 2016 at 09:22:37AM -0700, Junio C Hamano wrote: > >> I can understand "we only know edit mode needs config, and we know >> it will never affect other modes to have the new call here", and it >> would be good for an emergency patch for ancient maintenance track >> that will not get any other changes or enhancements. I do not think >> it is a sound reasoning to maintain the codefor the longer term, >> though. > > Yeah. I agree the patch here is not wrong, but I would prefer to just > have git-replace load the config when it starts. It's _possible_ that > something might break or misbehave, but IMHO any program which breaks > when git_default_config() is run is probably in need of fixing. I agree. > And I cannot recall any reason we did not read config when "--edit" > was added; we just didn't think of it. Yeah I think so. Thanks, Christian. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] replace --edit: respect core.editor 2016-04-20 5:51 ` Christian Couder @ 2016-04-20 6:37 ` Johannes Schindelin 0 siblings, 0 replies; 10+ messages in thread From: Johannes Schindelin @ 2016-04-20 6:37 UTC (permalink / raw) To: Christian Couder; +Cc: Jeff King, Junio C Hamano, git Hi Christian & Peff, On Wed, 20 Apr 2016, Christian Couder wrote: > On Wed, Apr 20, 2016 at 5:53 AM, Jeff King <peff@peff.net> wrote: > > On Tue, Apr 19, 2016 at 09:22:37AM -0700, Junio C Hamano wrote: > > > >> I can understand "we only know edit mode needs config, and we know it > >> will never affect other modes to have the new call here", and it > >> would be good for an emergency patch for ancient maintenance track > >> that will not get any other changes or enhancements. I do not think > >> it is a sound reasoning to maintain the codefor the longer term, > >> though. > > > > Yeah. I agree the patch here is not wrong, but I would prefer to just > > have git-replace load the config when it starts. It's _possible_ that > > something might break or misbehave, but IMHO any program which breaks > > when git_default_config() is run is probably in need of fixing. > > I agree. Okay. I tried to err on the side of caution (side effects? Ever heard of side effects? ;-)) v2 coming. Ciao, Dscho ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] replace --edit: respect core.editor 2016-04-19 16:22 ` Junio C Hamano 2016-04-20 3:53 ` Jeff King @ 2016-04-20 6:33 ` Johannes Schindelin 2016-04-20 15:26 ` Junio C Hamano 1 sibling, 1 reply; 10+ messages in thread From: Johannes Schindelin @ 2016-04-20 6:33 UTC (permalink / raw) To: Junio C Hamano; +Cc: Jeff King, Christian Couder, git Hi Junio, On Tue, 19 Apr 2016, Junio C Hamano wrote: > "git blame -L475,6 builtin/replace.c" points at b892bb45 (replace: add > --edit option, 2014-04-26) and the commit log message names two people > who can review this change, so that is what I am doing here. D'oh. Sorry. Dscho ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] replace --edit: respect core.editor 2016-04-20 6:33 ` Johannes Schindelin @ 2016-04-20 15:26 ` Junio C Hamano 0 siblings, 0 replies; 10+ messages in thread From: Junio C Hamano @ 2016-04-20 15:26 UTC (permalink / raw) To: Johannes Schindelin; +Cc: Jeff King, Christian Couder, git Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > Hi Junio, > > On Tue, 19 Apr 2016, Junio C Hamano wrote: > >> "git blame -L475,6 builtin/replace.c" points at b892bb45 (replace: add >> --edit option, 2014-04-26) and the commit log message names two people >> who can review this change, so that is what I am doing here. > > D'oh. Sorry. > Dscho Heh, no need to be sorry, that is what maintainers do. If anything, both of us need to thank them for commenting ;-) ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2] replace --edit: respect core.editor 2016-04-19 14:37 [PATCH] replace --edit: respect core.editor Johannes Schindelin 2016-04-19 16:22 ` Junio C Hamano @ 2016-04-20 6:38 ` Johannes Schindelin 2016-04-20 6:53 ` Jeff King 1 sibling, 1 reply; 10+ messages in thread From: Johannes Schindelin @ 2016-04-20 6:38 UTC (permalink / raw) To: Junio C Hamano; +Cc: git, Jeff King, Christian Couder We simply need to read the config, is all. This fixes https://github.com/git-for-windows/git/issues/733 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- builtin/replace.c | 1 + 1 file changed, 1 insertion(+) Interdiff vs v1: diff --git a/builtin/replace.c b/builtin/replace.c index 02b13f6..b58c714 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -440,6 +440,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix) }; check_replace_refs = 0; + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0); @@ -475,7 +476,6 @@ int cmd_replace(int argc, const char **argv, const char *prefix) return replace_object(argv[0], argv[1], force); case MODE_EDIT: - git_config(git_default_config, NULL); if (argc != 1) usage_msg_opt("-e needs exactly one argument", git_replace_usage, options); diff --git a/builtin/replace.c b/builtin/replace.c index 748c6ca..b58c714 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -440,6 +440,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix) }; check_replace_refs = 0; + git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0); -- 2.8.1.207.g7b140d3 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2] replace --edit: respect core.editor 2016-04-20 6:38 ` [PATCH v2] " Johannes Schindelin @ 2016-04-20 6:53 ` Jeff King 2016-04-20 15:29 ` Junio C Hamano 0 siblings, 1 reply; 10+ messages in thread From: Jeff King @ 2016-04-20 6:53 UTC (permalink / raw) To: Johannes Schindelin; +Cc: Junio C Hamano, git, Christian Couder On Wed, Apr 20, 2016 at 08:38:03AM +0200, Johannes Schindelin wrote: > We simply need to read the config, is all. > > This fixes https://github.com/git-for-windows/git/issues/733 > > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Looks good to me. Thanks. -Peff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] replace --edit: respect core.editor 2016-04-20 6:53 ` Jeff King @ 2016-04-20 15:29 ` Junio C Hamano 0 siblings, 0 replies; 10+ messages in thread From: Junio C Hamano @ 2016-04-20 15:29 UTC (permalink / raw) To: Jeff King; +Cc: Johannes Schindelin, git, Christian Couder Jeff King <peff@peff.net> writes: > On Wed, Apr 20, 2016 at 08:38:03AM +0200, Johannes Schindelin wrote: > >> We simply need to read the config, is all. >> >> This fixes https://github.com/git-for-windows/git/issues/733 >> >> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> > > Looks good to me. Thanks. Yup, I think the new placement is at the most logical place, just before parse options. I looked at other codepaths and I do not see a reason why they shouldn't read the configuration variables. Thanks, both. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-04-20 15:29 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-04-19 14:37 [PATCH] replace --edit: respect core.editor Johannes Schindelin 2016-04-19 16:22 ` Junio C Hamano 2016-04-20 3:53 ` Jeff King 2016-04-20 5:51 ` Christian Couder 2016-04-20 6:37 ` Johannes Schindelin 2016-04-20 6:33 ` Johannes Schindelin 2016-04-20 15:26 ` Junio C Hamano 2016-04-20 6:38 ` [PATCH v2] " Johannes Schindelin 2016-04-20 6:53 ` Jeff King 2016-04-20 15:29 ` Junio C Hamano
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).