From patchwork Wed Sep 25 20:13:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Gruin X-Patchwork-Id: 11161325 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C7BDB13B1 for ; Wed, 25 Sep 2019 20:13:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5F652146E for ; Wed, 25 Sep 2019 20:13:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Fz+q4IC6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392947AbfIYUNv (ORCPT ); Wed, 25 Sep 2019 16:13:51 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40060 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732902AbfIYUNv (ORCPT ); Wed, 25 Sep 2019 16:13:51 -0400 Received: by mail-wr1-f66.google.com with SMTP id l3so132388wru.7 for ; Wed, 25 Sep 2019 13:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zcYwitYhFTlZOqLOXsigrZlJZar7IrCKMThEaxaGIb4=; b=Fz+q4IC6WHZX6p31yQyl0+eo3hc3724+BalNelIh2Ho48vdMxyRDviuCMUe14AP2K1 N6FIEkKVbueDP7vW0wtTRT3AP+Y6DNwUDqkTHB0zjdKcrglOC1fgbvdgg3oRgyNm9Vkp 6FzCAc9ktQx4lIqs7jm7rL4S8m8bjpfqQnrTysWzS1uBx1p55d7bBq5OaM0yu0N0yCS7 Vou33u31mbY1JcAPyIOxQBi2xSb7Kxknfc7568kFEDo23VZGJ9b8gSlWxegVr9DI33IM w1BM2OzzSHGos43tmlsWBKRpfSU3u591jms2iRND0wUIMcKO3KHdTLu5wqnFpmYjOf4E b8vQ== 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=zcYwitYhFTlZOqLOXsigrZlJZar7IrCKMThEaxaGIb4=; b=exYLmTMd/TecMNrJK0JDS6cGnIVpTgPEKxwcMm4fPgBkZFYqYIImJ4cT/xNW2JOJuX xwkMYuwGA2w1X3arUEkINma4HzSsOmLl9nFT+OxJNYhB5SzwKf5pQVFe5EJZLNprkBoP buYAr/BdabVRlJnYb+azqDhG7WmayqNBo94KQAwFFSr3u1v1MLrVvQOTZh5DKZaFa5Qr XkRmf5yE50MDZoiEJyK39pGjb0zgaTDUNw66xA7Uk8YaTFbwHw6EZu0AaCO1wlgKnk7w YQE2lfkUxXrUI4zP9+vwPg2vjAMXqU9q29cO5jeUkcMQntpKSp1FohfhUHyoFOQ1bo4m 6Gnw== X-Gm-Message-State: APjAAAXmjVVsniXM3n9lE+4kKBT3SvdXzo/tHiTmk0KMoXq27W86iPIk CPot3nv0Xm3TwxQkOrJiVGF0oEvj X-Google-Smtp-Source: APXvYqwD1Xr11Oqi8UVSlvfZpHfFlmsImJ4SxlQMFMpFTTdZpdZriKKtJXlp7GsSZk8500Wi8dAMug== X-Received: by 2002:adf:ff8a:: with SMTP id j10mr105685wrr.334.1569442429205; Wed, 25 Sep 2019 13:13:49 -0700 (PDT) Received: from localhost.localdomain (atoulouse-658-1-81-250.w90-5.abo.wanadoo.fr. [90.5.214.250]) by smtp.googlemail.com with ESMTPSA id d193sm138022wmd.0.2019.09.25.13.13.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Sep 2019 13:13:48 -0700 (PDT) From: Alban Gruin To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood , Junio C Hamano , Alban Gruin Subject: [PATCH v1 1/5] sequencer: update `total_nr' when adding an item to a todo list Date: Wed, 25 Sep 2019 22:13:11 +0200 Message-Id: <20190925201315.19722-2-alban.gruin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190925201315.19722-1-alban.gruin@gmail.com> References: <20190925201315.19722-1-alban.gruin@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org `total_nr' is the total amount of items, done and toto, that are in a todo list. But unlike `nr', it was not updated when an item was appended to the list. This variable is mostly used by command prompts (ie. git-prompt.sh and the like). Signed-off-by: Alban Gruin --- sequencer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sequencer.c b/sequencer.c index d648aaf416..575b852a5a 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2070,6 +2070,7 @@ void todo_list_release(struct todo_list *todo_list) static struct todo_item *append_new_todo(struct todo_list *todo_list) { ALLOC_GROW(todo_list->items, todo_list->nr + 1, todo_list->alloc); + todo_list->total_nr++; return todo_list->items + todo_list->nr++; } From patchwork Wed Sep 25 20:13:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Gruin X-Patchwork-Id: 11161327 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CD8E813B1 for ; Wed, 25 Sep 2019 20:13:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC3C621D7B for ; Wed, 25 Sep 2019 20:13:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="p/NDlu5h" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392966AbfIYUNx (ORCPT ); Wed, 25 Sep 2019 16:13:53 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:51769 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731062AbfIYUNw (ORCPT ); Wed, 25 Sep 2019 16:13:52 -0400 Received: by mail-wm1-f68.google.com with SMTP id 7so117112wme.1 for ; Wed, 25 Sep 2019 13:13:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q32P1WqcgYd8m8YbrvCFu8ke9M5+bZk/HZ8TyMKYDZo=; b=p/NDlu5hraZuZiuB4QQT/w+oSesznIP1qxQdsDMrhGImdNL4mE2WSLTqyqg3hS5u4B sGtvczv6Al5oFXPrxcPWAP/5XnzEuaoI48IML5FwVEvXxF9NtUEBHbiO748Bb3CS4ggc QCdAL6hjZPqvqsxmvElK0qfkKcKBh2UM7MAfk4JeJen9VW/NEml+MivANTs/13CwWR/g h9k1Nxw0IwZfohWCFNSznTd1HBewzFDQyYYa4Tky/egkPWhQfaF/mnnYBBlm+ob32Id3 gpioDGkBj5iQ5kgRFGvdXTanHDK12Dwu9z7pKBWXnQ8LjesHbTM5Mjb/49mOKZdzJIzM bqdw== 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=Q32P1WqcgYd8m8YbrvCFu8ke9M5+bZk/HZ8TyMKYDZo=; b=A+RkZbU6kT8PjzSuGibDenhx73+hYUzdShw3CLWgBRRdvdfku06RS7YA+yHMJJBxIZ kTamqCObtCYoSM92WE8X+PiyJYP26XI6Hez9FFo3zUGkF8aNtVx6mhgN8nkSW4qvTSzr 6obr5Ts9cz0prRwx75WZQ0lOA4kQed0xCOckJBzA7ymD/c2UhwUpGeQ5R4KRSlDl1NdX NGfjcZuvgU2qYyOqQvZvyLFM13is0eIY/p0wLUAUeQI196rUku1nibp60U7vjxJY5PWc Zly5uBQ8OkLkl3oPYYZqxAAUdw9t/9QsZgnbb7WN/IsTYZQclGXUF79sXplCCC79Ku1e Gd9Q== X-Gm-Message-State: APjAAAWE25HdYp7Cis6Vxo45yegLyIJVqQnNyBeXUSDNmDpdMm+h4OIh 8atYaFFdMaVu2REKoOEkaUxWT2H1 X-Google-Smtp-Source: APXvYqzgbMaCO3pYL6UuumXZMnJtW3PG6fbWLqkqvuFK6JTsxKEGr8RfM+7ARes+lI8zpgMa2vZE0Q== X-Received: by 2002:a1c:7ed7:: with SMTP id z206mr34906wmc.124.1569442430344; Wed, 25 Sep 2019 13:13:50 -0700 (PDT) Received: from localhost.localdomain (atoulouse-658-1-81-250.w90-5.abo.wanadoo.fr. [90.5.214.250]) by smtp.googlemail.com with ESMTPSA id d193sm138022wmd.0.2019.09.25.13.13.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Sep 2019 13:13:49 -0700 (PDT) From: Alban Gruin To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood , Junio C Hamano , Alban Gruin Subject: [PATCH v1 2/5] sequencer: update `done_nr' when skipping commands in a todo list Date: Wed, 25 Sep 2019 22:13:12 +0200 Message-Id: <20190925201315.19722-3-alban.gruin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190925201315.19722-1-alban.gruin@gmail.com> References: <20190925201315.19722-1-alban.gruin@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In a todo list, `done_nr' is the amount of commands that were executed or skipped, but skip_unnecessary_picks() did not update it. This variable is mostly used by command prompts (ie. git-prompt.sh and the like). Signed-off-by: Alban Gruin --- sequencer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sequencer.c b/sequencer.c index 575b852a5a..42313f8de6 100644 --- a/sequencer.c +++ b/sequencer.c @@ -5054,6 +5054,7 @@ static int skip_unnecessary_picks(struct repository *r, MOVE_ARRAY(todo_list->items, todo_list->items + i, todo_list->nr - i); todo_list->nr -= i; todo_list->current = 0; + todo_list->done_nr += i; if (is_fixup(peek_command(todo_list, 0))) record_in_rewritten(base_oid, peek_command(todo_list, 0)); From patchwork Wed Sep 25 20:13:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Gruin X-Patchwork-Id: 11161329 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F85513B1 for ; Wed, 25 Sep 2019 20:13:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DBCA21D7B for ; Wed, 25 Sep 2019 20:13:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PXtVsIiN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392990AbfIYUNy (ORCPT ); Wed, 25 Sep 2019 16:13:54 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36073 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732902AbfIYUNy (ORCPT ); Wed, 25 Sep 2019 16:13:54 -0400 Received: by mail-wr1-f65.google.com with SMTP id y19so155744wrd.3 for ; Wed, 25 Sep 2019 13:13:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1/HNJ4oa/khQQUfeg3XoK7zRdCWG38Uj0B1kt+9pIes=; b=PXtVsIiNUe2P1RLyPa7iHFRPdc845V8MSPDXCB9R2g88o41CPYn0NNa+GpgCFuElsR bGAEUBdQryy0/79gnNoF+WWa2zJhlJI6ajg2b7UDus6kM0TdvoTRjZnuynYLt1QYgN4q aaJF93EYyPyDFqXVfT/zvqNHfB4WvyqDTPPeAbCuPEgOAS5JDiqJvWGpvpUPOqvh/+5X r5R9v67t9vug3ykLnRNm+al1y3ncZaI3dNAn0jxXooRJl5umEe+xP/OH/4cIKwzvPuz2 wTBlu4iypLs1mpE96T/c3SjXUeC9tVDIld5tHo16hwjxViVINKvMl8n0cu1gALjFpgaf 9cMw== 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=1/HNJ4oa/khQQUfeg3XoK7zRdCWG38Uj0B1kt+9pIes=; b=haxkQwq+71haZ2/ov+YsJdYCYX5EKkUKPg1JKh3cilYsK6QDjBNSGZs6LnFrF66okc asrioDmY3Mmuh2E4Q7NOaRMB03/jtNqB30fJCWFTT3Pri3el5JJGqjbISWGP6Hywh7jA BooBG1iExGwQniUtCeSLGtdSJ5snlll8adAFesdIGtKvy2saUTNF5mgyLbhqCmPs+unU /xXTv4LgahgQOJNeKDJVPeoCgf2kfvQBMuo7RrGjQi2A4fhLE8YSShfxGg4LWkdIynlh lQyL0OpuEaBLX561waOSOZuyDZ8O0ys5w++Zb4i3HX4OMsJNI/OoPdRiZvDiyzf968zx N37Q== X-Gm-Message-State: APjAAAV1JIh60vmrtmPCh1Rrnupt7KuE0NJaCJEL3IjzdNyh83JUb9GF CD9PkVkJmPSgASIgXOUkfGzavsDN X-Google-Smtp-Source: APXvYqxXrvaxe/p8qAMzoYlGRh3xb6Bru1IcmmIh2HY8eZrSPIiiUsHEbJco/eFWgmfBuhxm4GMI/A== X-Received: by 2002:a5d:6b49:: with SMTP id x9mr125711wrw.80.1569442431469; Wed, 25 Sep 2019 13:13:51 -0700 (PDT) Received: from localhost.localdomain (atoulouse-658-1-81-250.w90-5.abo.wanadoo.fr. [90.5.214.250]) by smtp.googlemail.com with ESMTPSA id d193sm138022wmd.0.2019.09.25.13.13.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Sep 2019 13:13:51 -0700 (PDT) From: Alban Gruin To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood , Junio C Hamano , Alban Gruin Subject: [PATCH v1 3/5] sequencer: move the code writing total_nr on the disk to a new function Date: Wed, 25 Sep 2019 22:13:13 +0200 Message-Id: <20190925201315.19722-4-alban.gruin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190925201315.19722-1-alban.gruin@gmail.com> References: <20190925201315.19722-1-alban.gruin@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The total amount of commands can be used to show the progression of the rebasing in a shell. It is written to the disk by read_populate_todo() when the todo list is loaded from sequencer_continue() or pick_commits(), but not by complete_action(). This moves the part writing total_nr to a new function so it can be called from complete_action(). Signed-off-by: Alban Gruin --- sequencer.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sequencer.c b/sequencer.c index 42313f8de6..ec7ea8d9e5 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2342,6 +2342,16 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose) sequencer_remove_state(&opts); } +static void todo_list_write_total_nr(struct todo_list *todo_list) +{ + FILE *f = fopen_or_warn(rebase_path_msgtotal(), "w"); + + if (f) { + fprintf(f, "%d\n", todo_list->total_nr); + fclose(f); + } +} + static int read_populate_todo(struct repository *r, struct todo_list *todo_list, struct replay_opts *opts) @@ -2387,7 +2397,6 @@ static int read_populate_todo(struct repository *r, if (is_rebase_i(opts)) { struct todo_list done = TODO_LIST_INIT; - FILE *f = fopen_or_warn(rebase_path_msgtotal(), "w"); if (strbuf_read_file(&done.buf, rebase_path_done(), 0) > 0 && !todo_list_parse_insn_buffer(r, done.buf.buf, &done)) @@ -2399,10 +2408,7 @@ static int read_populate_todo(struct repository *r, + count_commands(todo_list); todo_list_release(&done); - if (f) { - fprintf(f, "%d\n", todo_list->total_nr); - fclose(f); - } + todo_list_write_total_nr(todo_list); } return 0; From patchwork Wed Sep 25 20:13:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alban Gruin X-Patchwork-Id: 11161331 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DB8C17D4 for ; Wed, 25 Sep 2019 20:13:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F115221D7B for ; Wed, 25 Sep 2019 20:13:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L6UIw4ne" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393005AbfIYUNz (ORCPT ); Wed, 25 Sep 2019 16:13:55 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55788 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731062AbfIYUNy (ORCPT ); Wed, 25 Sep 2019 16:13:54 -0400 Received: by mail-wm1-f67.google.com with SMTP id a6so94782wma.5 for ; Wed, 25 Sep 2019 13:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gijRYT2eyqnmnBy3v47Z+nvLf7G8xiqP+R3ZELLetAw=; b=L6UIw4ne086U4CVDk/FdO/gWf1gbERdN7qDs8e7a0pOvhZDWAVpjPUGg5K4Md7Bc+D MTNL3zwq6GWklCZkoeGO/N0jnUmIxabqEaQAAwRBPGXTrz92ViLFx0e8xMQZAg8b0bva wVJ65423Wq+ymHByX+9QggFRK6gx44Jap3SsuiT/EPr5lr/CY1fe+SmId1/z/ZwpQ7k4 0lhxwy5/zleVFY4fsiQ+DcNgJzhm8BFhkwGuMda/Ln9hueLYiQvNYtfOk2WhF/dGu6es FqtxpXM5YBqjpJdXwM5RUSuvDLaEb7aZzO2q9yKtbSIbXNj6yYOtc2xg2Xam3SZyluj2 3LGg== 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=gijRYT2eyqnmnBy3v47Z+nvLf7G8xiqP+R3ZELLetAw=; b=sin21GxDZjpEbW3TNNkpH+B81ZyX3LXJEZxXjrqQnmZB3rv2H+3ekJexi4WzTmlwhu FRB4Kle9MDSxF3mOLfnwyavaYOzkhJJ1Iaxa7PQWRnxReDmIew0EL6W5cGOWov7riFIq FKRgcGFIFjKX8+9/gST0lmsGMVRc5BjscCWD2YJV0kDs8EJj7Ny2oi4+6DdUr9KGrgCy MgOiyFc8dJJ4vGVvfbT7t3jjEAk51wSW2DFUoM8M3Yt1/3K1ZBWU4/8deoGO0j5D2sut o7/9fGRT3ioeHBGpkfJ7Tr9Sf65uIi8yrffre0d21hnp1YWp7P2T+yGVKYiucok8UmfB 3/lw== X-Gm-Message-State: APjAAAUl6aXFRalQnTEq0FMPf4rzdhyg/Gce8791CdaeaFzyaDVkArSt sTxDyIJ9pxUN4Pb39Oj0lLJQGK2N X-Google-Smtp-Source: APXvYqwsjxkLgtjFtI5n4OxEM1etv/vR1dYZkyi5QoYR/dOU3AaJXbUi54+5qg1jwgNUuJ4nanheHQ== X-Received: by 2002:a05:600c:54a:: with SMTP id k10mr8085wmc.127.1569442432673; Wed, 25 Sep 2019 13:13:52 -0700 (PDT) Received: from localhost.localdomain (atoulouse-658-1-81-250.w90-5.abo.wanadoo.fr. [90.5.214.250]) by smtp.googlemail.com with ESMTPSA id d193sm138022wmd.0.2019.09.25.13.13.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Sep 2019 13:13:51 -0700 (PDT) From: Alban Gruin To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood , Junio C Hamano , Alban Gruin Subject: [PATCH v1 4/5] rebase: fill `squash_onto' in get_replay_opts() Date: Wed, 25 Sep 2019 22:13:14 +0200 Message-Id: <20190925201315.19722-5-alban.gruin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190925201315.19722-1-alban.gruin@gmail.com> References: <20190925201315.19722-1-alban.gruin@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org get_replay_opts() did not fill `squash_onto' if possible, meaning that this field should be read from the disk by the sequencer through read_populate_opts(). Without this, calling `pick_commits()' directly will result in incorrect results with `rebase --root'. Let’s change that. Signed-off-by: Alban Gruin --- builtin/rebase.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index e8319d5946..2097d41edc 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -117,6 +117,11 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts) if (opts->strategy_opts) parse_strategy_opts(&replay, opts->strategy_opts); + if (opts->squash_onto) { + oidcpy(&replay.squash_onto, opts->squash_onto); + replay.have_squash_onto = 1; + } + return replay; } From patchwork Wed Sep 25 20:13:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Gruin X-Patchwork-Id: 11161333 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E30BA1747 for ; Wed, 25 Sep 2019 20:14:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C20D12146E for ; Wed, 25 Sep 2019 20:14:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GavdMUbk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393028AbfIYUN6 (ORCPT ); Wed, 25 Sep 2019 16:13:58 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54020 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392996AbfIYUNz (ORCPT ); Wed, 25 Sep 2019 16:13:55 -0400 Received: by mail-wm1-f68.google.com with SMTP id i16so106340wmd.3 for ; Wed, 25 Sep 2019 13:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YKVLyJi7ifLixEMSOYvTCiEFgG+LMY/l9FzMSQ4sFBs=; b=GavdMUbkl5+tfIia2vPXPuxM0U9v+1AUVybcKqGIuHAN1dEDZcxYQuasbGM+p2FmHP d03j7xzEVG/6z/Mtk8sZ51db0BYjd1cypw3meDw5hqZElLFvUuRl3Yld/dGd5R8Qsnt/ eDHFGd7zJNUz1aXGuqKM2QGlbIKzMpkd2+JaGx2FgrIGwgPdzVyFS3HLgWxs2uvptIwd i37zaZB7NqAAp6TYwhF6DQnmmnmKVFLbx+kdrlqNz+eCEOeOkhOTDTlKxJpVwBi0+cei DlbnaOGNavQHSlkMa3/3LTkHCXjH37EZVjT0xZdSmmJElr7R30ussJWHar1hS1PoQbsX 8z/w== 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=YKVLyJi7ifLixEMSOYvTCiEFgG+LMY/l9FzMSQ4sFBs=; b=h7Cfx8Cep2Uaryg0TNy9DiQzPzPLVdZP0brs9jDb/QzTQh63b4ozkCgSSHPFpQoCif 8nzroH4iGtXFVhqA0PpeNo5sqAfw14/FSa/P+pcLATf3NDkkZTqEa4nd1oRCeCVvufZs v4qoRoraVoycDsoxtH1W3K18RIKVOyTW7FoqdMl5rdb9ePHIPSZaM7tlj3Bp3jq2ocdO DymQAorcP1v0SFJuZrakORZ/3ij5/F0T9PP2OrX6nUeJvmOZf6IV1WbobKKGj7+w7d+d LxUYUvwlQg7JLDHlF4IdLUcfPeMmFfzFZM/dq/f4UIP6/kEFWg10E4ehQqldbbqIBjgq oqyA== X-Gm-Message-State: APjAAAUncu7MIDT6hxreUmKVbLuTBUYgD7wqtCohOHjlGrct6byzFx7T Y0OllMUIN0IGfr6m2sJ8HKTB2Qlv X-Google-Smtp-Source: APXvYqy+hJD+Lb/lMVLFn1097e+q6cJU1e24HY3HkzU6c+86GlyyKiCyixVBwZV6Qttcg/gr3UtGlA== X-Received: by 2002:a1c:6508:: with SMTP id z8mr13326wmb.93.1569442433979; Wed, 25 Sep 2019 13:13:53 -0700 (PDT) Received: from localhost.localdomain (atoulouse-658-1-81-250.w90-5.abo.wanadoo.fr. [90.5.214.250]) by smtp.googlemail.com with ESMTPSA id d193sm138022wmd.0.2019.09.25.13.13.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Sep 2019 13:13:53 -0700 (PDT) From: Alban Gruin To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood , Junio C Hamano , Alban Gruin Subject: [PATCH v1 5/5] sequencer: directly call pick_commits() from complete_action() Date: Wed, 25 Sep 2019 22:13:15 +0200 Message-Id: <20190925201315.19722-6-alban.gruin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190925201315.19722-1-alban.gruin@gmail.com> References: <20190925201315.19722-1-alban.gruin@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Currently, complete_action() calls sequencer_continue() to do the rebase. Even though the former already has the todo list, the latter loads it from the disk and parses it. Calling directly pick_commits() from complete_action() avoids this unnecessary round trip. Signed-off-by: Alban Gruin --- sequencer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sequencer.c b/sequencer.c index ec7ea8d9e5..b395dd6e11 100644 --- a/sequencer.c +++ b/sequencer.c @@ -5140,15 +5140,17 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla return error_errno(_("could not write '%s'"), todo_file); } - todo_list_release(&new_todo); - if (checkout_onto(r, opts, onto_name, &oid, orig_head)) return -1; if (require_clean_work_tree(r, "rebase", "", 1, 1)) return -1; - return sequencer_continue(r, opts); + todo_list_write_total_nr(&new_todo); + res = pick_commits(r, &new_todo, opts); + todo_list_release(&new_todo); + + return res; } struct subject2item_entry {