Message ID | ab7d4c8d89c075de05bf04f1f9dc195145455964.1729439476.git.code@khaugsbakk.name (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | t1400: fix --no-create-reflog test and description | expand |
On Sun, Oct 20, 2024 at 06:12:03PM +0200, kristofferhaugsbakk@fastmail.com wrote: > From: Kristoffer Haugsbakk <code@khaugsbakk.name> > > This test has had the wrong title since it was created.[1] Use `always` > like the description says and negate the expected outcome. > > The test works since `core.logAllRefUpdates` set to `true` does not > create a reflog for that ref namespace. So the test is testing the > config variable, not the option. > > The test itself is fine and does not hide a bug: `--no-create-reflog` is > not supposed to override `core.logAllRefUpdates`. That's actually surprising to me, as command line options tend to override configuration. > † 1: 341fb286212 (refs: add option core.logAllRefUpdates = always, > 2017-01-27) > > Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> > --- > > Notes (series): > From the commit message: > > “ The test itself is fine and does not hide a bug: > `--no-create-reflog` is not supposed to override > > A source for that: roundabout through git-branch(1): > > “ The negated form --no-create-reflog only overrides an earlier > --create-reflog, but currently does not negate the setting of > core.logAllRefUpdates. Hm. The "currently" reads as if this was a known shortcoming rather than by design. > I *suppose* that the same applies to update-ref since (I suppose) they > use the same underlying machinery. > > See also git-tag(1) which says the same thing. > > update-ref should document the same thing, then. I have that marked as > a todo item. The changes there are a bit too involved to implicate in > this submission. So I'm quite torn here. It's documented, even though the documentation doesn't exactly feel like this was designed, but rather like it was a side effect. The test also contradicts the documentation, even though it only worked by chance. And as mentioned above, everywhere else we typically have a design where the command line option overrides the config. Overall I'm rather leaning into the direction of making this work properly. But that would of course be a backwards-incompatible change. Patrick
On Mon, Oct 21, 2024, at 14:08, Patrick Steinhardt wrote: >> […] >> Notes (series): >> From the commit message: >> >> “ The test itself is fine and does not hide a bug: >> `--no-create-reflog` is not supposed to override >> >> A source for that: roundabout through git-branch(1): >> >> “ The negated form --no-create-reflog only overrides an earlier >> --create-reflog, but currently does not negate the setting of >> core.logAllRefUpdates. > > Hm. The "currently" reads as if this was a known shortcoming rather than > by design. I read it as “we might change our minds here—watch out”. ;) It feels very emphasized. Like the documentation was expecting your surprise. >> I *suppose* that the same applies to update-ref since (I suppose) they >> use the same underlying machinery. >> >> See also git-tag(1) which says the same thing. >> >> update-ref should document the same thing, then. I have that marked as >> a todo item. The changes there are a bit too involved to implicate in >> this submission. > > So I'm quite torn here. It's documented, even though the documentation > doesn't exactly feel like this was designed, but rather like it was a > side effect. The test also contradicts the documentation, even though it > only worked by chance. And as mentioned above, everywhere else we > typically have a design where the command line option overrides the > config. > > Overall I'm rather leaning into the direction of making this work > properly. But that would of course be a backwards-incompatible change. Good point. It does feel inconsistent. I agree that the conventional pattern (to my knowledge) is to have options override config when the options are given.
On Mon, Oct 21, 2024 at 06:48:20PM +0200, Kristoffer Haugsbakk wrote: > On Mon, Oct 21, 2024, at 14:08, Patrick Steinhardt wrote: > >> […] > >> Notes (series): > >> From the commit message: > >> > >> “ The test itself is fine and does not hide a bug: > >> `--no-create-reflog` is not supposed to override > >> > >> A source for that: roundabout through git-branch(1): > >> > >> “ The negated form --no-create-reflog only overrides an earlier > >> --create-reflog, but currently does not negate the setting of > >> core.logAllRefUpdates. > > > > Hm. The "currently" reads as if this was a known shortcoming rather than > > by design. > > I read it as “we might change our minds here—watch out”. ;) > > It feels very emphasized. Like the documentation was expecting > your surprise. > > >> I *suppose* that the same applies to update-ref since (I suppose) they > >> use the same underlying machinery. > >> > >> See also git-tag(1) which says the same thing. > >> > >> update-ref should document the same thing, then. I have that marked as > >> a todo item. The changes there are a bit too involved to implicate in > >> this submission. > > > > So I'm quite torn here. It's documented, even though the documentation > > doesn't exactly feel like this was designed, but rather like it was a > > side effect. The test also contradicts the documentation, even though it > > only worked by chance. And as mentioned above, everywhere else we > > typically have a design where the command line option overrides the > > config. > > > > Overall I'm rather leaning into the direction of making this work > > properly. But that would of course be a backwards-incompatible change. > > Good point. It does feel inconsistent. I agree that the conventional > pattern (to my knowledge) is to have options override config when the > options are given. I agree with you both that it feels inconsistent, but I feel somewhat uncomfortable changing the behavior here in a backwards incompatible way. Even if the original documentation leaves the door open to changing the behavior, I think that probably a non-zero number of users has either (a) never read that documentation, or (b) come to rely on it, or (c) both ;-). I think if anything we might consider updating the documentation to more clearly capture the status-quo, but I'd be very hesitant to see a patch changing the behavior here. Thanks, Taylor
On Mon, Oct 21, 2024, at 21:02, Taylor Blau wrote: >> […] >> > Overall I'm rather leaning into the direction of making this work >> > properly. But that would of course be a backwards-incompatible change. >> >> Good point. It does feel inconsistent. I agree that the conventional >> pattern (to my knowledge) is to have options override config when the >> options are given. Agreed, to be clear. ;) > I agree with you both that it feels inconsistent, but I feel somewhat > uncomfortable changing the behavior here in a backwards incompatible > way. > > Even if the original documentation leaves the door open to changing the > behavior, I think that probably a non-zero number of users has either > (a) never read that documentation, or (b) come to rely on it, or (c) > both ;-). > > I think if anything we might consider updating the documentation to more > clearly capture the status-quo, but I'd be very hesitant to see a patch > changing the behavior here. My background (how I ended up in this test) was that I learnt yesterday that `--create-reflog` and this config variable controls whether reflog files are created. I thought that they toggled when entries were made. I have some work in progress patches for clarifying this mechanism in git-config(1) and other places. Now git-tag(1) and git-branch(1) seem decently clear on this point[1] but update-ref is lagging behind IMO. I will be looking at that one as well. † 1: There is also the `--create-reflog` case vs. when the config is `false` but I can’t check that right now
On Mon, Oct 21, 2024 at 11:02:48PM +0200, Kristoffer Haugsbakk wrote: > On Mon, Oct 21, 2024, at 21:02, Taylor Blau wrote: > >> […] > >> > Overall I'm rather leaning into the direction of making this work > >> > properly. But that would of course be a backwards-incompatible change. > >> > >> Good point. It does feel inconsistent. I agree that the conventional > >> pattern (to my knowledge) is to have options override config when the > >> options are given. > > Agreed, to be clear. ;) ;-). > Now git-tag(1) and git-branch(1) seem decently clear on this point[1] > but update-ref is lagging behind IMO. I will be looking at that one as > well. Thanks very much. Thanks, Taylor
I didn’t get the impression that this is expecting a reroll. But I haven’t seen it mentioned or applied to `seen`/`next`?
"Kristoffer Haugsbakk" <code@khaugsbakk.name> writes: > I didn’t get the impression that this is expecting a reroll. But I > haven’t seen it mentioned or applied to `seen`/`next`? If the interim maintainer did not think it is ready to be queued to 'seen', I won't go back to the list archive to pick it up (after all, that is part of trusting interim maintainer is about---otherwise I have to go back and consume all the list backlog, which does not make sense). If a topic is worth resurrecting, do resend it for discussion. Looking at the archived discussion (for this topic I am making an exception), I did not get an impression that this got a "yeah this is a good thing to do" support, only a lukewarm "it may be a starting point in a good direction". Thanks.
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index eb1691860da..9bf87db4775 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -169,14 +169,14 @@ test_expect_success 'core.logAllRefUpdates=always creates reflog for ORIG_HEAD' git reflog exists ORIG_HEAD ' -test_expect_success '--no-create-reflog overrides core.logAllRefUpdates=always' ' - test_config core.logAllRefUpdates true && +test_expect_success '--no-create-reflog does not override core.logAllRefUpdates=always' ' + test_config core.logAllRefUpdates always && test_when_finished "git update-ref -d $outside" && git update-ref --no-create-reflog $outside $A && git rev-parse $A >expect && git rev-parse $outside >actual && test_cmp expect actual && - test_must_fail git reflog exists $outside + git reflog exists $outside ' test_expect_success "create $m (by HEAD)" '