From patchwork Mon Oct 7 09:26:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Gruin X-Patchwork-Id: 11177047 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 01F681862 for ; Mon, 7 Oct 2019 09:27:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D50812084D for ; Mon, 7 Oct 2019 09:27:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q2rIcFEu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727355AbfJGJ1A (ORCPT ); Mon, 7 Oct 2019 05:27:00 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:52089 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726969AbfJGJ07 (ORCPT ); Mon, 7 Oct 2019 05:26:59 -0400 Received: by mail-wm1-f67.google.com with SMTP id 7so11844534wme.1 for ; Mon, 07 Oct 2019 02:26:58 -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=0xCkbnmCs8Z5d9BHZzxNK2J/yY5q0ioErhjJ3M1BQ5U=; b=q2rIcFEuq5W7prTjhsHNKmXUC4/EHVyDn3n/zLaISN/e+jiUGhkPk2l27eggGZRS7S sa+AQ0wBJVe20iJJXhbhcP06J24ZTa+j1oqAz4CcsT93o4WKBo/oPjMxSAPeUadlRS8V N3p/R+4P13pdjaZM9isRaxhjd0UKoufU5AER4dYAmSal2K0YbCit/7HdCMVZUsRJvHN+ EJdzL9h5uW1gpkRVcMn9jT62jXXj8K8wxh5kGAV224u+v0nfqclAHB4hu+fJobdmHMKN c+NGZ/0gfwu2cidPJYMxvV0PcfOTmxfm8vA50fRmlcqlHbwc30go96tsM1sAsVrAWbqU h5FQ== 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=0xCkbnmCs8Z5d9BHZzxNK2J/yY5q0ioErhjJ3M1BQ5U=; b=sH6UyN44udToUapJ5SR8f7SKqnLi+fgHEg0cDC6NGa1dkGq7ap8ilHCzaRSg+PjxVf VgjNyJE7bIj+E+S0pcD4iYMCZT4ZcipruqfKUP5pMqkrMT7VSVQPNBUuSg86EiE8aPkg GbEiARpbtHeP2QzGrpEHI7j+5pMmjfQ56RRWvCCV9xF0Pt9vdDnNN440hKgKzhI8Imgu 53t+fW38Rq81SPxH6eThIOqn04zhAkqUisLSmp/JLPkl9OFyu2aCWbErtFun14nEPJZI 7Qhk0/CNo1/f+rzGfC32w2R4ePOyccGxiLymRbT8HuECwPQeN3USJ9Pr3KfuiLkVaVYr mDRQ== X-Gm-Message-State: APjAAAVTBpVDch+j2oX2x3Xj8j2XBe57Xa4RFLHMV0nP0oY9d/RPG8r/ 6QhoorlGxL3ZiAVUjXhQ8MeE8rur X-Google-Smtp-Source: APXvYqxNpQKVfY8kFVM9tgimCOvXyf+k9Vm0me6ZgBrj+BbJxDtD49jaNlQg92vP168Q6zvkVPYMmQ== X-Received: by 2002:a1c:dd0a:: with SMTP id u10mr19465730wmg.100.1570440417960; Mon, 07 Oct 2019 02:26:57 -0700 (PDT) Received: from localhost.localdomain (atoulouse-658-1-47-220.w86-221.abo.wanadoo.fr. [86.221.54.220]) by smtp.googlemail.com with ESMTPSA id w125sm25250914wmg.32.2019.10.07.02.26.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Oct 2019 02:26:57 -0700 (PDT) From: Alban Gruin To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood , Junio C Hamano , Alban Gruin Subject: [PATCH v2 1/5] sequencer: update `total_nr' when adding an item to a todo list Date: Mon, 7 Oct 2019 11:26:37 +0200 Message-Id: <20191007092641.12661-2-alban.gruin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007092641.12661-1-alban.gruin@gmail.com> References: <20190925201315.19722-1-alban.gruin@gmail.com> <20191007092641.12661-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 number of items, counting both done and todo, 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). By forgetting to update it, the original code made it not reflect the reality, but this flaw was masked by the code calling unnecessarily read_todo_list() again to update the variable to its correct value. At the end of this series, the unnecessary call will be removed, and the inconsistency addressed by this patch would start to matter. Signed-off-by: Alban Gruin --- Reworded commit. 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 Mon Oct 7 09:26:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Gruin X-Patchwork-Id: 11177051 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 8C14676 for ; Mon, 7 Oct 2019 09:27:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A9342084D for ; Mon, 7 Oct 2019 09:27:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sLxqcTdM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727394AbfJGJ1D (ORCPT ); Mon, 7 Oct 2019 05:27:03 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41245 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726969AbfJGJ1D (ORCPT ); Mon, 7 Oct 2019 05:27:03 -0400 Received: by mail-wr1-f67.google.com with SMTP id q9so14352323wrm.8 for ; Mon, 07 Oct 2019 02:27:00 -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=K1lssAzVcjOIZYcG9Rqnrhi4wYG8jrz4Ugyueneq7B8=; b=sLxqcTdMH4sfrw6eJULleV0HWu92zzXBH0ue0EaIypoNRzFYz7Zoo4kbaeLJ8j39UN isL1y1r5Xit4UXRpK+2MKdSqR9lqL0WGhQYzBSLIypKg1WWiPK8Q+JNKJOk/EyO3pFtq GISv8OPY7fKnRpiSswY7Dte9KyfOs+FV8/dlgzzBOgBU7fmg6tCaUArd7gJY7GUCE2my DOtBtpevGkoWQnGp0C3RsbzVvdrK011lHcQ/vZ9Wh3J8K/VyymQMGWDO3NS2beB9yLgv j9mNSBfdsDBrR7Ha0rPJ9CroRX57De5WIo9aXo+iXSjHihPJg8z/E082ytL+azKp45O0 rG7g== 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=K1lssAzVcjOIZYcG9Rqnrhi4wYG8jrz4Ugyueneq7B8=; b=kGeZIndkNJ+k58tKnD54XVJulrto/P4BdOWkmnNN0MdRlN5lm0VlGywD4dAKLviu1r 9aTiesaRIMWreu7DVDk4uEZXyTOXA0PMNP6EU79FOq0BmVgkYXM0haSM8+gK1OuzvK1h VyL/bBsCvvznOTIxxrKRTcQC2n6buyIVIXP8QgTCs6ktyajWPSGZGFTTMxXZcoYarSL5 pLrsz0R1DN9WD0UmUXFlfFRT2ZYxEEjx96OrS1JQcfVLcC4ZvK8dW3Xdz6FuwmQudUZA Dxoms/caBd0K75jD5RNC/a9oydTGLJ+UXl25GW85micuXN7kVbgIfzZZn2zpRwvwWq8Y lLFA== X-Gm-Message-State: APjAAAUdCi0+uLtYYl1owgSzyMZMyHwqzhm2qWYeXSGdh7ZC4yq8mVm/ eyi0lwJU5/e0j7mkN9gx7nbzKi/o X-Google-Smtp-Source: APXvYqyaAj/ZWCL0tem+QhexCMWdl1b3xgaiSvfgszITOiIKTIhBNKtjD9i6GU/fjxYf+mxzqWDLlw== X-Received: by 2002:a5d:428d:: with SMTP id k13mr21613903wrq.305.1570440419606; Mon, 07 Oct 2019 02:26:59 -0700 (PDT) Received: from localhost.localdomain (atoulouse-658-1-47-220.w86-221.abo.wanadoo.fr. [86.221.54.220]) by smtp.googlemail.com with ESMTPSA id w125sm25250914wmg.32.2019.10.07.02.26.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Oct 2019 02:26:59 -0700 (PDT) From: Alban Gruin To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood , Junio C Hamano , Alban Gruin Subject: [PATCH v2 2/5] sequencer: update `done_nr' when skipping commands in a todo list Date: Mon, 7 Oct 2019 11:26:38 +0200 Message-Id: <20191007092641.12661-3-alban.gruin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007092641.12661-1-alban.gruin@gmail.com> References: <20190925201315.19722-1-alban.gruin@gmail.com> <20191007092641.12661-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). As in the previous commit, this inconsistent behaviour is not a problem yet, but it would start to matter at the end of this series the same reason. Signed-off-by: Alban Gruin --- Reworded commit. 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 Mon Oct 7 09:26:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Gruin X-Patchwork-Id: 11177053 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 630A476 for ; Mon, 7 Oct 2019 09:27:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4202520867 for ; Mon, 7 Oct 2019 09:27:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qwgIh+kn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727403AbfJGJ1E (ORCPT ); Mon, 7 Oct 2019 05:27:04 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35018 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727375AbfJGJ1E (ORCPT ); Mon, 7 Oct 2019 05:27:04 -0400 Received: by mail-wr1-f65.google.com with SMTP id v8so14372631wrt.2 for ; Mon, 07 Oct 2019 02:27:02 -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=qwgIh+kn4rK0ob8xIfclUitP/8jgPVoKw56GbFkGMeNGTLvmSR0m56MjaB9rTxYdwU ZMlX7NuN7647N4UPHDTNfdpCmyk3pBOjrt0281t7+6h7FqzI6joHllkkICTIKoyCzVbm FInmaD81vOrW+zg7fl6dqsxtFnlf59iDDoHVlC6hDWFiQD5XgV7WvgSIcOo+T4RlBkhP sESZXt0xSwq8ff84lY7iJmCJ1YHg14Iba+g4HODTmrIqRV8P4UAgKQHcmJMWQkM1t521 abWBrTA2kMgagCIS0wdsBaelUZJSuCd2pOOFeV5kIP4ipliShoKQmm5tDTdmj4bcwPa0 pdZw== 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=Qd9t7utzoUJ4OGFatCbwL5FqohW3y3WG+cph8PXUJ4ABBfCgQoXxZzMrlvLynOLfHV 4pPRN1rWG81mkpCTCdZkINg7LkhUFgvOo4VTCBDqH1HJ4luC1vyMEZPlbtQDzJeEexcv mGP4hTX+wtN5wqjy6pIiQdaOwRJ2I5jI6r7V1fZsCBlVODFVZJk4apZL1bO6i/XL1h2J cdn5BlVmV0VgRtDYkwxZsUeM1N1LOn7OMPSwPU7CVEcMaX12/iOTKnADwswcMjniHnhc 803orwDYRs6Y0Pnw/jmQpMutgyRqRhMascOKrr6jM8MF1kDhCW0pB1oLL171dyh7WsZm uHrg== X-Gm-Message-State: APjAAAWKRn3YQnr8DgxsXYHwpgxx9+CEkjIZA5+UV3zJ8HJoeNMGJQcd 5MW7CK2uqf18cZj6cb2PasP0cW/v X-Google-Smtp-Source: APXvYqwg6Vdx0Y5dMyEfBfU9RYiTI6U5WnHsVYp50QC+YBqDLPamESMztVF9956OE+gwL5d8Lu8MgA== X-Received: by 2002:a5d:61c8:: with SMTP id q8mr15544434wrv.325.1570440421870; Mon, 07 Oct 2019 02:27:01 -0700 (PDT) Received: from localhost.localdomain (atoulouse-658-1-47-220.w86-221.abo.wanadoo.fr. [86.221.54.220]) by smtp.googlemail.com with ESMTPSA id w125sm25250914wmg.32.2019.10.07.02.27.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Oct 2019 02:27:01 -0700 (PDT) From: Alban Gruin To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood , Junio C Hamano , Alban Gruin Subject: [PATCH v2 3/5] sequencer: move the code writing total_nr on the disk to a new function Date: Mon, 7 Oct 2019 11:26:39 +0200 Message-Id: <20191007092641.12661-4-alban.gruin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007092641.12661-1-alban.gruin@gmail.com> References: <20190925201315.19722-1-alban.gruin@gmail.com> <20191007092641.12661-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 Mon Oct 7 09:26:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alban Gruin X-Patchwork-Id: 11177055 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 D303476 for ; Mon, 7 Oct 2019 09:27:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B202B20867 for ; Mon, 7 Oct 2019 09:27:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X/DwjMgQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727416AbfJGJ1G (ORCPT ); Mon, 7 Oct 2019 05:27:06 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34141 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727375AbfJGJ1F (ORCPT ); Mon, 7 Oct 2019 05:27:05 -0400 Received: by mail-wr1-f65.google.com with SMTP id j11so8571349wrp.1 for ; Mon, 07 Oct 2019 02:27:04 -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=hUUMnyIz1afOKGnFdMztYX7pRXFgr1vwP/km10ffbOY=; b=X/DwjMgQ7bg1IMndfGvoikCZ+wTNXylGbNgelmcwLpldrTvED4KvCF+lSHUpu2Et9Y TbHCl+aL7qauIKEUKl++iZamsGQgCKFo+JucRUmnGqzPlB0GL/46xg5maX7OPM0GCDl3 meaQscApdkpBorQlX1kJ5Stm5PAf5uVA9a3OFMqMK/w3Zx5coe9Jq96SI/iOX45KQh4j G1/5eoMdx9wEuCPLkHMmtHkV0bqbF8Buo5SG2Chfn8lXrfAz6fmjLu5gnoadf3FOXz/+ uTRkht099ejFsWwVmK6GbC5uFEEHyEShVWU1AQAzulCx2F2/nkxDIeofQTkH1acJmElp fuyA== 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=hUUMnyIz1afOKGnFdMztYX7pRXFgr1vwP/km10ffbOY=; b=PAR9qRDPbFaBC3/dse49T5si5hS8mycxfm5o3dq0+qm5m/qbSMs5cAlW1Q6ambCeCp OWqdisP7EMiZ8Do1vS1aQgiog2p0MwWgGlyWLnjf7H8F9Sqi8Gv+9iAEpcJRmnzfBWIf z9/ISU/DthYksFNvGrFlBwJwE/ioaA5ghS5iMh0FV33Nu0WXEFQVZk1UiUl5HdtrvYNQ Mwl6qZv6ufMzUNEXYdx+nyH9X3O3UwmZNZ9qQithJChHV5o7NxSge96YjMXg/NfDtJf9 LzH45bxUjayPqPjI5ltTlRyR2S+DUZBW6aJsPTs49rQU9N/h7i44wBh+8COchZvbF1vM pmug== X-Gm-Message-State: APjAAAWA+3r02IL44N563PKUlg0C6Xz4DodO+ciQvaAmz/aimK9nm40R IygKFQ1zFGzyYf6xaW0E1hJ2ENO7 X-Google-Smtp-Source: APXvYqxHsD7PyTFJd4VBxECCnHDRrCEJqERokdEOiD6SlhuquSOwYAXSG4uPsvOMAEBySbtvxkTYXQ== X-Received: by 2002:a5d:670f:: with SMTP id o15mr20785517wru.242.1570440423921; Mon, 07 Oct 2019 02:27:03 -0700 (PDT) Received: from localhost.localdomain (atoulouse-658-1-47-220.w86-221.abo.wanadoo.fr. [86.221.54.220]) by smtp.googlemail.com with ESMTPSA id w125sm25250914wmg.32.2019.10.07.02.27.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Oct 2019 02:27:03 -0700 (PDT) From: Alban Gruin To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood , Junio C Hamano , Alban Gruin Subject: [PATCH v2 4/5] rebase: fill `squash_onto' in get_replay_opts() Date: Mon, 7 Oct 2019 11:26:40 +0200 Message-Id: <20191007092641.12661-5-alban.gruin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007092641.12661-1-alban.gruin@gmail.com> References: <20190925201315.19722-1-alban.gruin@gmail.com> <20191007092641.12661-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, the get_replay_opts() function does not initialise the `squash_onto' field (which is used for the `--root' mode), only read_populate_opts() does. That would lead to incorrect results when calling pick_commits() without reading the options from the disk first. Let’s change that. Signed-off-by: Alban Gruin --- Reworded commit. 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 Mon Oct 7 09:26:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Gruin X-Patchwork-Id: 11177057 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 111D8112B for ; Mon, 7 Oct 2019 09:27:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E4D8A20867 for ; Mon, 7 Oct 2019 09:27:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mAcfCpPI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727448AbfJGJ1I (ORCPT ); Mon, 7 Oct 2019 05:27:08 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:34061 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727412AbfJGJ1H (ORCPT ); Mon, 7 Oct 2019 05:27:07 -0400 Received: by mail-wm1-f67.google.com with SMTP id y135so14370098wmc.1 for ; Mon, 07 Oct 2019 02:27:06 -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=EapRB+cqHBsLUnlxapZpRQYyYFhUhGVFRRksoa5qV9w=; b=mAcfCpPI/wv6R8BLbYTcuqyGWFVyWJWOIgsv+zZot6XZ3irVGnHuj0KRtSpQ6IqiLC Zn/TYC3qXRwpBX8Z4qOLdbwi7psV1ikJeUC48TNe5MoaYaHABnwV575Ek0BSQHzz5ght FAsLri6fXTS5fHbJMzfNdMEtsUEJSg2u5s/kGvA316MMqc18hk7I3Dvoh3EY8UjMF81O 9cEn9QQLpBBhmzSQzqInSX1/xg9YC+l483zhTAg3BlMHuT8J1H8cU83suGdiJaYw6SRI lfgmrGjNVBJx+MiCrO8SQAeFnZGDS7UBzRkp1BsSWYEY4QX9vkY2SH9X+hKte81G3C1q 222Q== 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=EapRB+cqHBsLUnlxapZpRQYyYFhUhGVFRRksoa5qV9w=; b=fqR82l8NeFoONRXGOI4eQgEOrPBzFpXKY7Qw2B0FyY48QNeJ+NMOsYkFox1nGMWn0B pUnkWTlXQ3k4KZAVPwUIs+06Qw9qSjTUgJmaBWwUNKuwWXVFRqWHM2WkDS1AX/EKe7RJ ws8sFeBVnGgO0aSvO28n3mcZASa0O01FLddhW55V8dpQasnBOxPd+4x0y1ns1LSdz5rw duiZjjOknuTeFV4nZ9de2rWuQ4H1Ual125qtCFt02TacIYLeONNTkuJPvozrDieaw5Bg NiOH2K1g6mV5W7PPEsGfN8I2Z1WoI0V6OaiWjTcCvhGeVmwEhQBbQpW+tZsBxso/8+wp 8XRg== X-Gm-Message-State: APjAAAXzImNXO826IvY0Vs7ExeOCnuwvNnLteUyxwBXlqnm+8G8MQ96A SJTZu2xaHqYcyQrbm18W925QC6WL X-Google-Smtp-Source: APXvYqw2g+3X2O3/1jRjFlTbk7WPjoLVAao4xK35WOgD831vYj8tU2HkOmBazRISgOg0VMA8bzQV4w== X-Received: by 2002:a7b:cbd0:: with SMTP id n16mr18724458wmi.82.1570440425646; Mon, 07 Oct 2019 02:27:05 -0700 (PDT) Received: from localhost.localdomain (atoulouse-658-1-47-220.w86-221.abo.wanadoo.fr. [86.221.54.220]) by smtp.googlemail.com with ESMTPSA id w125sm25250914wmg.32.2019.10.07.02.27.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Oct 2019 02:27:05 -0700 (PDT) From: Alban Gruin To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood , Junio C Hamano , Alban Gruin Subject: [PATCH v2 5/5] sequencer: directly call pick_commits() from complete_action() Date: Mon, 7 Oct 2019 11:26:41 +0200 Message-Id: <20191007092641.12661-6-alban.gruin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007092641.12661-1-alban.gruin@gmail.com> References: <20190925201315.19722-1-alban.gruin@gmail.com> <20191007092641.12661-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. Before the former calls pick_commits(), it - calls read_and_refresh_cache() -- this is unnecessary here as we've just called require_clean_work_tree() - calls read_populate_opts() -- this is unnecessary as we're starting a new rebase, so opts is fully populated - loads the todo list -- this is unnecessary as we've just populated the todo list - commits any staged changes -- this is unnecessary as we're starting a new rebase, so there are no staged changes - calls record_in_rewritten() -- this is unnecessary as we're starting a new rebase. This changes complete_action() to directly call pick_commits() to avoid these unnecessary steps. Signed-off-by: Alban Gruin --- Reworded commit. 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 {