From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Turner Subject: [PATCH v8 4/7] git-reflog: add exists command Date: Thu, 9 Jul 2015 18:50:57 -0400 Message-ID: <1436482260-28088-5-git-send-email-dturner@twopensource.com> References: <1436482260-28088-1-git-send-email-dturner@twopensource.com> Cc: David Turner To: git@vger.kernel.org, mhagger@alum.mit.edu, j6t@kdbg.org X-From: git-owner@vger.kernel.org Fri Jul 10 00:51:39 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 1ZDKfK-00075y-Tw for gcvg-git-2@plane.gmane.org; Fri, 10 Jul 2015 00:51:39 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751531AbbGIWvd (ORCPT ); Thu, 9 Jul 2015 18:51:33 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:36488 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751144AbbGIWv3 (ORCPT ); Thu, 9 Jul 2015 18:51:29 -0400 Received: by pacgz10 with SMTP id gz10so84063433pac.3 for ; Thu, 09 Jul 2015 15:51:28 -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=T+VaT1Nd3IA35Nc0Y5Qrw09S24yb5qqSntk+uk9zef0=; b=NSDryI0A9xBfCH+1Cl+B214vXTswQvi7MgeZHEnnwx5ohWn5ssf6GPwAT4a9bBJ82+ fX84J+eu1cQ9keShDIh5FYlxh81Nl88wthtzp8eX4gnQ3Rug9VMMM/rRDZY6brHougyy nb7onjF/SPbbjHqHsInFSQnsiNa3AYy2k5BD4WSxdZ2bnIbN2JQS6M8INcltR+RnbFDr tFZl5reBnxoBp+c8/azhanePAHg/BEGVY2LnCxubIaHY7uTvVDlKnXkvdMLoK1y8ji6w Cyd4qv/vm6VGazd8xra/ShaCxL21Z+8jVXDgjkipYSKqCWMtnSbXbuWzdPEd1/t2bTrJ CANg== X-Gm-Message-State: ALoCoQnaPDu1am0ahUaqtDVapda0G2vDxsvRJ6sLj5LHOwlnif/cZdibz7mC3EUbUsgC4ZOaa4a9 X-Received: by 10.66.121.101 with SMTP id lj5mr35166434pab.113.1436482288546; Thu, 09 Jul 2015 15:51:28 -0700 (PDT) Received: from ubuntu.twitter.corp? (207-38-164-98.c3-0.43d-ubr2.qens-43d.ny.cable.rcn.com. [207.38.164.98]) by smtp.gmail.com with ESMTPSA id fr2sm7129684pdb.22.2015.07.09.15.51.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Jul 2015 15:51:27 -0700 (PDT) X-Mailer: git-send-email 2.0.5.499.g01f6352.dirty-twtrsrc In-Reply-To: <1436482260-28088-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: Theis 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. Signed-off-by: David Turner --- Documentation/git-reflog.txt | 4 ++++ builtin/reflog.c | 33 ++++++++++++++++++++++++++++++++- t/t1411-reflog-show.sh | 5 +++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt index 5e7908e..4b08fc7 100644 --- a/Documentation/git-reflog.txt +++ b/Documentation/git-reflog.txt @@ -23,6 +23,7 @@ depending on the subcommand: [--dry-run] [--verbose] [--all | ...] 'git reflog delete' [--rewrite] [--updateref] [--dry-run] [--verbose] ref@\{specifier\}... +'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 +53,9 @@ 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 "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..7ed0e85 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -13,6 +13,8 @@ static const char reflog_expire_usage[] = "git reflog expire [--expire=