From patchwork Sun Feb 17 10:09:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10816975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3AF671390 for ; Sun, 17 Feb 2019 10:11:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29B64288DA for ; Sun, 17 Feb 2019 10:11:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DC082A263; Sun, 17 Feb 2019 10:11:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C20E0288DA for ; Sun, 17 Feb 2019 10:11:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727930AbfBQKLS (ORCPT ); Sun, 17 Feb 2019 05:11:18 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45652 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbfBQKLS (ORCPT ); Sun, 17 Feb 2019 05:11:18 -0500 Received: by mail-pg1-f196.google.com with SMTP id y4so6987415pgc.12 for ; Sun, 17 Feb 2019 02:11:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2aDEOkbhIcatsxmBr0q9XBMcaZAAyajpHNEGKxEEQVA=; b=ExhkFo115zJq4dilgKvz37WIRPZrXV7XAV8G/luv+HwnglBbA92w+DjjOs9gpZSMUX AXsPqgHJWDXQWj0B9dtni4NB7giyPylq2IE4WVAEMaTQ1vHDYI2+T8HMG71mLqNGAm41 YdMONabtcMuHkywoepjX1QGtomvuhKRJsFOVsU6jQaZ4p5gwARUfD3tSiYZtmqhSlUVw wkhIN2z/BUeQgkr+fWwUBC2INDC+Tkh0ocWgDQLAXik7I6ty7aDeR452Az+emYAvQCMw rRYTuwPuC/5SD5FRrJ8uWoqo5VPmaQdBY6yW8JEwND6R7Cu1X7lmxlkn72foEevxZu5N HpcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2aDEOkbhIcatsxmBr0q9XBMcaZAAyajpHNEGKxEEQVA=; b=A+r+XpYZInMLikI7bzAyu97Lj0nz/4RytCNT+8PQ7tTsxZ665qVQS0x5gMWUBqrrri NzLrnh4sO4snDbZiBwn0200PVLq4JaxwflAys4bBOOYPl3isGExFYzSpGOTCyDu1iUvG uUJ8t98n2u0eK8FUOHgJHD2YWlePdBeZJDu2gaKGyMSlr9XY70DZf6ashgcRd9JHp0g8 RQhgMYDUcI7Vtx6+vcCYaeQU7mL8mvSo2G4XQ9Mj0LhRaDNfGuhO8vkQXOMB0UnpopSE ngJGtjKqQ2KRfqQ8ga2L//DHWwOvOpvpPvnJEru7ooWoydoVZWNChU/+yu6JGvJFdWFs bcng== X-Gm-Message-State: AHQUAubp2XcHJ+s9ocEg+LMw8JfTk4Des4BPk9TkW0jK4f7ekJQh7tKL h8miY1EPUyEf8aAPr84CuLywtNR8 X-Google-Smtp-Source: AHgI3IbrtcaS4cDnDw2jG8v1vZkgrCiuRDYPJOT8f2uZFzF6CmlNg7nov7rAOmwjcc4pw2sjIp0vRQ== X-Received: by 2002:a65:4b83:: with SMTP id t3mr13602261pgq.417.1550398277501; Sun, 17 Feb 2019 02:11:17 -0800 (PST) Received: from ash ([115.72.21.220]) by smtp.gmail.com with ESMTPSA id l5sm13003268pgl.51.2019.02.17.02.11.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Feb 2019 02:11:16 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Sun, 17 Feb 2019 17:11:13 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= Subject: [PATCH 27/31] sha1-name.c: add repo_get_oid() Date: Sun, 17 Feb 2019 17:09:09 +0700 Message-Id: <20190217100913.4127-28-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc0.328.g0e39304f8d In-Reply-To: <20190217100913.4127-1-pclouds@gmail.com> References: <20190217100913.4127-1-pclouds@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 3 ++- sha1-name.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cache.h b/cache.h index 9ff5af0bef..942d9912a2 100644 --- a/cache.h +++ b/cache.h @@ -1354,7 +1354,8 @@ enum get_oid_result { */ }; -extern int get_oid(const char *str, struct object_id *oid); +int repo_get_oid(struct repository *r, const char *str, struct object_id *oid); +#define get_oid(str, oid) repo_get_oid(the_repository, str, oid) extern int get_oid_commit(const char *str, struct object_id *oid); extern int get_oid_committish(const char *str, struct object_id *oid); extern int get_oid_tree(const char *str, struct object_id *oid); diff --git a/sha1-name.c b/sha1-name.c index 64a50d1291..953df0d692 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1573,10 +1573,10 @@ int strbuf_check_branch_ref(struct strbuf *sb, const char *name) * This is like "get_oid_basic()", except it allows "object ID expressions", * notably "xyz^" for "parent of xyz" */ -int get_oid(const char *name, struct object_id *oid) +int repo_get_oid(struct repository *r, const char *name, struct object_id *oid) { struct object_context unused; - return get_oid_with_context(the_repository, name, 0, oid, &unused); + return get_oid_with_context(r, name, 0, oid, &unused); }