From patchwork Thu Feb 21 11:16:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10823757 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 DBC071805 for ; Thu, 21 Feb 2019 11:18:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB2373057D for ; Thu, 21 Feb 2019 11:18:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEE1A303EA; Thu, 21 Feb 2019 11:18:21 +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 6149A303EA for ; Thu, 21 Feb 2019 11:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727714AbfBULST (ORCPT ); Thu, 21 Feb 2019 06:18:19 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40351 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726814AbfBULSS (ORCPT ); Thu, 21 Feb 2019 06:18:18 -0500 Received: by mail-pf1-f195.google.com with SMTP id h1so13593720pfo.7 for ; Thu, 21 Feb 2019 03:18: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=Q1STGAwhspv4W/QiXrlxh+NSfu/xQMHcVrif1RNV0oI=; b=i73RCWScYMaSwEtVbMHmdt21IE0bqWoixpvmtelsn5PqfuSwTHfbBYTo+ftSRQyZDb 099UZEZw/qBKA0zjTE3hXerEX7fx+QSVyU2XF2Ei/cU1T3H5KqclSrqUd0V91fz43X7/ 5UgeNKXG19IW3G4o402gqvaZsRNZTLG9EzW7alwMfAOdIjho0ffeq3MdxfXd7b+BXtsP mKlreU3ihz8R5mp5IqtoGu4/KseFz5VwerP+rXD/W7jmBAPUvxJnf0gZ9uEmxlLAVYNU bTQ/AwprrWdV4nmYrptVYUgDimyX6IaeHM7ortaQEk8oHG4IgURw3HRqfkClBF/7NW1u MjoQ== 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=Q1STGAwhspv4W/QiXrlxh+NSfu/xQMHcVrif1RNV0oI=; b=Vb/6Miho23r+PLCBiyYIUCN8PunnQGA62A5urY6EHWFWmG1gowtjvYBKoBz5oAWz9Z iOPjSmfYyw9qQxNVBmrtuz+cKT5JZ/k6SuhLRY1ZbFrI+F6JO6BQpR8OuqhNhE5LbyAX 7MWTMU6wsK69XMb0OX/vE48EW+zXvyb3o5BEowcT0+Rvscoei5L0DVNs9GQ2seG7fHIT WvVZmHqtS2EfNKnlJ353Ygf/oJvg4bhxnwxT1Hw1S7IY0xYWgdbnfE4jISlhYNytnAPh T38B19iE8y3dQztyU4j5GDUWCSVEuDgKjK8myRuKil4hcjuGWWfUJRJ01eY3J2P25CkY RIMw== X-Gm-Message-State: AHQUAuZGUzQCGu2yuA6m6MJ9FSm79LMHD3ftqbNQq+BcxVVGwiDeP8Ca QxYyRtVj+R0qsrIzNbrtrXlhGF5+ X-Google-Smtp-Source: AHgI3IbFyvX/WuPOvhRCG+7SFF5ktYuNZoLbIOtDkCutxU/MbccvVxNdEGTWgVBf2PI2yOBewNI9rA== X-Received: by 2002:a63:c40a:: with SMTP id h10mr34343027pgd.131.1550747898052; Thu, 21 Feb 2019 03:18:18 -0800 (PST) Received: from ash ([115.72.21.220]) by smtp.gmail.com with ESMTPSA id n19sm54659056pfg.67.2019.02.21.03.18.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 03:18:17 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Thu, 21 Feb 2019 18:18:13 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , rybak.a.v@gmail.com, =?utf-8?b?Tmd1?= =?utf-8?b?eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= Subject: [PATCH v4 21/21] diff-parseopt: convert --ignore-some-changes Date: Thu, 21 Feb 2019 18:16:21 +0700 Message-Id: <20190221111621.27180-22-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190221111621.27180-1-pclouds@gmail.com> References: <20190216113655.25728-1-pclouds@gmail.com> <20190221111621.27180-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 Signed-off-by: Junio C Hamano --- diff.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/diff.c b/diff.c index 33492e754f..a63ee4a44d 100644 --- a/diff.c +++ b/diff.c @@ -5109,6 +5109,21 @@ static void prep_parse_options(struct diff_options *options) OPT_BIT(0, "minimal", &options->xdl_opts, N_("produce the smallest possible diff"), XDF_NEED_MINIMAL), + OPT_BIT_F('w', "ignore-all-space", &options->xdl_opts, + N_("ignore whitespace when comparing lines"), + XDF_IGNORE_WHITESPACE, PARSE_OPT_NONEG), + OPT_BIT_F('b', "ignore-space-change", &options->xdl_opts, + N_("ignore changes in amount of whitespace"), + XDF_IGNORE_WHITESPACE_CHANGE, PARSE_OPT_NONEG), + OPT_BIT_F(0, "ignore-space-at-eol", &options->xdl_opts, + N_("ignore changes in whitespace at EOL"), + XDF_IGNORE_WHITESPACE_AT_EOL, PARSE_OPT_NONEG), + OPT_BIT_F(0, "ignore-cr-at-eol", &options->xdl_opts, + N_("ignore carrier-return at the end of line"), + XDF_IGNORE_CR_AT_EOL, PARSE_OPT_NONEG), + OPT_BIT_F(0, "ignore-blank-lines", &options->xdl_opts, + N_("ignore changes whose lines are all blank"), + XDF_IGNORE_BLANK_LINES, PARSE_OPT_NONEG), OPT_GROUP(N_("Diff other options")), OPT_CALLBACK_F(0, "relative", options, N_(""), @@ -5147,17 +5162,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* xdiff options */ - if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space")) - DIFF_XDL_SET(options, IGNORE_WHITESPACE); - else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change")) - DIFF_XDL_SET(options, IGNORE_WHITESPACE_CHANGE); - else if (!strcmp(arg, "--ignore-space-at-eol")) - DIFF_XDL_SET(options, IGNORE_WHITESPACE_AT_EOL); - else if (!strcmp(arg, "--ignore-cr-at-eol")) - DIFF_XDL_SET(options, IGNORE_CR_AT_EOL); - else if (!strcmp(arg, "--ignore-blank-lines")) - DIFF_XDL_SET(options, IGNORE_BLANK_LINES); - else if (!strcmp(arg, "--indent-heuristic")) + if (!strcmp(arg, "--indent-heuristic")) DIFF_XDL_SET(options, INDENT_HEURISTIC); else if (!strcmp(arg, "--no-indent-heuristic")) DIFF_XDL_CLR(options, INDENT_HEURISTIC);