From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Turner Subject: [PATCH v10 4/7] git-reflog: add exists command Date: Tue, 21 Jul 2015 17:04:53 -0400 Message-ID: <1437512696-14672-4-git-send-email-dturner@twopensource.com> References: <1437512696-14672-1-git-send-email-dturner@twopensource.com> Cc: David Turner To: git@vger.kernel.org, mhaggerty@alum.mit.edu X-From: git-owner@vger.kernel.org Tue Jul 21 23:06:07 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 1ZHejk-0001wS-1Z for gcvg-git-2@plane.gmane.org; Tue, 21 Jul 2015 23:06:04 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932836AbbGUVFz (ORCPT ); Tue, 21 Jul 2015 17:05:55 -0400 Received: from mail-qg0-f50.google.com ([209.85.192.50]:34982 "EHLO mail-qg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933408AbbGUVFM (ORCPT ); Tue, 21 Jul 2015 17:05:12 -0400 Received: by qgii95 with SMTP id i95so63123886qgi.2 for ; Tue, 21 Jul 2015 14:05:11 -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=vZUgB4pndvOBe7zXXgKnTHTqfsf/WOsXxRcEoNHqd14=; b=JKVR/xfulFIK3rMc7jsvWKbCxUsnpmB0UpuhaJDn8FtHSwgZlUAEauhAN34e0UdErb aMuzhLRFoMdyahHkwWBYkxv/RDEoBsDeB39+5H3FBZ9NIfRBfsLnhmsH16HZvBDw1rjs Fx/NzGaZOeqlTAjxKUnDHvCh8oRnUoV8guI8xVgiiUVNtjIEZkXw4vNecsTRjC6NvFYY 4sQeL/D/e2Ec5D6xBetfn+nbXNtM9M0+7GVVVRSSMAl5SA+db8Rn6e+Q6eQdaUXmDgWP HX8N7iNyDr+ozz+6M2l6XM9CHRsr0Ts0r5Blqgbes39gTk2a22kyxDJmMw1hYqI6gexw 1atA== X-Gm-Message-State: ALoCoQm4Iku8ilaHLsO+ldVOUlyPDx50CKVQ3sJUW3H/AlTHUo4XRn2LAVYazxvJ0dnntI91o8nL X-Received: by 10.55.41.74 with SMTP id p71mr56465543qkh.82.1437512711785; Tue, 21 Jul 2015 14:05:11 -0700 (PDT) Received: from ubuntu.jfk4.office.twttr.net ([192.133.79.145]) by smtp.gmail.com with ESMTPSA id x137sm13430413qkx.28.2015.07.21.14.05.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Jul 2015 14:05:10 -0700 (PDT) X-Mailer: git-send-email 2.0.4.315.gad8727a-twtrsrc In-Reply-To: <1437512696-14672-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: This is 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..44c736f 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 exits +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=