From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 6B4851F619 for ; Wed, 26 Feb 2020 03:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726112AbgBZDrc (ORCPT ); Tue, 25 Feb 2020 22:47:32 -0500 Received: from cloud.peff.net ([104.130.231.41]:54494 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726024AbgBZDrc (ORCPT ); Tue, 25 Feb 2020 22:47:32 -0500 Received: (qmail 17039 invoked by uid 109); 26 Feb 2020 03:47:32 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with SMTP; Wed, 26 Feb 2020 03:47:32 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 22721 invoked by uid 111); 26 Feb 2020 03:56:38 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Tue, 25 Feb 2020 22:56:38 -0500 Authentication-Results: peff.net; auth=none Date: Tue, 25 Feb 2020 22:47:31 -0500 From: Jeff King To: "brian m. carlson" Cc: Chris Jerdonek , git@vger.kernel.org Subject: Re: create reflog for reflog-less ref Message-ID: <20200226034731.GA2915944@coredump.intra.peff.net> References: <20200226023909.GC7911@camp.crustytoothpaste.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200226023909.GC7911@camp.crustytoothpaste.net> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Wed, Feb 26, 2020 at 02:39:09AM +0000, brian m. carlson wrote: > There is the option core.logAllRefUpdates, which has the value "always" > in more modern versions of Git. The documentation says, > > If [the option is set to always, then a missing reflog is > automatically created for any ref under refs/. > > Now, that assumes that you want reflogs for all your refs, but there's > really not much downside to having a reflog and not using it. The current rule is actually to append to any reflog that already exists, or to consult core.logAllRefUpdates when deciding whether to create one that doesn't exist. So I think setting a one-shot config variable like: git -c core.logAllRefUpdates=always update-ref refs/foo/bar ... would create the reflog, and then any subsequent updates (even without that config set) would append to it. You can also do this: mkdir -p .git/logs/refs/foo/ touch .git/logs/refs/foo/bar git update-ref refs/foo/bar ... but I wouldn't recommend it. When we eventually move to supporting other ref backend formats, they won't necessarily store the logs in the same way. -Peff