From patchwork Fri Sep 21 15:57:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10610537 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 8FDB514DA for ; Fri, 21 Sep 2018 15:57:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80A942E56D for ; Fri, 21 Sep 2018 15:57:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7486C2E57E; Fri, 21 Sep 2018 15:57:54 +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 CC5E82E57C for ; Fri, 21 Sep 2018 15:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390372AbeIUVrW (ORCPT ); Fri, 21 Sep 2018 17:47:22 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39183 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389804AbeIUVrW (ORCPT ); Fri, 21 Sep 2018 17:47:22 -0400 Received: by mail-lf1-f65.google.com with SMTP id v77-v6so11877699lfa.6 for ; Fri, 21 Sep 2018 08:57:51 -0700 (PDT) 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=0+QhZbZt9w45UpZPze7biwtQnB6PjzcTcm362WzJp6I=; b=vcNBw7pKIu7GXTw03coXEcG57ZTxAWHBxHXJGMy/++elQ+hvPhAK139dZZL0mZASQ/ JAZB9wn+xsXD6Px6QXWFAVVZf7ZHuGQXois3i3202vdJf95dWoIm9w++5OPaTTersZt0 uiARnzsKFSXsKZnaPFgPryvpBcxKDOO7zn4PgOC/CdWwcpYuWx1R9zVwkUYLHWG6OIrZ r+dWuZCANMMTaTnyuz+EsFXmPf65FPo73j1OL8u6MfHLyrvZg3gK21q1KUZrMmdn2TdN X76Ro6UVhEca529HojTkhgYqj0Ew4nW13y/ZlkSOX5913q2fn7ZM3/xC7bneP6ggQOG+ 5qaQ== 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=0+QhZbZt9w45UpZPze7biwtQnB6PjzcTcm362WzJp6I=; b=RSLyfyazc5sQTz9ZNxGI5XLeLKtaEQJoAvcseOYks0QzCFfdKH8cnlQs12Vq+kIEW+ GYTChk1MSm49LegMk+QdCJhzAB9IYN++GbpquzleF60iZ4QYBrlOEwhBEVWksb3FvkSA vbZsfMJt3V6Zuum8sH4fyJ/ekfmcyE8Cu8+0Qx3WYaSndIYg9U5Djt0nkmHPDVJwznj5 8IpKw2TVpZWDFB+RYQH5yUsfPbPHdmKEy3ue1FtcLxfF/nDyl6LEB3vDp40nfL8ZMp/y dw+v/QXEuxyg9hxKYGpxckmMfmkPt6iMh3RAqqwoP7yFZG0ga1odDKn7rk8Ijn7+vpkx srEw== X-Gm-Message-State: APzg51ALjNLw0RIxRt79FI/5/s4VzydSy513YnUfQUpWcyiObNGV/YuZ AXoSnU8Sz/YApX2MXw1lhHc= X-Google-Smtp-Source: ANB0Vda9m/o0CJu4MboNAhU4z8ud9RHk329eGSuipLeMbuKpCra9uIak6pb1/HQ2GClRqgBID1rKYg== X-Received: by 2002:a19:e21b:: with SMTP id z27-v6mr31849850lfg.68.1537545470450; Fri, 21 Sep 2018 08:57:50 -0700 (PDT) Received: from localhost.localdomain (c80-216-12-205.bredband.comhem.se. [80.216.12.205]) by smtp.gmail.com with ESMTPSA id o19-v6sm2192978lfk.30.2018.09.21.08.57.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 08:57:49 -0700 (PDT) From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: pclouds@gmail.com Cc: git@vger.kernel.org, gitster@pobox.com, sbeller@google.com Subject: [PATCH v5 02/23] read-cache.c: remove 'const' from index_has_changes() Date: Fri, 21 Sep 2018 17:57:18 +0200 Message-Id: <20180921155739.14407-3-pclouds@gmail.com> X-Mailer: git-send-email 2.19.0.640.gcd3aa10a8a In-Reply-To: <20180921155739.14407-1-pclouds@gmail.com> References: <20180915161759.8272-1-pclouds@gmail.com> <20180921155739.14407-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 This function calls do_diff_cache() which eventually needs to set this "istate" to unpack_options->src_index [1]. This is an unfortunate fact that unpack_trees() _will_ update [2] src_index so we can't really pass a const index_state there. Just remove 'const'. [1] Right now diff_cache() in diff-lib.c assigns the_index to src_index. But the plan is to get rid of the_index, so it should be 'istate' from here that gets assigned to src_index. [2] Some transient bits in the source index are touched. Optional extensions can also be removed. But other than that the source tree should still be valid. Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 2 +- read-cache.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cache.h b/cache.h index 4d014541ab..260e4ee44a 100644 --- a/cache.h +++ b/cache.h @@ -703,7 +703,7 @@ extern int unmerged_index(const struct index_state *); * provided, the space-separated list of files that differ will be appended * to it. */ -extern int index_has_changes(const struct index_state *istate, +extern int index_has_changes(struct index_state *istate, struct tree *tree, struct strbuf *sb); diff --git a/read-cache.c b/read-cache.c index 7b1354d759..86134e56a6 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2122,7 +2122,7 @@ int unmerged_index(const struct index_state *istate) return 0; } -int index_has_changes(const struct index_state *istate, +int index_has_changes(struct index_state *istate, struct tree *tree, struct strbuf *sb) {