From patchwork Tue Mar 5 12:30:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839393 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 40EF3139A for ; Tue, 5 Mar 2019 12:30:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FE062B102 for ; Tue, 5 Mar 2019 12:30:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24A0B2B350; Tue, 5 Mar 2019 12:30:51 +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 C68482B102 for ; Tue, 5 Mar 2019 12:30:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728183AbfCEMat (ORCPT ); Tue, 5 Mar 2019 07:30:49 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35072 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728172AbfCEMat (ORCPT ); Tue, 5 Mar 2019 07:30:49 -0500 Received: by mail-pf1-f193.google.com with SMTP id j5so5598940pfa.2 for ; Tue, 05 Mar 2019 04:30:48 -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=hxERyCsr2cRvd88rOL08MO0R8g9JcvSKzSwYxbV+H5I=; b=egve2aITCWZuO4ZHq1E8ivO8FNa3ESjFQKAX6Baod4aU/9of/KXhn0A7zn5T9/E2k3 h9ViRzaTbYuqPmcOZBVK31lboKaiGzI9TAmB3EqwZR0E4u/2IDdCZU+u5g2aIh2PoI9Z 1b12CV+Sp2oLz0dz55942hDX+g6qSnzNiTa68cBNTKM0dbt7gyIFyEcHk2euXElNHrN4 DHCP6hM1d2gpwMHxC10C0LYcTllfudVSyjXNxzV5xqS2cBVm9mEJxPKMN9vXRxtfVF1W Px31pUJESRhuUPgOam3Pw433oSI5Q4dyI+ViVz+KrOzFtl+XJ85PudJCeFN97ocCzr8V 5FSw== 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=hxERyCsr2cRvd88rOL08MO0R8g9JcvSKzSwYxbV+H5I=; b=fcm6dHyFBPXSuQncfh+odmLAKHiiRV/bHKP04BE0Z6UtRTjD3uXqHO5l8/dqfXsktP fQvXPcchK6cY+pcmH1xA/XIZjArDQfo0Sd9dk4TY2t0fTcyYHpl0RQb04pQ0OOuSxrQn udJtDXTV/Yq8PIMydyHQ5lZ5f3tWG4tJgf+bi2l+TNfx0A7yvKptCFp5uqr0Hv8M5jnM 4/k2yU1yleqrH5VcX0Gg7lqfO31rQVtCXIcq9ELIxfggFsSD1ur54aY1mth/8YpKyuwF xZyPYIICXIcrEm4wI7FZQF45fnAJkulU8Y7VnDKvI5iEH+Ug7CMQQo6GiUt8jxpojVPI uDfQ== X-Gm-Message-State: APjAAAVmYX7A5uQz+cLOlV0oDAO/gBVqZHul1/JONm6RuFqDRUTxpvBO IrK7sJTOOAeThL86B2PvfTEjMh5N X-Google-Smtp-Source: APXvYqwiQNMBGstUaylQB/S3qLX9Ih7FF/MvM7j2nh8wP3RbCjEHQppKl4jQdRHmHr4qEzyfviJ3Vw== X-Received: by 2002:a62:7602:: with SMTP id r2mr1593193pfc.191.1551789048017; Tue, 05 Mar 2019 04:30:48 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id z18sm24893716pfl.164.2019.03.05.04.30.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:30:47 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:30:41 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 01/20] diff-parseopt: convert --[no-]indent-heuristic Date: Tue, 5 Mar 2019 19:30:07 +0700 Message-Id: <20190305123026.7266-2-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/diff.c b/diff.c index a63ee4a44d..c4cd84f1b3 100644 --- a/diff.c +++ b/diff.c @@ -5124,6 +5124,9 @@ static void prep_parse_options(struct diff_options *options) 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_BIT(0, "indent-heuristic", &options->xdl_opts, + N_("heuristic to shift diff hunk boundaries for easy reading"), + XDF_INDENT_HEURISTIC), OPT_GROUP(N_("Diff other options")), OPT_CALLBACK_F(0, "relative", options, N_(""), @@ -5162,11 +5165,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* xdiff options */ - if (!strcmp(arg, "--indent-heuristic")) - DIFF_XDL_SET(options, INDENT_HEURISTIC); - else if (!strcmp(arg, "--no-indent-heuristic")) - DIFF_XDL_CLR(options, INDENT_HEURISTIC); - else if (!strcmp(arg, "--patience")) { + if (!strcmp(arg, "--patience")) { int i; options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF); /* From patchwork Tue Mar 5 12:30:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839395 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 D7B8C17E4 for ; Tue, 5 Mar 2019 12:30:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C50E82B110 for ; Tue, 5 Mar 2019 12:30:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B93302B102; Tue, 5 Mar 2019 12:30:55 +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 594342B102 for ; Tue, 5 Mar 2019 12:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728200AbfCEMay (ORCPT ); Tue, 5 Mar 2019 07:30:54 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34789 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728175AbfCEMay (ORCPT ); Tue, 5 Mar 2019 07:30:54 -0500 Received: by mail-pg1-f195.google.com with SMTP id i130so5553537pgd.1 for ; Tue, 05 Mar 2019 04:30:53 -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=l/Jch/r6hkm+AVQAa4uKNuURqUGzv2jr2kdrudca9Ho=; b=EtoPV1oB93UcgDU0AQzOqfmUm2b6HMulBhZj2ZMB+i+vE3qQE2wjvvFrsq9dtLELUP +MaoYMhUqWdVzKsKmQ9UdunVoUzU3sd6enAAgw0jJpUqdtyU9K8zZptU1h+Gh98D1fW4 iySi+1tzmKXJ03+FFnvr+WPAy9QsmG7NWU77Plkb+s4e71GZwdT27KH4w7IE7GTFl8XC xypA6mMinECg05QAnfUlLfnSl1QK1USka3ZXcPVi7XChdJxzkyfsHtprt9HGGqssrESy uAlmhcSx75eZmRkmTl3Jr89brXcoF02mJDvRj6ZuhRoXrhWVEXLyyUieg5r6bxl5FacA ztkA== 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=l/Jch/r6hkm+AVQAa4uKNuURqUGzv2jr2kdrudca9Ho=; b=I5d1x0fCwmUyPX1uE2D5yYTz9AGoe2RBwMMEg32Tjaoa8VZGAwoHVF1MWpwd1OQUZs v52qjOTf1NgzRrRPUF8VzCR2QP0bgULmJRMjX2huRyxhzZzGg6JjLoA/qYfjbZMW47yo /SXNaiznYfyRLKh915NzCEJDNqjZvTaA+2+/cvdyZiWv0mWhiqdxjuBXmmEw/PqGQbY6 Gopu/7CoGlMG+NaSpF2g2KQb9bc8ZaThU+M97B3gSJ/yGA/6HTgknGn4b/DhQskvnjZV vDzqXQPhR0qSkdimVCApF6tPugwq+33ly+3pF4x4NrNTLL/alniqGAvU0YjJmXyK4BGu e/5g== X-Gm-Message-State: APjAAAV81Pdzc6BJiNsQeiTCECALgoybFY0xdPq+t8k5MSC3HJe+Bx5x EmngIxwxv9yTGhew2TvJb4z/ND0/ X-Google-Smtp-Source: APXvYqxm7Y1CPLfEX/iZ4fNYk5TBQWJiHE0jO0y2e8D0fODu2qhGaEeplPyjALm+ZSkHeTFmDu0ltQ== X-Received: by 2002:a63:7e0e:: with SMTP id z14mr1207637pgc.436.1551789052959; Tue, 05 Mar 2019 04:30:52 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id g3sm11929943pfo.125.2019.03.05.04.30.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:30:52 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:30:48 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 02/20] diff-parseopt: convert --patience Date: Tue, 5 Mar 2019 19:30:08 +0700 Message-Id: <20190305123026.7266-3-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/diff.c b/diff.c index c4cd84f1b3..7899c7cc06 100644 --- a/diff.c +++ b/diff.c @@ -4960,6 +4960,26 @@ static enum parse_opt_result diff_opt_output(struct parse_opt_ctx_t *ctx, return 0; } +static int diff_opt_patience(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + int i; + + BUG_ON_OPT_NEG(unset); + BUG_ON_OPT_ARG(arg); + options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF); + /* + * Both --patience and --anchored use PATIENCE_DIFF + * internally, so remove any anchors previously + * specified. + */ + for (i = 0; i < options->anchors_nr; i++) + free(options->anchors[i]); + options->anchors_nr = 0; + return 0; +} + static int diff_opt_relative(const struct option *opt, const char *arg, int unset) { @@ -5127,6 +5147,10 @@ static void prep_parse_options(struct diff_options *options) OPT_BIT(0, "indent-heuristic", &options->xdl_opts, N_("heuristic to shift diff hunk boundaries for easy reading"), XDF_INDENT_HEURISTIC), + OPT_CALLBACK_F(0, "patience", options, NULL, + N_("generate diff using the \"patience diff\" algorithm"), + PARSE_OPT_NONEG | PARSE_OPT_NOARG, + diff_opt_patience), OPT_GROUP(N_("Diff other options")), OPT_CALLBACK_F(0, "relative", options, N_(""), @@ -5165,18 +5189,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* xdiff options */ - if (!strcmp(arg, "--patience")) { - int i; - options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF); - /* - * Both --patience and --anchored use PATIENCE_DIFF - * internally, so remove any anchors previously - * specified. - */ - for (i = 0; i < options->anchors_nr; i++) - free(options->anchors[i]); - options->anchors_nr = 0; - } else if (!strcmp(arg, "--histogram")) + if (!strcmp(arg, "--histogram")) options->xdl_opts = DIFF_WITH_ALG(options, HISTOGRAM_DIFF); else if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) { long value = parse_algorithm_value(optarg); From patchwork Tue Mar 5 12:30: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: 10839397 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 DDD3017E4 for ; Tue, 5 Mar 2019 12:31:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C54772B102 for ; Tue, 5 Mar 2019 12:31:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9C842B350; Tue, 5 Mar 2019 12:31:00 +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 60E3B2B102 for ; Tue, 5 Mar 2019 12:31:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728206AbfCEMa7 (ORCPT ); Tue, 5 Mar 2019 07:30:59 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43439 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728172AbfCEMa6 (ORCPT ); Tue, 5 Mar 2019 07:30:58 -0500 Received: by mail-pf1-f196.google.com with SMTP id q17so5584380pfh.10 for ; Tue, 05 Mar 2019 04:30:58 -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=+A8vtr9Uuy678JAjKcR+8VWtyQ3GIetirPoUSxB1I3g=; b=M7Ip6GVBmVRxo3wsJOalSDvwWF4gKOAn3lGNJB+cfGEyx2pwRMb0llJw5K92Dmnwdc BrFmBz2MYD0/mgWfexQEbDwvyrBv3iZiAQczCIaqLGV/Vi17LNddJ/S0YbPBR9YK3hdm L67doZ/YVonLDX6IT6HJNlpOfTrbiBp+d+8zVMKAsofptumROZw1EzrKZq4r6muWQm8b EikUFV0Hg4YhUjwMLCFxG8T5cqYQpuQHVKc+vKvvX/PH2tAKz3exVKuCx3RBzr0H9MSP wYMQnf2iRf2a4gGFOlAlRrfYr6AkgRhVAnfhAnnBWMRS5CKK+DvtbWp3oX2rwy4h6EPj Mdfw== 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=+A8vtr9Uuy678JAjKcR+8VWtyQ3GIetirPoUSxB1I3g=; b=PfRirwhsnQqcCyzN8AD3fTDAjgZo9Rxt2yFkfGiLSZMswgSaCfoCeiMMvcPdhuj/+V lZewcIirpeXfC/85DsjNbyiqUZe19xPSUw2TWF9AhujhCvcyxEalHk4vHFo1/hYzJLsG cF1eC0x37H2s8vXwc1rSGIw8SKwcFDhtZvSKae+bxYOXrC9ThUHILRYybZr6P8/7pbI6 bNyvY9MNQ40uZWep4XyXsPvDAudnn76dI+OGC+ZGfsKqorwDL10915yZ+lDEixT+jigA beth8S55lV5rCPuEbc8w1B6xfipuEe8wg+bHgzGLABLkIX4gxhb+aF5j/DBZZCGfL+SB re2g== X-Gm-Message-State: APjAAAUgcrLaw2qvu/yN9Mt/MNW9qIK6XBbMD5AriFxjbJA/GZSvoUhC sSsnyxdhfYvdS+u9Ond+f9Ka1Hu6 X-Google-Smtp-Source: APXvYqznU5T5zfYxa0Lc+x3QI9Z1vR3+Hcepiahzn4Y3H8sbZtROzbGxdet8F4MaYAcgRD9zOmVshg== X-Received: by 2002:a62:1854:: with SMTP id 81mr1591171pfy.223.1551789057634; Tue, 05 Mar 2019 04:30:57 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id 33sm21165026pgs.81.2019.03.05.04.30.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:30:56 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:30:53 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 03/20] diff-parseopt: convert --histogram Date: Tue, 5 Mar 2019 19:30:09 +0700 Message-Id: <20190305123026.7266-4-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 7899c7cc06..7432702fd8 100644 --- a/diff.c +++ b/diff.c @@ -5151,6 +5151,9 @@ static void prep_parse_options(struct diff_options *options) N_("generate diff using the \"patience diff\" algorithm"), PARSE_OPT_NONEG | PARSE_OPT_NOARG, diff_opt_patience), + OPT_BITOP(0, "histogram", &options->xdl_opts, + N_("generate diff using the \"histogram diff\" algorithm"), + XDF_HISTOGRAM_DIFF, XDF_DIFF_ALGORITHM_MASK), OPT_GROUP(N_("Diff other options")), OPT_CALLBACK_F(0, "relative", options, N_(""), @@ -5189,9 +5192,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* xdiff options */ - if (!strcmp(arg, "--histogram")) - options->xdl_opts = DIFF_WITH_ALG(options, HISTOGRAM_DIFF); - else if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) { + if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) { long value = parse_algorithm_value(optarg); if (value < 0) return error("option diff-algorithm accepts \"myers\", " From patchwork Tue Mar 5 12:30:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839399 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 17509139A for ; Tue, 5 Mar 2019 12:31:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 056552B102 for ; Tue, 5 Mar 2019 12:31:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED55A2B350; Tue, 5 Mar 2019 12:31:04 +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 917FF2B102 for ; Tue, 5 Mar 2019 12:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728213AbfCEMbD (ORCPT ); Tue, 5 Mar 2019 07:31:03 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42475 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728172AbfCEMbD (ORCPT ); Tue, 5 Mar 2019 07:31:03 -0500 Received: by mail-pf1-f193.google.com with SMTP id n74so5589866pfi.9 for ; Tue, 05 Mar 2019 04:31:02 -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=dJnaHbLK7MWEonIsU/zSneSfXYpWf1RdJ+KwLO9tlzA=; b=dMB3TSuiOVAufiP1DzOl/pH469ZLO17LPH7s7sUkRM7Y9Mvv547iNpOFspTjl97OeL hxdC6TLhd3wn3r+fTiye7FVMXsz5W7wYkachByszo8ee+FhxOmkXNOmF899v9RaiZgl7 7SlsYVT9z/cyuGalb5QiH2iCto07Re4VTbPL3rHIYcZewCo4cqGfxYpJAmYw8GAJMQzN Z61uyna0cv7mK3ZfaIX3iWxImts2C0AgpAmbV6MQRu+WqsDqXr0X8dYIq9IXfziwVTVj 8Vi+vnQ16PjqRLFFpX9OMdfcxLl0s/5Af+S6B8HwK64odjxa+NuPsWYgw/rE+FRuiHZr sPKw== 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=dJnaHbLK7MWEonIsU/zSneSfXYpWf1RdJ+KwLO9tlzA=; b=kKOEa1+lzqEQkOFONw6iOp+x9DIwgriuMbNx8eWnnuhx/U4WKGGfhg7tZOvkW5DWlQ crvaE3vvLGQTc+kgm5lNIH/6kJuq2np3eeLoend++dHPTUqXzzFZZNBtg0MgTURba1Ye wFqgKySbB+Yq5SuOXXKEve4ybo2D9pheW6NK3wwXAwj1UOw34mZuxwSG03ONc26/uJ0A U809jHlR4MC3beFbMVhQcqZVmCTqI9mq91nLN0RP0yNqi+lE/Z6lJWwEIkK2TgKPRuMb Y3GJ5LmAnGX9QoHzDUKcqykGsCl/neQjB6vRgBz209c1cmfjoSrk7PwyGco5sqZNivjA 9IqQ== X-Gm-Message-State: APjAAAUmRPiplT8zJnCzmWZsnWmPQvlhLv4rP945b+x8X0NgcGF1mVg1 W7WL2H+h050yuIq7ijvSJWfAF6Ja X-Google-Smtp-Source: APXvYqw05byM7ex/N8fr+QEl1sFNbWBCETQpwfHFW4vWIvBvm8/UZ1TX4wxIZWYnUTszjCGsvXuoKg== X-Received: by 2002:a62:574d:: with SMTP id l74mr1656265pfb.9.1551789062326; Tue, 05 Mar 2019 04:31:02 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id i14sm24266122pgt.82.2019.03.05.04.30.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:01 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:30:57 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 04/20] diff-parseopt: convert --diff-algorithm Date: Tue, 5 Mar 2019 19:30:10 +0700 Message-Id: <20190305123026.7266-5-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/diff.c b/diff.c index 7432702fd8..8d08795f9c 100644 --- a/diff.c +++ b/diff.c @@ -4891,6 +4891,24 @@ static int diff_opt_compact_summary(const struct option *opt, return 0; } +static int diff_opt_diff_algorithm(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + long value = parse_algorithm_value(arg); + + BUG_ON_OPT_NEG(unset); + if (value < 0) + return error(_("option diff-algorithm accepts \"myers\", " + "\"minimal\", \"patience\" and \"histogram\"")); + + /* clear out previous settings */ + DIFF_XDL_CLR(options, NEED_MINIMAL); + options->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK; + options->xdl_opts |= value; + return 0; +} + static int diff_opt_dirstat(const struct option *opt, const char *arg, int unset) { @@ -5154,6 +5172,9 @@ static void prep_parse_options(struct diff_options *options) OPT_BITOP(0, "histogram", &options->xdl_opts, N_("generate diff using the \"histogram diff\" algorithm"), XDF_HISTOGRAM_DIFF, XDF_DIFF_ALGORITHM_MASK), + OPT_CALLBACK_F(0, "diff-algorithm", options, N_(""), + N_("choose a diff algorithm"), + PARSE_OPT_NONEG, diff_opt_diff_algorithm), OPT_GROUP(N_("Diff other options")), OPT_CALLBACK_F(0, "relative", options, N_(""), @@ -5192,17 +5213,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* xdiff options */ - if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) { - long value = parse_algorithm_value(optarg); - if (value < 0) - return error("option diff-algorithm accepts \"myers\", " - "\"minimal\", \"patience\" and \"histogram\""); - /* clear out previous settings */ - DIFF_XDL_CLR(options, NEED_MINIMAL); - options->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK; - options->xdl_opts |= value; - return argcount; - } else if (skip_prefix(arg, "--anchored=", &arg)) { + if (skip_prefix(arg, "--anchored=", &arg)) { options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF); ALLOC_GROW(options->anchors, options->anchors_nr + 1, options->anchors_alloc); From patchwork Tue Mar 5 12:30:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839401 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 368FA17E4 for ; Tue, 5 Mar 2019 12:31:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 251962B102 for ; Tue, 5 Mar 2019 12:31:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 197FD2B350; Tue, 5 Mar 2019 12:31:10 +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 B9FD72B102 for ; Tue, 5 Mar 2019 12:31:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728214AbfCEMbI (ORCPT ); Tue, 5 Mar 2019 07:31:08 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:35134 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728063AbfCEMbI (ORCPT ); Tue, 5 Mar 2019 07:31:08 -0500 Received: by mail-pg1-f193.google.com with SMTP id e17so5557386pgd.2 for ; Tue, 05 Mar 2019 04:31:07 -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=ff35se/UmuEiD3pS1Mo00SSns6/2OiBoVEfkIyfpnEA=; b=n+ki92y1TWqxl3t1jkl+DPV6qTz3ijIKXqDJt7BH/xCn2DB0xbV4Yu+OBEUKw0GKWG gToAjuuvgoJHMuvOR/aruF6fWGU2Gecj4wcKsKS+I7HqMc9ERyymB4Z7X+EaleVAG40P vQiEkwnhG0vn7mGdQqvfoEw+mfcuzIHxjSIh8RuzMtLaa7I8bblyl5oANcmA62YsrSWp ZEEOhS4cThtKZZObyNNS42O/Gss7265XGNrabTrU2VN0ri/zaJTxQQq0D8bukvrymRGU 77sgvAHBN6aBOxEY3NCj4+/5G9/GKhbWVfqDUppVrdogCJbCvssokdWTQ2iXdry8PF/0 e3tg== 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=ff35se/UmuEiD3pS1Mo00SSns6/2OiBoVEfkIyfpnEA=; b=eX3Ayks/8k+MkVdVyV/VSPdCc4g2niGyYPnWk4SE3SSRmYxqzLUmpjTxyWWq0N5vWb blY7fispzQdscdD/f/x/SEjWs1gTOFyoUeBNI0zOvOpduNAu2HwYoq/LtYlCP1V+IL0H UCHrxEft2BUjT2s6KadGkBsHmWFa+qY4rPsMqFNVb26U+ElY++xDK02+jvBXIqxfgdVc HRdpduvwpmQ7ZSAQxdtQLggZyFlwKBEHMDhIz4buO9sBX6nQVXYOuxa1QcgAXL4X0lbV JpRnIwk30yuKxBtPRpOna89vt3NJTXezUFpnZAvkj+gICv/2msvpooR0OY0QO5AcI/ZL e92g== X-Gm-Message-State: APjAAAUcOP+zWm/lQcUhmUO2oyaRY3i8de1qFfDtX7+QMcruCy6/t3f6 /yUp1yL1hz68VsPMiS5+hpT9rCCA X-Google-Smtp-Source: APXvYqzYRq8/7a6eid0N2vhPyAV3LdZ7wOUg+K67cLeJEfqwwNVLQv4vTUtxOYtNwQ3JkvVgGRAOVQ== X-Received: by 2002:a63:ea52:: with SMTP id l18mr1200590pgk.317.1551789067258; Tue, 05 Mar 2019 04:31:07 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id 195sm22642259pfc.50.2019.03.05.04.31.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:06 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:02 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 05/20] diff-parseopt: convert --anchored Date: Tue, 5 Mar 2019 19:30:11 +0700 Message-Id: <20190305123026.7266-6-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/diff.c b/diff.c index 8d08795f9c..5195526db9 100644 --- a/diff.c +++ b/diff.c @@ -4839,6 +4839,19 @@ static int parse_objfind_opt(struct diff_options *opt, const char *arg) return 1; } +static int diff_opt_anchored(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF); + ALLOC_GROW(options->anchors, options->anchors_nr + 1, + options->anchors_alloc); + options->anchors[options->anchors_nr++] = xstrdup(arg); + return 0; +} + static int diff_opt_break_rewrites(const struct option *opt, const char *arg, int unset) { @@ -5175,6 +5188,9 @@ static void prep_parse_options(struct diff_options *options) OPT_CALLBACK_F(0, "diff-algorithm", options, N_(""), N_("choose a diff algorithm"), PARSE_OPT_NONEG, diff_opt_diff_algorithm), + OPT_CALLBACK_F(0, "anchored", options, N_(""), + N_("generate diff using the \"anchored diff\" algorithm"), + PARSE_OPT_NONEG, diff_opt_anchored), OPT_GROUP(N_("Diff other options")), OPT_CALLBACK_F(0, "relative", options, N_(""), @@ -5212,16 +5228,8 @@ int diff_opt_parse(struct diff_options *options, if (ac) return ac; - /* xdiff options */ - if (skip_prefix(arg, "--anchored=", &arg)) { - options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF); - ALLOC_GROW(options->anchors, options->anchors_nr + 1, - options->anchors_alloc); - options->anchors[options->anchors_nr++] = xstrdup(arg); - } - /* flags options */ - else if (!strcmp(arg, "--binary")) { + if (!strcmp(arg, "--binary")) { enable_patch_output(&options->output_format); options->flags.binary = 1; } From patchwork Tue Mar 5 12:30:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839403 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 4316917E4 for ; Tue, 5 Mar 2019 12:31:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3161B2B110 for ; Tue, 5 Mar 2019 12:31:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25E7C2B36D; Tue, 5 Mar 2019 12:31:14 +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 C22192B110 for ; Tue, 5 Mar 2019 12:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728231AbfCEMbM (ORCPT ); Tue, 5 Mar 2019 07:31:12 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:38841 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728063AbfCEMbM (ORCPT ); Tue, 5 Mar 2019 07:31:12 -0500 Received: by mail-pf1-f196.google.com with SMTP id n125so5592287pfn.5 for ; Tue, 05 Mar 2019 04:31:12 -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=T03u+8RSAqswfqwGei0ldkHt4+JM8hrOeRn4b2jcEAY=; b=Fb5o05cSJx4QpRVu0/hmZGjz2C2i2RtKmHGFLQ+Ram2EpvNnBdgKAsx+P370AtYOd2 +iGFNwvMyJ+bwChs3tMdEZD8rnFu0JgNCW36V9hBJUaOWTXFXymIwoISHh8Jk0scbegT QLWja6J3KKb7uCmdYrnYDi6xqoZ9Pn6eeqiDg0eH/BFbIKNDDV8GeC0fN+9txPUWYW8s Q4zLaX9HFvHH0ddBI1Q5Fa4Nl/n3yjDrk2lgccpYkiiswa0CfDdPo49BZObyWgO6SAFy fYJfOWPXmKPBX5jnWb3GXTrdcvzBDkfNn/crmXgFzTQThJvWJ6BKCYjlIMTrx/wC59um biHw== 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=T03u+8RSAqswfqwGei0ldkHt4+JM8hrOeRn4b2jcEAY=; b=FKGZm8S7cewAxe1pHD2vzHx1+q9qrwvRFrInroykKSqoLW0g4xeBrSyh5Hv5KUyrDY FqKOv/coV/xUZsqZSnddGn+7/bqqjjE0zGErJI/eH/NU1BKO03Va3VktAjnHXPIam9yt bJDdR6VxbCWu5PW1xv6+37ublsshQPZLZVTXJmH5O+kzwu+0vvHPhUNprp93wow/nMyK ZeFjOfOWKiAwE+BwdDI4YLOmDqlOjzojludl+NiZt20cLwiA9/acbojg4FPMZoO4vfWT Bjp5t4MQwy6eNwATgCcPcdW/1gEnCJAhHJ6WTNbMjG8PSd0UUUY8vz2/fG2u9ck3EyRW XbJw== X-Gm-Message-State: APjAAAUxSuF3ivOWD7DpoHT4wVdt3eWyVUqm4/jX6MLxkDoKRNsoe22a XTvdLuu/17ZLfQpVZEMstVvA7BTZ X-Google-Smtp-Source: APXvYqxdDrWNXklqZE2jIpQ+W7IFi94U79PfK5O+ULuMA9FvdcsbTKEeuPnY3xndCRtvCB4sA+imgQ== X-Received: by 2002:a63:20a:: with SMTP id 10mr1211681pgc.346.1551789071804; Tue, 05 Mar 2019 04:31:11 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id h126sm20449651pfc.135.2019.03.05.04.31.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:11 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:07 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 06/20] diff-parseopt: convert --binary Date: Tue, 5 Mar 2019 19:30:12 +0700 Message-Id: <20190305123026.7266-7-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- Documentation/diff-options.txt | 2 +- diff.c | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 915f2fec8b..6810c94fea 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -425,7 +425,7 @@ endif::git-format-patch[] --binary:: In addition to `--full-index`, output a binary diff that - can be applied with `git-apply`. + can be applied with `git-apply`. Implies `--patch`. --abbrev[=]:: Instead of showing the full 40-byte hexadecimal object diff --git a/diff.c b/diff.c index 5195526db9..214728c892 100644 --- a/diff.c +++ b/diff.c @@ -4852,6 +4852,18 @@ static int diff_opt_anchored(const struct option *opt, return 0; } +static int diff_opt_binary(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + BUG_ON_OPT_ARG(arg); + enable_patch_output(&options->output_format); + options->flags.binary = 1; + return 0; +} + static int diff_opt_break_rewrites(const struct option *opt, const char *arg, int unset) { @@ -5116,6 +5128,9 @@ static void prep_parse_options(struct diff_options *options) OPT_CALLBACK_F(0, "compact-summary", options, NULL, N_("generate compact summary in diffstat"), PARSE_OPT_NOARG, diff_opt_compact_summary), + OPT_CALLBACK_F(0, "binary", options, NULL, + N_("output a binary diff that can be applied"), + PARSE_OPT_NONEG | PARSE_OPT_NOARG, diff_opt_binary), OPT_CALLBACK_F(0, "output-indicator-new", &options->output_indicators[OUTPUT_INDICATOR_NEW], N_(""), @@ -5229,11 +5244,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* flags options */ - if (!strcmp(arg, "--binary")) { - enable_patch_output(&options->output_format); - options->flags.binary = 1; - } - else if (!strcmp(arg, "--full-index")) + if (!strcmp(arg, "--full-index")) options->flags.full_index = 1; else if (!strcmp(arg, "-a") || !strcmp(arg, "--text")) options->flags.text = 1; From patchwork Tue Mar 5 12:30:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839405 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 4D60E139A for ; Tue, 5 Mar 2019 12:31:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B57A2B102 for ; Tue, 5 Mar 2019 12:31:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FC652B350; Tue, 5 Mar 2019 12:31:19 +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 D670B2B3A0 for ; Tue, 5 Mar 2019 12:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728238AbfCEMbR (ORCPT ); Tue, 5 Mar 2019 07:31:17 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44716 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728234AbfCEMbR (ORCPT ); Tue, 5 Mar 2019 07:31:17 -0500 Received: by mail-pf1-f196.google.com with SMTP id a3so5582967pff.11 for ; Tue, 05 Mar 2019 04:31:16 -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=a37T+dMdJ6T4LszHzCAaz9F8J8lcumUvWPBIk3Xw0Q4=; b=h2CQQvWvOYmTEOKN65lM4z/o6sTIyOApRgxm6h+GEp9Aw0lUs7bq6iNd5//nx5IfEJ +8JRU6a9BjwnpoQVWNE4ou8QVKxYndL09bUP7J26mHJPChkp0ixzceDGBMP5bRqxTb62 KOrwfglU6SJSGkj3typlCpQxV5s15T+sLHYiVRK1MeeOMhJauYQmwRwID6S5lXBflC/H SD7h1BFGJbzNevk1XB58fLUPj/9vFXUYv3A6yjcOo2LRXIbRa4IsMTgwP+OxX6YAPspg 8OiOj9LqUoCPJQ4D1lzCrYCS97YBSN6SWmdAEfufojjvNBu7+m2cVVw9atFpPjg5j2BF lQCA== 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=a37T+dMdJ6T4LszHzCAaz9F8J8lcumUvWPBIk3Xw0Q4=; b=dqa/kj0qoJBcksMy+0r5fPMcdVddpPHndyH58pmUK+y+bEWDTzaMMs/FX9KS5PSLQA IKZDSV4JiRzwx65d6ZgiNMqTiNJXN57WKJt+wDrzVBmrWFw5h/lX8hCLP6Mpo975mDly Ewr0T+Pib6SqsMsZghQqc603daVDkIIdysEEIcy7mJZM8JweuhMTMAeHYSF/LmbuYC1b pB2h3WSpLlL+vqeIw3BW9LCBOu21gwMTvuOYitI/119uHelZ+MvVilEtf+7relP6f89i 3psNjjExglRVzjBO/XsUVpNupM8vLfRUQam6AmwB2fJ8LFN0wjL1cmx8Wdi4c1jWbYzB N88Q== X-Gm-Message-State: APjAAAW/y/LRM4CRJKCz8SFVCiBkuWuvenTH1s8twBYhaybFloh2x3rG D9s3U56t2hZynJrR3aIs4TXj95r4 X-Google-Smtp-Source: APXvYqzZ4dJE4Mrm+AZRUOrBjIu8qe+Cpqk9QFGpaOljinR4+6/Qtu7l5eXpG9G/37rbcE4stOa33A== X-Received: by 2002:a63:ce:: with SMTP id 197mr1205994pga.212.1551789076457; Tue, 05 Mar 2019 04:31:16 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id s37sm22523684pgk.36.2019.03.05.04.31.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:15 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:12 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 07/20] diff-parseopt: convert --full-index Date: Tue, 5 Mar 2019 19:30:13 +0700 Message-Id: <20190305123026.7266-8-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 214728c892..3a13ba37fd 100644 --- a/diff.c +++ b/diff.c @@ -5131,6 +5131,8 @@ static void prep_parse_options(struct diff_options *options) OPT_CALLBACK_F(0, "binary", options, NULL, N_("output a binary diff that can be applied"), PARSE_OPT_NONEG | PARSE_OPT_NOARG, diff_opt_binary), + OPT_BOOL(0, "full-index", &options->flags.full_index, + N_("show full pre- and post-image object names on the \"index\" lines")), OPT_CALLBACK_F(0, "output-indicator-new", &options->output_indicators[OUTPUT_INDICATOR_NEW], N_(""), @@ -5244,9 +5246,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* flags options */ - if (!strcmp(arg, "--full-index")) - options->flags.full_index = 1; - else if (!strcmp(arg, "-a") || !strcmp(arg, "--text")) + if (!strcmp(arg, "-a") || !strcmp(arg, "--text")) options->flags.text = 1; else if (!strcmp(arg, "-R")) options->flags.reverse_diff = 1; From patchwork Tue Mar 5 12:30:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839407 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 0B0CF139A for ; Tue, 5 Mar 2019 12:31:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDD282B102 for ; Tue, 5 Mar 2019 12:31:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E22932B380; Tue, 5 Mar 2019 12:31:23 +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 8F7F42B102 for ; Tue, 5 Mar 2019 12:31:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728240AbfCEMbW (ORCPT ); Tue, 5 Mar 2019 07:31:22 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35170 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728063AbfCEMbW (ORCPT ); Tue, 5 Mar 2019 07:31:22 -0500 Received: by mail-pg1-f194.google.com with SMTP id e17so5557783pgd.2 for ; Tue, 05 Mar 2019 04:31:22 -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=F7WrnDepBAr8/LypsiG9Zw/N/HDP5UJcneiSSMfzDeE=; b=OZCCgGnAd0By++zN955rsdUPgPbbjCHnsey4RqamvjpyAufOOpOYDO136gsYl3ngGW FnSsVijQpyPZc5a57ioI6Mgu41WDYS5sgl4csX0W/BU0lIiFDvXQp2gZxqXzrcAWYULb GtsJZILFNBTkqTOZKA/KEmOlQuYgeThU3kUlIM2DjabKLYfA9W6CQ8T1klhbfmI4yVg0 RzMX0X89QnAxEwwjXvc2z0LI8wD8z6eLVNehuc/XZ/utAdEZ0T8/LJulD4I8j/8XiJa6 TRcBD9MtJodCFamiTq48Wh5j5j4qQVyi0vvZEc8DhV2Bvr8fJM4XCtSee+cgCSagdq24 k5sg== 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=F7WrnDepBAr8/LypsiG9Zw/N/HDP5UJcneiSSMfzDeE=; b=Fmk0gShIUrTyj5ezCCITQ5lvy+hLenMRxk+HpAXXjmNgSqRieGnvbnstELeFOb6/0z yvTd28uRNsCeh/RIQSrLwt/DLHsE1c/zYMF/XHtO4y4wAjQbwo7Jxbxq7UjcI/fePqRf X8w7IAjhsfyTEHzz8z4di/THbMmgSxzsPUX6FCnhCsWj71zaPSTvia68e7knwgipcU3d mb5V3j2go3gpzimg1J62y5jD0IGg54Och/j+I3CYknnyz6ZKmi9wq3DVbR5Pe5TYCy/2 cD8IeKkxoLugV+MzK1Skg5tgjD4fktBZ0Hw324qQUghHhBNFApGYNdK+copTn3nFK4eu 8apQ== X-Gm-Message-State: APjAAAVEcUlBwdNtRzZcxhPgArG1YTzouiJUjMOQ29dTiD3SilHwX3Ji TOTuuVHDEYtJpnJphCemHheg/I15 X-Google-Smtp-Source: APXvYqxOJ2joZrAAcuBPV+hgg9wY7VjL3dZ/yrJy+pxMhtG4Sak0QgR8bNgCFqQUFeJc+UIh9oKF7w== X-Received: by 2002:a17:902:2be8:: with SMTP id l95mr1000002plb.270.1551789081589; Tue, 05 Mar 2019 04:31:21 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id e5sm11826364pfd.73.2019.03.05.04.31.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:21 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:16 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 08/20] diff-parseopt: convert -a|--text Date: Tue, 5 Mar 2019 19:30:14 +0700 Message-Id: <20190305123026.7266-9-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 3a13ba37fd..51d22f63fa 100644 --- a/diff.c +++ b/diff.c @@ -5214,6 +5214,8 @@ static void prep_parse_options(struct diff_options *options) N_("when run from subdir, exclude changes outside and show relative paths"), PARSE_OPT_NONEG | PARSE_OPT_OPTARG, diff_opt_relative), + OPT_BOOL('a', "text", &options->flags.text, + N_("treat all files as text")), { OPTION_CALLBACK, 0, "output", options, N_(""), N_("Output to a specific file"), PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, @@ -5246,9 +5248,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* flags options */ - if (!strcmp(arg, "-a") || !strcmp(arg, "--text")) - options->flags.text = 1; - else if (!strcmp(arg, "-R")) + if (!strcmp(arg, "-R")) options->flags.reverse_diff = 1; else if (!strcmp(arg, "--follow")) options->flags.follow_renames = 1; From patchwork Tue Mar 5 12:30:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839409 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 D98B917E4 for ; Tue, 5 Mar 2019 12:31:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C700C2B102 for ; Tue, 5 Mar 2019 12:31:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB8012B350; Tue, 5 Mar 2019 12:31:28 +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 5A8E82B102 for ; Tue, 5 Mar 2019 12:31:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728241AbfCEMb1 (ORCPT ); Tue, 5 Mar 2019 07:31:27 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39837 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728063AbfCEMb1 (ORCPT ); Tue, 5 Mar 2019 07:31:27 -0500 Received: by mail-pf1-f193.google.com with SMTP id i20so5591695pfo.6 for ; Tue, 05 Mar 2019 04:31:26 -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=7qPzDw1tId6zHZ/C5HYE4D3qBEIqkAOTAm9iLUqUeLU=; b=If7xb9gNZAjrUSkyJKkjXqJDK1jZp/H24KAV5l4LlmLeHlU8F17ZdFzS/Zl0xfW5RC qgTfaqADkcATrEQrLtkL83AWdPpho0qTndSFlRNWq+fRm923IvkaHIJWxaI0V/petbNg bX9R0QFjmJqRcjgaB/WLd6fJ95XodOV3b7Y1s1q5icBi7WIvcihsIAeDxzfgb94l68eb 7P/r7iQ4SoL4YSYEB2qL93qCNGtfoKIvzJKRASkmtDWU+KTgBqEd7hJ6TOsYPCJ4uPTl MnBdh9p5rcsh1ntQhsiGFqv77WxuE3wCvxUJn1VcERJGSERVVaQIldoMYx93m66QhI+9 HPvw== 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=7qPzDw1tId6zHZ/C5HYE4D3qBEIqkAOTAm9iLUqUeLU=; b=YWJBW143m7Y4q3W3jmoCKkdAjNgw42YdteBqTUyuPSW3tzY6WHThhDULSfr2JiqxTI QhQA3nL5Z/GL2DsoZIS4TQY5xtzePuyYQ/BtUFaZ/D3lEMV3MwsyvRXBseplHhGwKEla Fz+eVcGd5RQDZMrUp2EUWyqw4jjWP5y7dixNOCHshT7gbgA9Ghz8U70gydZZgi5XWDjb 3j629l8IrzEAHP4PNBYP/oF7swP1OuYAQJ7cxYgf7N70IEdA8vdjVKKf4a0U29n9RSCz dZiyzd9Kt+2VndaZ1QbBYkHlLbdj31iijOovfFUYpKbiV6gm64XJ0mvOo4FJA/0+wZVB RArA== X-Gm-Message-State: APjAAAVgnanvDtYPr/GsAnCcv2xu0F3MPbpOkdU8/QoEdiSgQNfYIPQB HYmG+4wGPoW+OekW8/KYYWeNSgnL X-Google-Smtp-Source: APXvYqzAbzLyvM4CDZPHwA4sQeiLFnbM0iMF95h5ehdBn6lEK2nnssfdp+NVGRvnCh1/KXiMOarQfw== X-Received: by 2002:a63:6c43:: with SMTP id h64mr1183193pgc.22.1551789086224; Tue, 05 Mar 2019 04:31:26 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id o6sm24603063pgo.27.2019.03.05.04.31.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:25 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:21 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 09/20] diff-parseopt: convert -R Date: Tue, 5 Mar 2019 19:30:15 +0700 Message-Id: <20190305123026.7266-10-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 51d22f63fa..689dc11684 100644 --- a/diff.c +++ b/diff.c @@ -5216,6 +5216,8 @@ static void prep_parse_options(struct diff_options *options) diff_opt_relative), OPT_BOOL('a', "text", &options->flags.text, N_("treat all files as text")), + OPT_BOOL('R', NULL, &options->flags.reverse_diff, + N_("swap two inputs, reverse the diff")), { OPTION_CALLBACK, 0, "output", options, N_(""), N_("Output to a specific file"), PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, @@ -5248,9 +5250,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* flags options */ - if (!strcmp(arg, "-R")) - options->flags.reverse_diff = 1; - else if (!strcmp(arg, "--follow")) + if (!strcmp(arg, "--follow")) options->flags.follow_renames = 1; else if (!strcmp(arg, "--no-follow")) { options->flags.follow_renames = 0; From patchwork Tue Mar 5 12:30:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839411 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 C83B917E4 for ; Tue, 5 Mar 2019 12:31:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B318D2B3B8 for ; Tue, 5 Mar 2019 12:31:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A75C52B3B5; Tue, 5 Mar 2019 12:31:33 +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 51D902B3BC for ; Tue, 5 Mar 2019 12:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728252AbfCEMbc (ORCPT ); Tue, 5 Mar 2019 07:31:32 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:45872 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728063AbfCEMbc (ORCPT ); Tue, 5 Mar 2019 07:31:32 -0500 Received: by mail-pf1-f194.google.com with SMTP id v21so5584913pfm.12 for ; Tue, 05 Mar 2019 04:31:31 -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=RqiQKMgXv9L2XGnc4RsCahJ40oubD87/i8UJ7VmTmo4=; b=gJm5sZ+rE5NaMOgvV/9SOtXVfM4IeOK/RLq6Oe6AuoaDCVSPWx5I8+QJQHlEWcw5QQ kMrkEFBu3pBk7xlQ1OoRDDNmEjHuaH3C/q+wBIYi8hZQGBppJO8/CZoUSkwp1fno61NQ i8M0HluTs793Xgearkp5QVGIkGwQN5gHt1DwcbVQBxdA5LO0BtQHjRm9LBuYjr8N8VvJ nchJPaTVPz5phqctLYNm5nY+4SzzdNqTtQWCNwRtuQlBCQxd2IfH3JQdGEl/KwRERvlv J6rPknpr184PAMy29syizxrxuVMJyfkAQtWNorLf313nAg6TLmCABzac8MeB8Ptt1W5G 6Bmg== 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=RqiQKMgXv9L2XGnc4RsCahJ40oubD87/i8UJ7VmTmo4=; b=Xo3yoZxVWo8FN3NzasY/dj7alki7xKVuASku8xYco/YGeLpOTUZCLRgTbPLsiwralW gfyARPDJovA2GhWEhjJdj0AtiURLbX9pPbPJa+PD7RiyU2gZaY618K3wzLSR/erwQ0LV 0HF83lOJfVQRxI5fqjk8SQBptLW0G1niFoyaNeKYfsbhowudhlxZr5z+2STxP27yq3ql FyasRCt9n4KvxhWZqIc/C/RoZlCIKZgUoFgT4kPTrHqZ2Swyg2IE9J1msfzpN9q/n7Gc 0INSsMSLsk7PJyVqou6mn6agk3/IAQBzB6DPyMXv2ml1dmHt8oCvUIYDDTl2FTfuY0zy BNvQ== X-Gm-Message-State: APjAAAULWpWIlfYNaG2oAQqKFC8o4ZRHBsDjkd1Hhkdd0FhsboUfpXxk /fHBYKiPrI56WI2AkbjBS7UUY7qV X-Google-Smtp-Source: APXvYqxJe/wFm1FqUv+NkUm5WHTtpJ1GPj1Nghcfn5Fm5l6ucMGLlQAKYkxBK8oVUBk+I3fchg+FmA== X-Received: by 2002:a17:902:aa87:: with SMTP id d7mr969185plr.146.1551789091061; Tue, 05 Mar 2019 04:31:31 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id k8sm10812291pgq.37.2019.03.05.04.31.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:30 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:26 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 10/20] diff-parseopt: convert --[no-]follow Date: Tue, 5 Mar 2019 19:30:16 +0700 Message-Id: <20190305123026.7266-11-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/diff.c b/diff.c index 689dc11684..ad813ea418 100644 --- a/diff.c +++ b/diff.c @@ -4986,6 +4986,21 @@ static int diff_opt_find_renames(const struct option *opt, return 0; } +static int diff_opt_follow(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_ARG(arg); + if (unset) { + options->flags.follow_renames = 0; + options->flags.default_follow_renames = 0; + } else { + options->flags.follow_renames = 1; + } + return 0; +} + static enum parse_opt_result diff_opt_output(struct parse_opt_ctx_t *ctx, const struct option *opt, const char *arg, int unset) @@ -5172,6 +5187,9 @@ static void prep_parse_options(struct diff_options *options) 0, PARSE_OPT_NONEG), OPT_BOOL(0, "rename-empty", &options->flags.rename_empty, N_("use empty blobs as rename source")), + OPT_CALLBACK_F(0, "follow", options, NULL, + N_("continue listing the history of a file beyond renames"), + PARSE_OPT_NOARG, diff_opt_follow), OPT_GROUP(N_("Diff algorithm options")), OPT_BIT(0, "minimal", &options->xdl_opts, @@ -5250,12 +5268,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* flags options */ - if (!strcmp(arg, "--follow")) - options->flags.follow_renames = 1; - else if (!strcmp(arg, "--no-follow")) { - options->flags.follow_renames = 0; - options->flags.default_follow_renames = 0; - } else if (skip_to_optional_arg_default(arg, "--color", &arg, "always")) { + if (skip_to_optional_arg_default(arg, "--color", &arg, "always")) { int value = git_config_colorbool(NULL, arg); if (value < 0) return error("option `color' expects \"always\", \"auto\", or \"never\""); From patchwork Tue Mar 5 12:30:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839413 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 63363139A for ; Tue, 5 Mar 2019 12:31:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 532D62B3B8 for ; Tue, 5 Mar 2019 12:31:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47D0B2B40B; Tue, 5 Mar 2019 12:31:38 +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 D84CB2B3B8 for ; Tue, 5 Mar 2019 12:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728265AbfCEMbg (ORCPT ); Tue, 5 Mar 2019 07:31:36 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33584 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728256AbfCEMbg (ORCPT ); Tue, 5 Mar 2019 07:31:36 -0500 Received: by mail-pf1-f196.google.com with SMTP id i19so5602218pfd.0 for ; Tue, 05 Mar 2019 04:31:36 -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=HyhNLTV0DfRulN3pU2g3J0a9kLEFDhlmnqxTJuJJjdw=; b=pFlXmfwF8Nzi7iPHVCla+IhyZa0czep6P8AqxCwhX48tvKfK1PYyj/aF+UuVDvRVcH 71rSNgHnoIjIZPoP77vPpa3snAgAQgHAyvUl7b67lOet2fRF3UKCGmXS2c2xJFvh3YMC yR4agTkxcF3dY9YfigHKsJGhD1wacrCTO0j2BPb3T4jC07sdmLNTVmVsZJtzzdpYAeGm /MayW+vNaLurCvMivSeIve/qtd4lH/1EeYvahneC60L0gUL1Csv41lxkWbclUb0h6PYK /NeHOu4vM8LdHuxmQIBlVDwTL1NI/wIi1rh1ntVSluhsJkMfkK1GGhVtHPu1Kz0IlN22 A0RQ== 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=HyhNLTV0DfRulN3pU2g3J0a9kLEFDhlmnqxTJuJJjdw=; b=LJUWnyQLG6sIqzNbRpyBdZ244t6mBFhyD0SMih72wRsX6sXLINmJBtzrZtjk8rcO5Q 8bMuzmXagHl0ZbCmlPsJlML333YYtDrwYr8WLDq9mvPOyYIbWAzQ0LdVWjdWgEgK+9bQ sxRPXXfGTR14UY/koE7/JsE3Y+lFhpgjx2iFk+8wLuqrincQ6nDkKqn8VRZhbNEY6Iws Fh9wm3Ppb7HJR6f7xQPjWD6ZbHu5nxUQj41q2Skrp9ywOmxeflmVzYAlwc0HfRuz2KIe P08GW3wOWPWsFWAQo5LkhKB8Bah6uQxyJdxUy+SW8nmdjmk1YVgsKWYCz4R6c+7fzX08 3lww== X-Gm-Message-State: APjAAAWihSooUHB4T21H95LYfs4v+q1hHlSOLuMGZgZNwnE0ETpTzks9 HRcJ8z4mZBX2xVw9/0YcPnWczZcA X-Google-Smtp-Source: APXvYqz0NF6MUvgCVQphtpS1WeGaWpGj9zsWbqNKWNHpUjmr+Zs9ReVfp6L7CObjo9umStyKFCkkMQ== X-Received: by 2002:a62:1ace:: with SMTP id a197mr1666686pfa.78.1551789095552; Tue, 05 Mar 2019 04:31:35 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id z77sm15545814pfi.155.2019.03.05.04.31.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:34 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:31 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 11/20] diff-parseopt: convert --[no-]color Date: Tue, 5 Mar 2019 19:30:17 +0700 Message-Id: <20190305123026.7266-12-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/diff.c b/diff.c index ad813ea418..bb36d507ec 100644 --- a/diff.c +++ b/diff.c @@ -5148,6 +5148,8 @@ static void prep_parse_options(struct diff_options *options) PARSE_OPT_NONEG | PARSE_OPT_NOARG, diff_opt_binary), OPT_BOOL(0, "full-index", &options->flags.full_index, N_("show full pre- and post-image object names on the \"index\" lines")), + OPT_COLOR_FLAG(0, "color", &options->use_color, + N_("show colored diff")), OPT_CALLBACK_F(0, "output-indicator-new", &options->output_indicators[OUTPUT_INDICATOR_NEW], N_(""), @@ -5268,15 +5270,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* flags options */ - if (skip_to_optional_arg_default(arg, "--color", &arg, "always")) { - int value = git_config_colorbool(NULL, arg); - if (value < 0) - return error("option `color' expects \"always\", \"auto\", or \"never\""); - options->use_color = value; - } - else if (!strcmp(arg, "--no-color")) - options->use_color = 0; - else if (!strcmp(arg, "--color-moved")) { + if (!strcmp(arg, "--color-moved")) { if (diff_color_moved_default) options->color_moved = diff_color_moved_default; if (options->color_moved == COLOR_MOVED_NO) From patchwork Tue Mar 5 12:30:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839415 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 A2925139A for ; Tue, 5 Mar 2019 12:31:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90A2E2B3B5 for ; Tue, 5 Mar 2019 12:31:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E9E02B43C; Tue, 5 Mar 2019 12:31:42 +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 1CE3F2B3B8 for ; Tue, 5 Mar 2019 12:31:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728266AbfCEMbl (ORCPT ); Tue, 5 Mar 2019 07:31:41 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:33885 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728253AbfCEMbk (ORCPT ); Tue, 5 Mar 2019 07:31:40 -0500 Received: by mail-pg1-f193.google.com with SMTP id i130so5554912pgd.1 for ; Tue, 05 Mar 2019 04:31:40 -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=gRLUrfek8T3CohfmLzRKJ23g5UrTo3AOMBP2uifJXKc=; b=IJ/wm0fKLjybg0D/0qsmKOPH3K+9oosc9rd9WOWN57Nmpu6tcrcRkpPx5MLE/T+RCp ztbJhpMozmW3/6m+OW8kFCTG/SpcckT60buxroKn/kiM2UdhLGCXyIz3M2VHjaxEdD/J 9j7utOQvfNSxg3kfGg+KiM8uEDccBT4R8A97xOPG5G0Hi1WtudB5f3AMsNM0jlDwwmWA ZbI1HsjBXicO4Qv/tgidhHHb9uTPOZXeIqAoziTpe9WWFAx+66UfekCCXKbiV7TH+iv5 bVaeH2YIcEtKdfiy7XziXTRK8RCX2PBczRpnNfLD4JjUTnKWyzobVWALVTaoiThIQxeu UKIg== 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=gRLUrfek8T3CohfmLzRKJ23g5UrTo3AOMBP2uifJXKc=; b=MBN+GvXdezeCAJEk9kVG0vVN0KoH2zWuSywGk3NPoqchMGsHgKPIVaLemLKNfnLA0x Ynr3yLPgoi5myn27PXUr6rMTkmwpiqqs4DgHrV+alYMNR85yCtaHLPnEWeQphkQDK7Jc APvpZLXLLcjIh77186+j49qd8+LeIXpwGsELAlTonXe2UsLPBKWBA57CLmBcLv1qHv7T aesoH0/6Q3PiSDJsJ5fPtanddflMCoQ2DEWIkHzrqUWoYdsubz4enlaFYU3aLgyOKEcH /V+H7gLU/Qp25N1tPSuEkjGuGj0btGSJPZANO0bZyFgCXgpwU2eWGBOPxMSxo3uHkj+q mjhA== X-Gm-Message-State: APjAAAU0c3jjmqUbSHm1crAM1saEpIbV2FJenDEkjFnakLKvcGyJ2pQq sIkhIpS9Rgxe5V7cIAm6Lmlkw5eM X-Google-Smtp-Source: APXvYqwmDkRvGWJg0fGPrJzDAbeeas3sD7wDbNoZSKChzd+ANUNdDQyGbGC7ueWZtpY/wUxMqKty/Q== X-Received: by 2002:a63:f718:: with SMTP id x24mr1214898pgh.107.1551789100088; Tue, 05 Mar 2019 04:31:40 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id 33sm21174157pgs.81.2019.03.05.04.31.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:39 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:35 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 12/20] diff-parseopt: convert --word-diff Date: Tue, 5 Mar 2019 19:30:18 +0700 Message-Id: <20190305123026.7266-13-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/diff.c b/diff.c index bb36d507ec..14c057f3df 100644 --- a/diff.c +++ b/diff.c @@ -5066,6 +5066,32 @@ static int diff_opt_unified(const struct option *opt, return 0; } +static int diff_opt_word_diff(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + if (arg) { + if (!strcmp(arg, "plain")) + options->word_diff = DIFF_WORDS_PLAIN; + else if (!strcmp(arg, "color")) { + options->use_color = 1; + options->word_diff = DIFF_WORDS_COLOR; + } + else if (!strcmp(arg, "porcelain")) + options->word_diff = DIFF_WORDS_PORCELAIN; + else if (!strcmp(arg, "none")) + options->word_diff = DIFF_WORDS_NONE; + else + return error(_("bad --word-diff argument: %s"), arg); + } else { + if (options->word_diff == DIFF_WORDS_NONE) + options->word_diff = DIFF_WORDS_PLAIN; + } + return 0; +} + static void prep_parse_options(struct diff_options *options) { struct option parseopts[] = { @@ -5228,6 +5254,9 @@ static void prep_parse_options(struct diff_options *options) OPT_CALLBACK_F(0, "anchored", options, N_(""), N_("generate diff using the \"anchored diff\" algorithm"), PARSE_OPT_NONEG, diff_opt_anchored), + OPT_CALLBACK_F(0, "word-diff", options, N_(""), + N_("show word diff, using to delimit changed words"), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, diff_opt_word_diff), OPT_GROUP(N_("Diff other options")), OPT_CALLBACK_F(0, "relative", options, N_(""), @@ -5291,24 +5320,6 @@ int diff_opt_parse(struct diff_options *options, options->use_color = 1; options->word_diff = DIFF_WORDS_COLOR; } - else if (!strcmp(arg, "--word-diff")) { - if (options->word_diff == DIFF_WORDS_NONE) - options->word_diff = DIFF_WORDS_PLAIN; - } - else if (skip_prefix(arg, "--word-diff=", &arg)) { - if (!strcmp(arg, "plain")) - options->word_diff = DIFF_WORDS_PLAIN; - else if (!strcmp(arg, "color")) { - options->use_color = 1; - options->word_diff = DIFF_WORDS_COLOR; - } - else if (!strcmp(arg, "porcelain")) - options->word_diff = DIFF_WORDS_PORCELAIN; - else if (!strcmp(arg, "none")) - options->word_diff = DIFF_WORDS_NONE; - else - die("bad --word-diff argument: %s", arg); - } else if ((argcount = parse_long_opt("word-diff-regex", av, &optarg))) { if (options->word_diff == DIFF_WORDS_NONE) options->word_diff = DIFF_WORDS_PLAIN; From patchwork Tue Mar 5 12:30:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839417 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 727D717E4 for ; Tue, 5 Mar 2019 12:31:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 605B52B40A for ; Tue, 5 Mar 2019 12:31:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5551A2B42E; Tue, 5 Mar 2019 12:31:47 +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 EA3102B40A for ; Tue, 5 Mar 2019 12:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728273AbfCEMbq (ORCPT ); Tue, 5 Mar 2019 07:31:46 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:33616 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728116AbfCEMbp (ORCPT ); Tue, 5 Mar 2019 07:31:45 -0500 Received: by mail-pf1-f193.google.com with SMTP id i19so5602544pfd.0 for ; Tue, 05 Mar 2019 04:31:45 -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=8fqGB09blgykRBus+afatKi1AIlVlxvUigS04ouYP6I=; b=hEmMa8xY0cnSp1xARQEwSamx3oBqpj8hwl8c4+7Qh8DelndMp5W/HMrmyv9URDKdMh HkQVnGP6yzitMJNVB2hsEoipHBI1eboPDB2e2xvisrRWNAnAmHE7cq9DT0WiIPNABHWQ iSZ7iw4vkMBlw+XFzzOH45Qy1y872ZJkSn1n4o3pPuDU4ECdEobWmlO44jxBZ9hm0Xlh gPI158/J3m4M7hGaJ9D06U8MchV1J22LAEQSid/54oSsNO0noC3ZGC2kub0KXWNiQmKx ebkeEgoNxWhuLHHuXYhItm8B8wT6jW1GxQXUlD6ZMnKCgKHQQ+pueN3/Cf7sRDAxvhGk XBAg== 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=8fqGB09blgykRBus+afatKi1AIlVlxvUigS04ouYP6I=; b=KP+lH5iLaVSe/12D9VMyvKIoNvFzdvSjjZSqlQKQ7nxAN19rwsJaf1Mys9zc6jYlnB fRJOH+C/FyMomlCpNAkxxBn5n4RWFEAKif+PMu8G1QWynRhRDPynHGQQumuGSFcL2WMk dfvdZuaks2zpM9i+JX+YQf3fCI2pNe0wj+TY2DT1JDnYQ4cYkw/scNkuEyNFAarChPnT XEfoh/nGLdNj120ipU/3SztkeIoMNJY25CdnPGlpsJQiGbVvml10COuBllcV5921/m/O CLvXSJsls+PsY/UvPyQKQT5hKGAda45xjKqem2yZlDICZDvKoGRkfSa1qhfR/V5OLM0v WuZQ== X-Gm-Message-State: APjAAAU9QfOTv/EXo0L/cpsgR8eWowu0K+W2sZjnSJoJr/LeQyu0+LG4 WWOVu2fQbROgNL21iZ9xArOAwB7P X-Google-Smtp-Source: APXvYqy5D7sJgdb5jYSE1sNf24CFH3CViAa+9KcitTtXffP7Ls27ZCuvvaMn0MgTKuAz4OEdcEbeiQ== X-Received: by 2002:a17:902:b413:: with SMTP id x19mr994345plr.256.1551789104628; Tue, 05 Mar 2019 04:31:44 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id p86sm18363863pfa.104.2019.03.05.04.31.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:43 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:40 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 13/20] diff-parseopt: convert --word-diff-regex Date: Tue, 5 Mar 2019 19:30:19 +0700 Message-Id: <20190305123026.7266-14-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/diff.c b/diff.c index 14c057f3df..634981723b 100644 --- a/diff.c +++ b/diff.c @@ -5092,6 +5092,18 @@ static int diff_opt_word_diff(const struct option *opt, return 0; } +static int diff_opt_word_diff_regex(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + if (options->word_diff == DIFF_WORDS_NONE) + options->word_diff = DIFF_WORDS_PLAIN; + options->word_regex = arg; + return 0; +} + static void prep_parse_options(struct diff_options *options) { struct option parseopts[] = { @@ -5257,6 +5269,9 @@ static void prep_parse_options(struct diff_options *options) OPT_CALLBACK_F(0, "word-diff", options, N_(""), N_("show word diff, using to delimit changed words"), PARSE_OPT_NONEG | PARSE_OPT_OPTARG, diff_opt_word_diff), + OPT_CALLBACK_F(0, "word-diff-regex", options, N_(""), + N_("use to decide what a word is"), + PARSE_OPT_NONEG, diff_opt_word_diff_regex), OPT_GROUP(N_("Diff other options")), OPT_CALLBACK_F(0, "relative", options, N_(""), @@ -5320,12 +5335,6 @@ int diff_opt_parse(struct diff_options *options, options->use_color = 1; options->word_diff = DIFF_WORDS_COLOR; } - else if ((argcount = parse_long_opt("word-diff-regex", av, &optarg))) { - if (options->word_diff == DIFF_WORDS_NONE) - options->word_diff = DIFF_WORDS_PLAIN; - options->word_regex = optarg; - return argcount; - } else if (!strcmp(arg, "--exit-code")) options->flags.exit_with_status = 1; else if (!strcmp(arg, "--quiet")) From patchwork Tue Mar 5 12:30:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839419 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 1A22B17E4 for ; Tue, 5 Mar 2019 12:31:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0731F2B3B5 for ; Tue, 5 Mar 2019 12:31:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F040C2B42E; Tue, 5 Mar 2019 12:31:51 +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 9C1182B3B5 for ; Tue, 5 Mar 2019 12:31:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728276AbfCEMbu (ORCPT ); Tue, 5 Mar 2019 07:31:50 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33907 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728152AbfCEMbu (ORCPT ); Tue, 5 Mar 2019 07:31:50 -0500 Received: by mail-pg1-f196.google.com with SMTP id i130so5555170pgd.1 for ; Tue, 05 Mar 2019 04:31:49 -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=7Wf4mhH2fN8+p7lgC0SrE13HSzAkaGlM9HOnmyKJ/pQ=; b=vTos16W1r5E8RoXaD12QiD8yEFH9KosvgAoNMtlsCAKvKu+qFu1+6J8MMQdmYSA7te 2wk4LOULMVm6EE4oX9AATh3qCAUSDboPP0xzb0YGIoTa+ny0Qg2tQl42g8YkbHU4o2TI G2N9zQwf468pv1vrCOZ9MJIcQoY3epmVfYQ11qnWD0p30Q9LaaLOoSzU4SX9I3Tug3BL oD+pU1hfrQhfsXXbnHZSUOA4Yvc7DMBmlknBj5T9mIcuA7VXk0JhkJMPLWHUYfmt1MW6 A9miAT0ljXsTbyd87yhIiM+FbOojuWsFsWumCstDBCFgoSaLH7cC1mQxkgCaYvmw8+3s vfKA== 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=7Wf4mhH2fN8+p7lgC0SrE13HSzAkaGlM9HOnmyKJ/pQ=; b=iSg1HoU8O0dD8xOm65WHmG8/v6QTXpW4i17BdQ6eOE1yVbN9bZsKCeGAY0ThHzWUwF DEQwxuT0d4zWmPirgRqi7q2MVKbahYGse7M5bXMyauCV/kGm+LSFw8amAAidc+y3tOiZ Eij1lAkN/+zHuXjoCqajZ95u4ZeT3itgdnvkMJxj1anf3E2p9M/InlPkCX97sSTT5fuG dFDWDx8AwqhxKovLez290hA8TXXjQ/pAQ9IkP/bS0BhpLcb9RRhIaMZWIbrv8iW9s4+/ Umbaho4GZDAFGp71Oxe+SD/MnahjyhuSfnsLZICbKYC0NlJqYIFc0SfLSVU0PHe+O4H2 0N6Q== X-Gm-Message-State: APjAAAX2P6FjzWn7TOkI0sXjyjnfaZpKJ4yPlpopaZDyyA/Ntx7YzE4N hjWcSwSOvn3P4CUXrzRx+LyE734y X-Google-Smtp-Source: APXvYqxnmjXK97rWtJcrHXEbuiDvGZykdPfCd92xT+JtiprimmrSHgpmqC+wnVNMN29zaFDkzT59bg== X-Received: by 2002:a17:902:8217:: with SMTP id x23mr1004679pln.332.1551789109192; Tue, 05 Mar 2019 04:31:49 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id h63sm22160473pfd.148.2019.03.05.04.31.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:48 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:44 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 14/20] diff-parseopt: convert --color-words Date: Tue, 5 Mar 2019 19:30:20 +0700 Message-Id: <20190305123026.7266-15-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/diff.c b/diff.c index 634981723b..5180c2f5a9 100644 --- a/diff.c +++ b/diff.c @@ -4901,6 +4901,18 @@ static int diff_opt_char(const struct option *opt, return 0; } +static int diff_opt_color_words(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + options->use_color = 1; + options->word_diff = DIFF_WORDS_COLOR; + options->word_regex = arg; + return 0; +} + static int diff_opt_compact_summary(const struct option *opt, const char *arg, int unset) { @@ -5272,6 +5284,9 @@ static void prep_parse_options(struct diff_options *options) OPT_CALLBACK_F(0, "word-diff-regex", options, N_(""), N_("use to decide what a word is"), PARSE_OPT_NONEG, diff_opt_word_diff_regex), + OPT_CALLBACK_F(0, "color-words", options, N_(""), + N_("equivalent to --word-diff=color --word-diff-regex="), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, diff_opt_color_words), OPT_GROUP(N_("Diff other options")), OPT_CALLBACK_F(0, "relative", options, N_(""), @@ -5331,11 +5346,7 @@ int diff_opt_parse(struct diff_options *options, if (cm & COLOR_MOVED_WS_ERROR) return -1; options->color_moved_ws_handling = cm; - } else if (skip_to_optional_arg_default(arg, "--color-words", &options->word_regex, NULL)) { - options->use_color = 1; - options->word_diff = DIFF_WORDS_COLOR; - } - else if (!strcmp(arg, "--exit-code")) + } else if (!strcmp(arg, "--exit-code")) options->flags.exit_with_status = 1; else if (!strcmp(arg, "--quiet")) options->flags.quick = 1; From patchwork Tue Mar 5 12:30: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: 10839421 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 B77B917E4 for ; Tue, 5 Mar 2019 12:31:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A68CA2B380 for ; Tue, 5 Mar 2019 12:31:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B3062B3C4; Tue, 5 Mar 2019 12:31:56 +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 433582B42A for ; Tue, 5 Mar 2019 12:31:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728278AbfCEMbz (ORCPT ); Tue, 5 Mar 2019 07:31:55 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39924 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728152AbfCEMby (ORCPT ); Tue, 5 Mar 2019 07:31:54 -0500 Received: by mail-pf1-f193.google.com with SMTP id i20so5592675pfo.6 for ; Tue, 05 Mar 2019 04:31:54 -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=5mgmSro08qtZ9jhTs3oeAXpMOjMSuTE77L57br4AqxI=; b=RZO1P2B+FuqGiB5KkSrgW+lPldxtcxr6zLbybM52xvKfwcjAqQSUNe9kTdijF2va56 0nQg4wxybhLz9hReIGFjh/Am5j6TO5mYIeTHVoKaJtyf20uGNpmc0TepbFnPxyF0hmq8 2rw03lvVE0FPAoGHfoTgbXVAGjn6omXSOFvawqV19KQZWcf4wOz5Fw4xSDcLWKUZbkr7 Bp8/Q59jI+NIjnquXjbF/ejIMwISSCyGnO8n8oXXxM6aZtAEdpaiBivtNNEvX/zwpnEC +7kTQ5pB0W7e9sk/64oi9oEzXuYe4zqQOm4XPB6coww0xlP7Prs5nsqh2ql/nyNJBZD9 sqXw== 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=5mgmSro08qtZ9jhTs3oeAXpMOjMSuTE77L57br4AqxI=; b=SrQHHoEiQKCYF5wVYLdcQ+HZlMMu4UCGU9KuSm10Ph/hyDO+M9tuTvVmjt2wLIblnk HGy5gYhx86xfjuY9Uz/Yqtcd+S7j4x5/dik83tMYUBn1btWktghCRefbgXuzg/MTD5rv 8bFmF1dN224DeifYq/BaXM0wrqtv6VSNQ4Fji86t/mqx/Kk4TERrsk3Q7jKAKAFX574Y J5/54Gu4DTYrmiq/d0JrX0HlArSX6NKoAiw9ashewCcdx+SbQl9Gw71n/7R2MvDBDo8Q FuQQf8GnEdeN1xNtyO1YsBrLrjjuMi1pNvXhdvSl3G60vNS9gYn8jOtvnGW3EKWUAqkT TVAA== X-Gm-Message-State: APjAAAWYKaFwHjhL6NQJrUfH3C3kKMHimmXm7i5M6CfcEaTYZM7Ph57w AxJI8Cw6pSXRiJr4YRk7ztBQ18XH X-Google-Smtp-Source: APXvYqyQcPk3yR0sFPlikRPBLi2lX40QZ3sl395ws1wJlxzmNH3A/a8Y3Gh+/Lcd94m9n4j0CxYn7Q== X-Received: by 2002:a63:d507:: with SMTP id c7mr1164767pgg.105.1551789113701; Tue, 05 Mar 2019 04:31:53 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id n15sm19787768pfi.173.2019.03.05.04.31.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:53 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:49 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 15/20] diff-parseopt: convert --exit-code Date: Tue, 5 Mar 2019 19:30:21 +0700 Message-Id: <20190305123026.7266-16-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 5180c2f5a9..3f80e06de5 100644 --- a/diff.c +++ b/diff.c @@ -5297,6 +5297,8 @@ static void prep_parse_options(struct diff_options *options) N_("treat all files as text")), OPT_BOOL('R', NULL, &options->flags.reverse_diff, N_("swap two inputs, reverse the diff")), + OPT_BOOL(0, "exit-code", &options->flags.exit_with_status, + N_("exit with 1 if there were differences, 0 otherwise")), { OPTION_CALLBACK, 0, "output", options, N_(""), N_("Output to a specific file"), PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, @@ -5346,9 +5348,7 @@ int diff_opt_parse(struct diff_options *options, if (cm & COLOR_MOVED_WS_ERROR) return -1; options->color_moved_ws_handling = cm; - } else if (!strcmp(arg, "--exit-code")) - options->flags.exit_with_status = 1; - else if (!strcmp(arg, "--quiet")) + } else if (!strcmp(arg, "--quiet")) options->flags.quick = 1; else if (!strcmp(arg, "--ext-diff")) options->flags.allow_external = 1; From patchwork Tue Mar 5 12:30:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839423 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 DEBE7139A for ; Tue, 5 Mar 2019 12:32:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC62A2B102 for ; Tue, 5 Mar 2019 12:32:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C12552B427; Tue, 5 Mar 2019 12:32:00 +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 771862B367 for ; Tue, 5 Mar 2019 12:32:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728187AbfCEMb7 (ORCPT ); Tue, 5 Mar 2019 07:31:59 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:46176 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728216AbfCEMb7 (ORCPT ); Tue, 5 Mar 2019 07:31:59 -0500 Received: by mail-pg1-f196.google.com with SMTP id 196so5544834pgf.13 for ; Tue, 05 Mar 2019 04:31:58 -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=ZO/SapRkxoHh9jFbm6g/cmLzETkMPwQCVij31eIMm4Y=; b=tVdq0CbkIRpFTh+kBn62JNri9/KHmD+DpYF7wywUwykuomtqpg/yQkAUpNlO44oucS ns4ZxXTfFy2aVM/wXuS2aABD2iRTsc5dboqVX1+V/vhC4KjH8IHPF0ZHFoOHpX6+J6dO ZaG231ZRL7C+R+wyy72pVbkxXPPhhcZqrxq7u71u/m9Xg0U1JATFgWDYn8PJL+M1kxaU +OHYgXhfXNDHyGZVaeBrw+TRb9ZK1E5TrO23r5n1/tkTVcA/Ktzh2JjTtGy0hrBJ8dI9 7qgl5zN0sBBZnIHiFyUdnXHlwa+xcC0btCuSGWffXLzPGlFX6NU4sDTpDzcFIVzMPeyv t9Kw== 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=ZO/SapRkxoHh9jFbm6g/cmLzETkMPwQCVij31eIMm4Y=; b=ZJjOUj4ZnMCy9klWzvfkT31cyOlWWItYdu5UKxWglHeng29Y9YRPrWtZ59qbiEwobH sdFre4ZMqbgmk3jhaBd/ppwjdRDKF700yD02S5vl0up/LtCUpnUDO8ijUwRGXZ0ehmw6 +jiRpsojQ47MXpuj9b2HOvqyHkmjbCqhfNIxlirc0xMresWefX8nSoqjdTIlQ3RTJatM acTxrn+nSEK5FbXZ2hN5WEwnC1DWgODnfusAB3QAxPIMXnuTmQDCxKX/LIxfMeuGh+nE ENhpn6J37VNQxzt48dmjOIeW7uwi4iLDd2I4b0ruK6WM3xsUmSAydTuFPk/fSuK1M0sH 38YA== X-Gm-Message-State: APjAAAUaYlq/SX23s3ebkWGMeHns4AaDL9oWe7fcZHCqPV2yoQFuCeXB sjimeLZwrAD8Ebf0XiXYhBEQ+ubk X-Google-Smtp-Source: APXvYqx92hC9lVeX/HzhJTJL5Xx7QJYltNnupUTMbazWIqTSvyW+KaY1sWOR60eYKV9HEiRmc2SHlg== X-Received: by 2002:a62:39c5:: with SMTP id u66mr1582934pfj.245.1551789118337; Tue, 05 Mar 2019 04:31:58 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id p14sm21195544pgn.34.2019.03.05.04.31.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:31:57 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:54 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 16/20] diff-parseopt: convert --quiet Date: Tue, 5 Mar 2019 19:30:22 +0700 Message-Id: <20190305123026.7266-17-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 3f80e06de5..bd15269346 100644 --- a/diff.c +++ b/diff.c @@ -5299,6 +5299,8 @@ static void prep_parse_options(struct diff_options *options) N_("swap two inputs, reverse the diff")), OPT_BOOL(0, "exit-code", &options->flags.exit_with_status, N_("exit with 1 if there were differences, 0 otherwise")), + OPT_BOOL(0, "quiet", &options->flags.quick, + N_("disable all output of the program")), { OPTION_CALLBACK, 0, "output", options, N_(""), N_("Output to a specific file"), PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, @@ -5348,9 +5350,7 @@ int diff_opt_parse(struct diff_options *options, if (cm & COLOR_MOVED_WS_ERROR) return -1; options->color_moved_ws_handling = cm; - } else if (!strcmp(arg, "--quiet")) - options->flags.quick = 1; - else if (!strcmp(arg, "--ext-diff")) + } else if (!strcmp(arg, "--ext-diff")) options->flags.allow_external = 1; else if (!strcmp(arg, "--no-ext-diff")) options->flags.allow_external = 0; From patchwork Tue Mar 5 12:30:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839425 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 B051C139A for ; Tue, 5 Mar 2019 12:32:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CAC62B42E for ; Tue, 5 Mar 2019 12:32:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BDD22B440; Tue, 5 Mar 2019 12:32:05 +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 0F68F2B43F for ; Tue, 5 Mar 2019 12:32:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728284AbfCEMcE (ORCPT ); Tue, 5 Mar 2019 07:32:04 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36856 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728216AbfCEMcD (ORCPT ); Tue, 5 Mar 2019 07:32:03 -0500 Received: by mail-pf1-f196.google.com with SMTP id n22so5601242pfa.3 for ; Tue, 05 Mar 2019 04:32:03 -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=EHJtCZB0nRRXmayE8ilGlRs8+6kE3NJ01L0SChTZTR8=; b=GAI1pYdmu1Yjvpb+dQy3SZmSs6uq+x1UKzoaX1JvphhWsHiGDiZEf9/w9eGBkCtqKq mxrssbiuCw081HunQUXqHdNBC/zoXebKA+/2IoXjewVQ3TGJddjYUuL0XHVDkeFmpoqH pe+enr5/gHJFxw9sBDhYgHpZFSPg0lkd1Dkey89NVKU+t0954YzMzeiVEolGce7xe1/n t9U5kMXdbtG9S6HPNRJH4V6erMFFtH7OuriMRQ6Ss4na4PIKeipwi7DTAUMkQSeRpdRG LQeXKKg+oBmFCo9Kp9QVejVDuSMJ0rVeEFDYbFzKTBFgSttpkXPPKD6/W9CxPtSlQHZe BxOg== 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=EHJtCZB0nRRXmayE8ilGlRs8+6kE3NJ01L0SChTZTR8=; b=siZMuwDQj4ttAPD3g69D8eT0tOd2bzJ4gorBzSOLKB9l2XraadTJYQLMI4CSA6TrkU 3GZG6y0dFjIwr6MOd8n8WlOzM26zGvyM+O+WCSffvEks0C4392C2aA+EzFptH61LcMaQ 8i3USYAKdCAn2WFUtwRkKP/GhbdafhxJQPADO1cEfm4/Eej9F57KTKguByapOPVBJhjK 3X45RctxGEXklFDPiW2mK2aBU+31Ty+CaW7rWEu9gKt3JOaTwTYGIJg5wlmhOAe/XzTI sjJSXD+c1pPtz2L/lRW7FdK3VLlu9eJJqgiEJMDVpGVc/cvxEuIlsqy+gHajgT7YmCya kjdA== X-Gm-Message-State: APjAAAX8lFl36W+BFFLyMCp+MsQWIJU73CfwjatHwWfWozwiDdOPKteh 9JYpmELhEtYJnjyc+ShO0GRi0zSc X-Google-Smtp-Source: APXvYqyXKWKYdEego/oaA+hBr3HTcMj6okRTQFJizeYUhUX1Ul+yZgIiEVcUE9R1ZG1dAevg85pBWA== X-Received: by 2002:a17:902:8e8b:: with SMTP id bg11mr955920plb.328.1551789122774; Tue, 05 Mar 2019 04:32:02 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id 17sm10546452pfj.80.2019.03.05.04.32.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:32:02 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:31:58 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 17/20] diff-parseopt: convert --ext-diff Date: Tue, 5 Mar 2019 19:30:23 +0700 Message-Id: <20190305123026.7266-18-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/diff.c b/diff.c index bd15269346..b460fa010b 100644 --- a/diff.c +++ b/diff.c @@ -5301,6 +5301,8 @@ static void prep_parse_options(struct diff_options *options) N_("exit with 1 if there were differences, 0 otherwise")), OPT_BOOL(0, "quiet", &options->flags.quick, N_("disable all output of the program")), + OPT_BOOL(0, "ext-diff", &options->flags.allow_external, + N_("allow an external diff helper to be executed")), { OPTION_CALLBACK, 0, "output", options, N_(""), N_("Output to a specific file"), PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, @@ -5350,11 +5352,7 @@ int diff_opt_parse(struct diff_options *options, if (cm & COLOR_MOVED_WS_ERROR) return -1; options->color_moved_ws_handling = cm; - } else if (!strcmp(arg, "--ext-diff")) - options->flags.allow_external = 1; - else if (!strcmp(arg, "--no-ext-diff")) - options->flags.allow_external = 0; - else if (!strcmp(arg, "--textconv")) { + } else if (!strcmp(arg, "--textconv")) { options->flags.allow_textconv = 1; options->flags.textconv_set_via_cmdline = 1; } else if (!strcmp(arg, "--no-textconv")) From patchwork Tue Mar 5 12:30:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839427 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 6F98B139A for ; Tue, 5 Mar 2019 12:32:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DC912B40B for ; Tue, 5 Mar 2019 12:32:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 525C32B48E; Tue, 5 Mar 2019 12:32:10 +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 EF5E12B40B for ; Tue, 5 Mar 2019 12:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728287AbfCEMcJ (ORCPT ); Tue, 5 Mar 2019 07:32:09 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:34278 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728170AbfCEMcI (ORCPT ); Tue, 5 Mar 2019 07:32:08 -0500 Received: by mail-pf1-f194.google.com with SMTP id u9so5600335pfn.1 for ; Tue, 05 Mar 2019 04:32:07 -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=AfbRFUzEiozOAYC3PuRSi6wck7Ugu7l6ZXnRc1FkOrg=; b=cBLM7Ap04tt5cxVioc7pUPz/poGUlzxLtmYW/Bs5pfJJ/FFYujnnD1c9q7ZHXgqxpD hBcMSbm7TTpuGRJ2x4nrZQN7K9cR/ae9FF6VF8bdALp38PUAUos8Ya4uoQdJ5U0eyWqW SOd1AUBT03NxBYd/PqAxP189uuJZc8tTwEuK0nrx6jQ69VQ3xKVMNUjQq5NI3ZkmBQvf gSviqMsACF1DM6DME96X+05RsMhh7QRsi6nltiI0lE2Arjg9AiIOMMcWo+FkWjs3mYB/ ftsJzmXScXfqIllqViHuCEF97kCHQb/L1JuDZuFdV4RyQsVXTRIjEZkLepBeL9HUb18j +vIg== 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=AfbRFUzEiozOAYC3PuRSi6wck7Ugu7l6ZXnRc1FkOrg=; b=HNF6/xDSfcx0Y4A9e2CbdJNb0pqjNVPuIzWmhhWf0YXZUiDP+YmZxBhvPNSqZAgm+s sj5FZOdyqqEf+cyKeQzWdzW3y7jYzey1CUPFT0V991wSWwduZu9+qvbfmRHxHysgPQfD Q0GFZxhnmtDliSeD0UgKLvXKTEacvQ+RJvkneFJjsNxknRpopD9AA8P2GyQeSu175Ai3 +UIYsyZKmFG0Ca3UH6e9gSnYmqeq/Tae/ebInawLQg3c1mzRjMs1XuD3H5Mxl7cndHH6 869FBalH2hC2Uq4XFFGdvRkbMShCA2gRRvmeLii1MxTSblAqsZvT5krkdWZjfr/RTVP1 +8yA== X-Gm-Message-State: APjAAAWqUIWdPi8IH3Voto9h30Rtu2xxw4j0ZKloULPa9iM/JqLNnrvV D9PXsAlHiCbqy90MYv/VR68s+PqC X-Google-Smtp-Source: APXvYqyIWKeGLKrxyuU9XUO4bc3uLPmo8kSB9lxyFasQuHOANaaDHklT36N6lEIZBPXkHE2jTQA3Pg== X-Received: by 2002:a63:5362:: with SMTP id t34mr1188909pgl.81.1551789127453; Tue, 05 Mar 2019 04:32:07 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id w17sm13193191pfn.63.2019.03.05.04.32.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:32:06 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:32:03 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 18/20] diff-parseopt: convert --textconv Date: Tue, 5 Mar 2019 19:30:24 +0700 Message-Id: <20190305123026.7266-19-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/diff.c b/diff.c index b460fa010b..a27bca527d 100644 --- a/diff.c +++ b/diff.c @@ -5062,6 +5062,21 @@ static int diff_opt_relative(const struct option *opt, return 0; } +static int diff_opt_textconv(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_ARG(arg); + if (unset) { + options->flags.allow_textconv = 0; + } else { + options->flags.allow_textconv = 1; + options->flags.textconv_set_via_cmdline = 1; + } + return 0; +} + static int diff_opt_unified(const struct option *opt, const char *arg, int unset) { @@ -5303,6 +5318,9 @@ static void prep_parse_options(struct diff_options *options) N_("disable all output of the program")), OPT_BOOL(0, "ext-diff", &options->flags.allow_external, N_("allow an external diff helper to be executed")), + OPT_CALLBACK_F(0, "textconv", options, NULL, + N_("run external text conversion filters when comparing binary files"), + PARSE_OPT_NOARG, diff_opt_textconv), { OPTION_CALLBACK, 0, "output", options, N_(""), N_("Output to a specific file"), PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, @@ -5352,12 +5370,7 @@ int diff_opt_parse(struct diff_options *options, if (cm & COLOR_MOVED_WS_ERROR) return -1; options->color_moved_ws_handling = cm; - } else if (!strcmp(arg, "--textconv")) { - options->flags.allow_textconv = 1; - options->flags.textconv_set_via_cmdline = 1; - } else if (!strcmp(arg, "--no-textconv")) - options->flags.allow_textconv = 0; - else if (skip_to_optional_arg_default(arg, "--ignore-submodules", &arg, "all")) { + } else if (skip_to_optional_arg_default(arg, "--ignore-submodules", &arg, "all")) { options->flags.override_submodule_config = 1; handle_ignore_submodules_arg(options, arg); } else if (skip_to_optional_arg_default(arg, "--submodule", &arg, "log")) From patchwork Tue Mar 5 12:30:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839429 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 E7F9C139A for ; Tue, 5 Mar 2019 12:32:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6A4B2B102 for ; Tue, 5 Mar 2019 12:32:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4F512B497; Tue, 5 Mar 2019 12:32:15 +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 6FCC82B40B for ; Tue, 5 Mar 2019 12:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728290AbfCEMcO (ORCPT ); Tue, 5 Mar 2019 07:32:14 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38979 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728116AbfCEMcO (ORCPT ); Tue, 5 Mar 2019 07:32:14 -0500 Received: by mail-pf1-f194.google.com with SMTP id i20so5593454pfo.6 for ; Tue, 05 Mar 2019 04:32:13 -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=dwuq6qk4b0k/48vdaomvIlz//D+7pgH2mcmtcn+hMRw=; b=sKirZeiGv6ovH1wYSZ5NOhQjkX6/lrjZ9xLD7N8QW+Th/EbMmovq/mG8k7wmdCXZXt Q4tDYjiUec9DPoBVzj5BUafHQFFBeifgeJnKGqIMP2LhDBvTPXp+SIa3ezbiPD4xOlzJ siFKi+ykYDIVhB/qbWaGQOQHfhrPB64+bLddjiswBx4BgXjWNnb3h4t3Q626/xltqxFA RvACXrS08wG4XFDLMH9TngZtY5LltPPYzMdxWaHFxe8bDzVt6pz62NyDIZd/AmCp1dYK GL754azWGygl7paE4BcdyymZiJnOKCdO06Ysca+rjNSuxGsK1uR0zoVkWGHRxB48DqZ4 sVPQ== 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=dwuq6qk4b0k/48vdaomvIlz//D+7pgH2mcmtcn+hMRw=; b=Vlg5Ug+W/T5HLpxHvL065ft0+KIRoO7RIt9mWkgvA6gvKsET9Z8d9qGMXsCdL9LMfC QvbAXle6BLt3SI4JhCgFhmNM2LbBTSMbLtShxPlWZjO9zBVXqDgXztZlvLkZf2c0FcmK Q3WvGwXrsplWQFo/jkL7jfD6fPy0nDrUzlEcx0x6pNq95s5grAl9GlOLL/1oYED4QVoB kP4u3YJuQ/2a8/JkKM+aMoAeoycoLTKvDAOyXwljQOwI/LJ9eAQ2XEnCbVnsyBI8SLtO zxm7rv9okys6Oe9YBXc1qSUXp3J9dwmPIjcGCLjvyT7JidENKDQkIgv6ycIeNs+OrZZJ umGw== X-Gm-Message-State: APjAAAWIbASyDwOrzIeaksI1xiuHU6egTp6TbeDIFkMoi9TbokH0xDoT GdbQ4Kth7CgIyMe55nMO9NyxkSmb X-Google-Smtp-Source: APXvYqzgiVqM7gJmbEFg7raQr0k+ZOYsPE50GjY6cVEFOeXVJhvA/Q7fm/mUkoqAAXJOPG240Hpn3A== X-Received: by 2002:a62:14c6:: with SMTP id 189mr1665125pfu.23.1551789131875; Tue, 05 Mar 2019 04:32:11 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id f193sm13669696pgc.3.2019.03.05.04.32.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:32:11 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:32:07 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 19/20] diff-parseopt: convert --ignore-submodules Date: Tue, 5 Mar 2019 19:30:25 +0700 Message-Id: <20190305123026.7266-20-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index a27bca527d..6fd6106963 100644 --- a/diff.c +++ b/diff.c @@ -5013,6 +5013,19 @@ static int diff_opt_follow(const struct option *opt, return 0; } +static int diff_opt_ignore_submodules(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + if (!arg) + arg = "all"; + options->flags.override_submodule_config = 1; + handle_ignore_submodules_arg(options, arg); + return 0; +} + static enum parse_opt_result diff_opt_output(struct parse_opt_ctx_t *ctx, const struct option *opt, const char *arg, int unset) @@ -5321,6 +5334,10 @@ static void prep_parse_options(struct diff_options *options) OPT_CALLBACK_F(0, "textconv", options, NULL, N_("run external text conversion filters when comparing binary files"), PARSE_OPT_NOARG, diff_opt_textconv), + OPT_CALLBACK_F(0, "ignore-submodules", options, N_(""), + N_("ignore changes to submodules in the diff generation"), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, + diff_opt_ignore_submodules), { OPTION_CALLBACK, 0, "output", options, N_(""), N_("Output to a specific file"), PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, @@ -5370,9 +5387,6 @@ int diff_opt_parse(struct diff_options *options, if (cm & COLOR_MOVED_WS_ERROR) return -1; options->color_moved_ws_handling = cm; - } else if (skip_to_optional_arg_default(arg, "--ignore-submodules", &arg, "all")) { - options->flags.override_submodule_config = 1; - handle_ignore_submodules_arg(options, arg); } else if (skip_to_optional_arg_default(arg, "--submodule", &arg, "log")) return parse_submodule_opt(options, arg); else if (skip_prefix(arg, "--ws-error-highlight=", &arg)) From patchwork Tue Mar 5 12:30:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Duy Nguyen X-Patchwork-Id: 10839431 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 0EB4E180E for ; Tue, 5 Mar 2019 12:32:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F023D2B43F for ; Tue, 5 Mar 2019 12:32:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4DE92B48E; Tue, 5 Mar 2019 12:32:18 +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 847BE2B492 for ; Tue, 5 Mar 2019 12:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728294AbfCEMcR (ORCPT ); Tue, 5 Mar 2019 07:32:17 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:46218 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728116AbfCEMcR (ORCPT ); Tue, 5 Mar 2019 07:32:17 -0500 Received: by mail-pg1-f195.google.com with SMTP id 196so5545343pgf.13 for ; Tue, 05 Mar 2019 04:32:16 -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=jqSOvYhLPVVb+z5X/j19KgWRwXJvbhACZvtr3rqYnVw=; b=snveaiYWyXPKIRyySJWstp2DKb1DjhTnEhs2pqPNqy/0wbtOiOmOChuBboTqa4RCCK jgZYsl3GSIkCWFiwHiG4uThJEVQZUIqs5Y2WrbeqZbRTbfvaNTwOCKT7pB8GxLWVjQXF VNGDunSQJ9CHKINCLKGhnnlE4qIqh+s8rhnqzkODkr3P9xNCoK2ryovSlRuQYOmYrio4 WLshqtVgtl9WPrEMTDI+OpREorHX75aV4a9yl1MK0tYDB9qOc4neN1VBed3n8QRRuGCJ HsLUM9VwzUVSIvqMzxUIrHgBMp/+9xzEURFNG+oV8+ff0eBW22u+BeiWTwmz1cKV8u5q zUgQ== 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=jqSOvYhLPVVb+z5X/j19KgWRwXJvbhACZvtr3rqYnVw=; b=gXFqPBvfp0vkEynNDCXNd7ZEYxf067v0dr9oCGzkE1Lmn5nFP9t7FHiO8QibDsfmJ0 MSE4leVI1auWkfuR8oEVJhZcahn4e1eIfx+bY3scBRbQ3AK0tFVyx1Nk2hE59HtC8Utf O0oCyB4awVLFRiQ6bw1+19/yzJDFCP/NzAs1/j0fRmkO+BMC0W/YIFjxHONLMG3JjLm4 0iBxUp8m7HTJFGOaAQkdSzw7PlrUdcoQfA8mdYax/NBF/jAdjR1WH4UX+j1jPZRmWE+8 dLlNKUhqcI/pdwc+VC5RHEzlpbl4bmE1kqk39RVox9qoQnhRV0Hy/07YmxEN2xXzsfa8 WZHw== X-Gm-Message-State: APjAAAUXuxBmmzmoFpog1vhGrlqxfyjsFOkbOD90WKQKYzUek8kg1sI+ NVLmBP5hqSgx/EygoNHGtlmJ1z4l X-Google-Smtp-Source: APXvYqzf0ZFhtlvBVea4evoOCnv5lMuDynSi0EsVRcmJGBTFTaL8bj5iCy351/gRDe4H0hiNRAZYxw== X-Received: by 2002:a65:5a81:: with SMTP id c1mr1183591pgt.217.1551789136375; Tue, 05 Mar 2019 04:32:16 -0800 (PST) Received: from ash ([171.226.148.85]) by smtp.gmail.com with ESMTPSA id x23sm31599111pfe.0.2019.03.05.04.32.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 04:32:15 -0800 (PST) Received: by ash (sSMTP sendmail emulation); Tue, 05 Mar 2019 19:32:12 +0700 From: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= Subject: [PATCH 20/20] diff-parseopt: convert --submodule Date: Tue, 5 Mar 2019 19:30:26 +0700 Message-Id: <20190305123026.7266-21-pclouds@gmail.com> X-Mailer: git-send-email 2.21.0.rc1.337.gdf7f8d0522 In-Reply-To: <20190305123026.7266-1-pclouds@gmail.com> References: <20190305123026.7266-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 --- diff.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/diff.c b/diff.c index 6fd6106963..ce118bb326 100644 --- a/diff.c +++ b/diff.c @@ -4721,14 +4721,6 @@ static int parse_dirstat_opt(struct diff_options *options, const char *params) return 1; } -static int parse_submodule_opt(struct diff_options *options, const char *value) -{ - if (parse_submodule_params(options, value)) - die(_("Failed to parse --submodule option parameter: '%s'"), - value); - return 1; -} - static const char diff_status_letters[] = { DIFF_STATUS_ADDED, DIFF_STATUS_COPIED, @@ -5075,6 +5067,20 @@ static int diff_opt_relative(const struct option *opt, return 0; } +static int diff_opt_submodule(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + if (!arg) + arg = "log"; + if (parse_submodule_params(options, arg)) + return error(_("failed to parse --submodule option parameter: '%s'"), + arg); + return 0; +} + static int diff_opt_textconv(const struct option *opt, const char *arg, int unset) { @@ -5338,6 +5344,10 @@ static void prep_parse_options(struct diff_options *options) N_("ignore changes to submodules in the diff generation"), PARSE_OPT_NONEG | PARSE_OPT_OPTARG, diff_opt_ignore_submodules), + OPT_CALLBACK_F(0, "submodule", options, N_(""), + N_("specify how differences in submodules are shown"), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, + diff_opt_submodule), { OPTION_CALLBACK, 0, "output", options, N_(""), N_("Output to a specific file"), PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, @@ -5387,9 +5397,7 @@ int diff_opt_parse(struct diff_options *options, if (cm & COLOR_MOVED_WS_ERROR) return -1; options->color_moved_ws_handling = cm; - } else if (skip_to_optional_arg_default(arg, "--submodule", &arg, "log")) - return parse_submodule_opt(options, arg); - else if (skip_prefix(arg, "--ws-error-highlight=", &arg)) + } else if (skip_prefix(arg, "--ws-error-highlight=", &arg)) return parse_ws_error_highlight_opt(options, arg); else if (!strcmp(arg, "--ita-invisible-in-index")) options->ita_invisible_in_index = 1;