From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Turner Subject: [PATCH v6 6/7] git-reflog: add create and exists functions Date: Mon, 29 Jun 2015 16:17:55 -0400 Message-ID: <1435609076-8592-7-git-send-email-dturner@twopensource.com> References: <1435609076-8592-1-git-send-email-dturner@twopensource.com> Cc: David Turner To: git@vger.kernel.org, mhagger@alum.mit.edu X-From: git-owner@vger.kernel.org Mon Jun 29 22:19:03 2015 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z9fWA-0006i7-QJ for gcvg-git-2@plane.gmane.org; Mon, 29 Jun 2015 22:19:03 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753485AbbF2US7 (ORCPT ); Mon, 29 Jun 2015 16:18:59 -0400 Received: from mail-qc0-f173.google.com ([209.85.216.173]:34215 "EHLO mail-qc0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192AbbF2USs (ORCPT ); Mon, 29 Jun 2015 16:18:48 -0400 Received: by qcji3 with SMTP id i3so46490317qcj.1 for ; Mon, 29 Jun 2015 13:18:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y9vO/NkOnG3S93d1xlQOyi5ZjUd9EH7Qi9Sz6WaR8FM=; b=bN83AIVD9sCEAneaDKsmvR7rnBjlwc5NqWXG21xFIbYngvEBTIXxbpF4YHWyEhzfsu R5yassOsuKeitVi5vu0Kgab7S/ETTYwChZ3kncuMnAyxY0XU058LwsO62dd/ytv4gizM FPDOHCpsmNRnb2X0aewOmq18cTHYcayKU8dqZ1BxiDLvu913MIFowVU+uW9bJw+AY+kF ytFpYI12WnHrslqpdalJpa4CYi3TNMQ1UZVIvbrS8QuqTQlSQcEIuf5UYXPBxIRAIgnv DR4FzCJdLp8DhCt/gbsHgx/zL+A4RicwFmVM7UQBs5JJzH/eRSRVaIlOiQAnOA/bznbt liRw== X-Gm-Message-State: ALoCoQkKiveFmbbpdmKPKUErZKiWIpEVO01rQqzr3ENvc+ku6xzT+toMrkZFwbHed+1fi0WwEV3P X-Received: by 10.55.18.158 with SMTP id 30mr34932962qks.17.1435609127211; Mon, 29 Jun 2015 13:18:47 -0700 (PDT) Received: from ubuntu.jfk4.office.twttr.net ([192.133.79.145]) by mx.google.com with ESMTPSA id 139sm11906090qhx.22.2015.06.29.13.18.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Jun 2015 13:18:46 -0700 (PDT) X-Mailer: git-send-email 2.0.4.315.gad8727a-twtrsrc In-Reply-To: <1435609076-8592-1-git-send-email-dturner@twopensource.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: These are necessary because alternate ref backends might store reflogs somewhere other than .git/logs. Code that now directly manipulates .git/logs should instead go through git-reflog. In a moment, we will use these functions to make git stash work with alternate ref backends. Signed-off-by: David Turner --- Documentation/git-reflog.txt | 10 ++++++ builtin/reflog.c | 75 +++++++++++++++++++++++++++++++++++++++++++- t/t1411-reflog-show.sh | 12 +++++++ 3 files changed, 96 insertions(+), 1 deletion(-) diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt index 5e7908e..2bf8aa6 100644 --- a/Documentation/git-reflog.txt +++ b/Documentation/git-reflog.txt @@ -23,6 +23,8 @@ depending on the subcommand: [--dry-run] [--verbose] [--all | ...] 'git reflog delete' [--rewrite] [--updateref] [--dry-run] [--verbose] ref@\{specifier\}... +'git reflog create' ... +'git reflog exists' Reference logs, or "reflogs", record when the tips of branches and other references were updated in the local repository. Reflogs are @@ -52,6 +54,14 @@ argument must be an _exact_ entry (e.g. "`git reflog delete master@{2}`"). This subcommand is also typically not used directly by end users. +The "create" subcommand creates a reflog for one or more refs. Most +refs (those under refs/heads, refs/remotes, and refs/tags) will +automatically have reflogs created. Other refs will not. This command +allows manual ref creation. + +The "exists" subcommand checks whether a ref has a reflog. It exists +with zero status if the reflog exists, and non-zero status if it does +not. OPTIONS ------- diff --git a/builtin/reflog.c b/builtin/reflog.c index c2eb8ff..3080865 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -13,6 +13,10 @@ static const char reflog_expire_usage[] = "git reflog expire [--expire=