From patchwork Fri Mar 10 21:45:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13170191 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 447D8C6FA99 for ; Fri, 10 Mar 2023 21:49:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232149AbjCJVtJ (ORCPT ); Fri, 10 Mar 2023 16:49:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232084AbjCJVsp (ORCPT ); Fri, 10 Mar 2023 16:48:45 -0500 Received: from mail-oa1-x31.google.com (mail-oa1-x31.google.com [IPv6:2001:4860:4864:20::31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C33D14DA15 for ; Fri, 10 Mar 2023 13:45:51 -0800 (PST) Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-17786581fe1so71280fac.10 for ; Fri, 10 Mar 2023 13:45:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678484720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gtI7nTfb8j3NoDb66xBksm0596lFjzWjajZdFZ7jANA=; b=TWVPlmvvlb8IqY7TZcq3cbBvT1aLJVTFOtK/TFgMIMubrdQ8u3BMl2OYp/Ij6v3ydt PpbplqJ5Vfz+h3vF1X8QaCtqCEZWrTvm8EXGjoas+dlHzNVwRKee+8tI0v4Kx8u1J6Nt imGPgUtE9MgCYM3Jxbk47tFZhrC+goF2wVROduAOzpKpWVV2lgjKujERBuBIlW4c935E EYnerArRzzVxK6aheMcquBR7hNdJop1ErzkEfnHSLpuOUfgeDb5yKbhzRVQSCxwiPhAX T4ODa4vZAGi7kMotRPqq7J+O0dcjcJZwmRguMyMdrNNC4H1HVJts3xS+pG0gxYi01KYe Ql2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678484720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gtI7nTfb8j3NoDb66xBksm0596lFjzWjajZdFZ7jANA=; b=YkDjidw1snpQx2SYzNAXwaJ6nA+nwKgetRShk7S/3RXXnQrvbm/8SwvciD4cmDIpKj GyEEWAclSlXJLuw2mu+QGGvSHpsD0E7s9D7sh4su0eq8LNwPw4UrkHh/MvXZyCu56oJp bvJaSv8dWqlsL1cJlibWMDnlHu73Ri11iPCSxzBjk431usXkmgTfpwIPj8D15rZMLljj JEJHxaqw1mhooOeWDfWRxr9Da9f4jTlLqeK0r3CGrragSl4b47s4jbByOGdlraK5T2zy zeuVq0hil2N3Twk44EHLrcp7n5brl16CEL4LmAtW9eUyDQCjVvLqNmkxXYSzXjZLwXG8 3jBA== X-Gm-Message-State: AO0yUKUJ1pufQiLGWV9svI0UGuGzT7ouStHzhBcUk0WqykK5sO2xg091 5APU1HrZho5+69/9QG24QEBHX882Ll8= X-Google-Smtp-Source: AK7set+7vwrj6Dnytu0fF1EGADP7vF1bemoP9tar3tQoBf9NuYBxv3gdXNNpzHQpptuUuKIZ1Hlsxg== X-Received: by 2002:a05:6870:eca8:b0:172:4d65:c883 with SMTP id eo40-20020a056870eca800b001724d65c883mr1785607oab.28.1678484720564; Fri, 10 Mar 2023 13:45:20 -0800 (PST) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id e81-20020a4a5554000000b0051aa196ac82sm412405oob.14.2023.03.10.13.45.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 13:45:19 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?Antoine_Beaupr=C3=A9?= , Phillip Wood , Felipe Contreras Subject: [RFC PATCH 1/3] branch: add new 'tail' concept Date: Fri, 10 Mar 2023 15:45:13 -0600 Message-Id: <20230310214515.39154-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0.rc2.1.gf652911b76.dirty In-Reply-To: <20230310214515.39154-1-felipe.contreras@gmail.com> References: <20230310214515.39154-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The 'tail' of a branch points to the first parent commit of the branch when it was created. Signed-off-by: Felipe Contreras --- branch.c | 12 ++++++++++++ branch.h | 1 + builtin/clone.c | 1 + t/t1514-rev-parse-tail.sh | 23 +++++++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100755 t/t1514-rev-parse-tail.sh diff --git a/branch.c b/branch.c index e5614b53b3..e43a164ddb 100644 --- a/branch.c +++ b/branch.c @@ -234,6 +234,16 @@ static int inherit_tracking(struct tracking *tracking, const char *orig_ref) return 0; } +void install_branch_base(const char *local, const struct object_id *tail) +{ + struct strbuf ref = STRBUF_INIT; + + strbuf_addf(&ref, "refs/tails/%s", local); + update_ref(NULL, ref.buf, tail, NULL, 0, UPDATE_REFS_DIE_ON_ERR); + + strbuf_release(&ref); +} + /* * Used internally to set the branch..{remote,merge} config * settings so that branch 'new_ref' tracks 'orig_ref'. Unlike @@ -623,6 +633,8 @@ void create_branch(struct repository *r, if (real_ref && track) setup_tracking(ref.buf + 11, real_ref, track, quiet); + install_branch_base(ref.buf + 11, &oid); + cleanup: strbuf_release(&ref); free(real_ref); diff --git a/branch.h b/branch.h index ef56103c05..f020d5be5d 100644 --- a/branch.h +++ b/branch.h @@ -142,6 +142,7 @@ void remove_branch_state(struct repository *r, int verbose); */ #define BRANCH_CONFIG_VERBOSE 01 int install_branch_config(int flag, const char *local, const char *origin, const char *remote); +void install_branch_base(const char *local, const struct object_id *tail); /* * Read branch description diff --git a/builtin/clone.c b/builtin/clone.c index 65b5b7db6d..62afcff2ba 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -624,6 +624,7 @@ static void update_head(const struct ref *our, const struct ref *remote, update_ref(msg, "HEAD", &our->old_oid, NULL, 0, UPDATE_REFS_DIE_ON_ERR); install_branch_config(0, head, remote_name, our->name); + install_branch_base(head, &our->old_oid); } } else if (our) { struct commit *c = lookup_commit_reference(the_repository, diff --git a/t/t1514-rev-parse-tail.sh b/t/t1514-rev-parse-tail.sh new file mode 100755 index 0000000000..da8e9ceef1 --- /dev/null +++ b/t/t1514-rev-parse-tail.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +test_description='test @{upstream} syntax' + +. ./test-lib.sh + +test_expect_success 'setup' ' + echo one > content && + git add content && + git commit -m one && + git checkout -b test master && + echo two > new && + git add new && + git commit -a -m two +' + +test_expect_success 'test tail creation' ' + git rev-parse refs/tails/test > actual && + git rev-parse master > expect && + test_cmp expect actual +' + +test_done From patchwork Fri Mar 10 21:45:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13170192 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65383C6FD19 for ; Fri, 10 Mar 2023 21:49:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232184AbjCJVtS (ORCPT ); Fri, 10 Mar 2023 16:49:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231728AbjCJVst (ORCPT ); Fri, 10 Mar 2023 16:48:49 -0500 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06AD114DA25 for ; Fri, 10 Mar 2023 13:45:56 -0800 (PST) Received: by mail-ot1-x329.google.com with SMTP id r23-20020a05683001d700b00690eb18529fso3722353ota.1 for ; Fri, 10 Mar 2023 13:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678484722; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NdEhSoGY7kpSBMMIUhZair9Bn6dKieS5VrAmkjaRaFA=; b=KPs0UlCnv+KmqxVpC995DyPVd9kC9HF+KdhmojLqZeWuhbQCLn62HpwOxzA3HYvnCh B/5LDMDtWmMI03+omNUVAQK8SB7cZOoWKV8/Lplp8+K6Jn3ZkncCqfLFm9VACzRwzOtj adiAYr5SS5tGAeOcBnq4fO41LC3jnYTRRBr2/BFaa8P/SP2Btxc7i4RbDSRbjRBdfOY5 loWIwEZCJzqrj1kqanpfNpVOfm+m1s3FBYfNNBvO+LvMhaGZDJZNgUIg98oWQ4NUwiXJ d66FJPNehgmqbUz2P2Hodd0AJvPr5XPgssCPlootaZ2lFeaWu8jAWltUk2ya/g0vPhjK f39w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678484722; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NdEhSoGY7kpSBMMIUhZair9Bn6dKieS5VrAmkjaRaFA=; b=cQPT18J4XPAioNPP2vxdxoeOkd2Iv7ynecj0rT9brk9KYQsSrsS75C7RfZGE1VPRq5 aztv7N0oWesH8tyfx0t3DzlTH6vW7roPKcsqnmKR8+dyW2J59FltJrPMN3FYCe+Dxypt NYNW9Vu4kM4GOkVwVOP8IAImJVWpeZxIcTy2dgSsBrre4toiutICiIpsRxyM3Z7dgh4R RBWq4QrabGWe8xwV9lF+74Oac5/bUWaVS4UIGUbAbBjVfKaAHJfY6nygeZb3Ep04+qEq /nkSlJmz+4YhGIyrgMF5/Dw1RgzVuDqEPvRM2S/wa+n2h8FbgfNYIFJ9HvhgQOc5cK9P dgmQ== X-Gm-Message-State: AO0yUKWOOlLCdYZAW9Ee8KpoSUQMqphwvSA76Umyq0Mui8u3T1V5+Ymn CAPya3r+Z1kvFOwsR21Q34OspEVHoxI= X-Google-Smtp-Source: AK7set8Mt/1C+MeH5gs0N8okb38vXcwR/1GZf9WKNBFh6zerRjgUzMPiawzvSIsRx/SuiB7pMSCyVQ== X-Received: by 2002:a9d:7206:0:b0:68b:dc52:10f9 with SMTP id u6-20020a9d7206000000b0068bdc5210f9mr13687369otj.5.1678484722200; Fri, 10 Mar 2023 13:45:22 -0800 (PST) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id i18-20020a9d6112000000b0068bcef4f543sm533353otj.21.2023.03.10.13.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 13:45:21 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?Antoine_Beaupr=C3=A9?= , Phillip Wood , Felipe Contreras Subject: [RFC PATCH 2/3] sha1-name: add @{tail} helpers Date: Fri, 10 Mar 2023 15:45:14 -0600 Message-Id: <20230310214515.39154-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0.rc2.1.gf652911b76.dirty In-Reply-To: <20230310214515.39154-1-felipe.contreras@gmail.com> References: <20230310214515.39154-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Felipe Contreras --- object-name.c | 30 +++++++++++++++++++++++++++++- t/t1514-rev-parse-tail.sh | 6 ++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/object-name.c b/object-name.c index 2dd1a0f56e..a0f845c927 100644 --- a/object-name.c +++ b/object-name.c @@ -877,6 +877,20 @@ static inline int push_mark(const char *string, int len) return at_mark(string, len, suffix, ARRAY_SIZE(suffix)); } +static inline int tail_mark(const char *string, int len) +{ + const char *suffix[] = { "@{tail}", "@{t}" }; + int i; + + for (i = 0; i < ARRAY_SIZE(suffix); i++) { + int suffix_len = strlen(suffix[i]); + if (suffix_len <= len + && !memcmp(string, suffix[i], suffix_len)) + return suffix_len; + } + return 0; +} + static enum get_oid_result get_oid_1(struct repository *r, const char *name, int len, struct object_id *oid, unsigned lookup_flags); static int interpret_nth_prior_checkout(struct repository *r, const char *name, int namelen, struct strbuf *buf); @@ -925,7 +939,8 @@ static int get_oid_basic(struct repository *r, const char *str, int len, continue; } if (!upstream_mark(str + at, len - at) && - !push_mark(str + at, len - at)) { + !push_mark(str + at, len - at) && + !tail_mark(str + at, len - at)) { reflog_len = (len-1) - (at+2); len = at; } @@ -1608,6 +1623,13 @@ static int interpret_branch_mark(struct repository *r, return len + at; } +const char *branch_get_tail(struct branch *branch, struct strbuf *err) +{ + static struct strbuf tmp = STRBUF_INIT; /* TODO: find a proper place */ + strbuf_addf(&tmp, "refs/tails/%s", branch->name); + return tmp.buf; +} + int repo_interpret_branch_name(struct repository *r, const char *name, int namelen, struct strbuf *buf, @@ -1655,6 +1677,12 @@ int repo_interpret_branch_name(struct repository *r, options); if (len > 0) return len; + + len = interpret_branch_mark(r, name, namelen, at - name, buf, + tail_mark, branch_get_tail, + options); + if (len > 0) + return len; } return -1; diff --git a/t/t1514-rev-parse-tail.sh b/t/t1514-rev-parse-tail.sh index da8e9ceef1..6024b4276c 100755 --- a/t/t1514-rev-parse-tail.sh +++ b/t/t1514-rev-parse-tail.sh @@ -20,4 +20,10 @@ test_expect_success 'test tail creation' ' test_cmp expect actual ' +test_expect_success 'test @{tail}' ' + git rev-parse test@{tail} > actual && + git rev-parse master > expect && + test_cmp expect actual +' + test_done From patchwork Fri Mar 10 21:45:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13170193 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41543C6FA99 for ; Fri, 10 Mar 2023 21:49:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232198AbjCJVtV (ORCPT ); Fri, 10 Mar 2023 16:49:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231864AbjCJVsx (ORCPT ); Fri, 10 Mar 2023 16:48:53 -0500 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1C2A14DA2D for ; Fri, 10 Mar 2023 13:45:59 -0800 (PST) Received: by mail-ot1-x32c.google.com with SMTP id a4-20020a056830008400b0069432af1380so3686996oto.13 for ; Fri, 10 Mar 2023 13:45:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678484723; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wtF0uqF8Lxp6HgvZFD9B2CTHDTfQGAcVmyEnYlQFxgg=; b=L83pumvHM7JNNyOboVnk5lj7F1pro4bAbLDNWKmtpls7esOkN3HNA4xsBbQYLduSll oJomQScA0yC4CQ8Vrvo1LeFjeJvg3wo6Uzhe+3IdnZ8EDEyki3tj8M+i7DXOCiB8bQqQ I2vzCFNfuxs9IqK/HBn/ETSoUe4j3J1hQAXT/3h4wKbjr6mjT4sxpkMYMGcsjqdt3ou/ XrUpS+tXSNtEUDgfaBiY6V22tq+yWxeqENpMr4QEKeHCJU/tAW43ZuSDZpyedICRfZB7 blYVjhRxERBhRpQnQkrEyaD+Ep/SMCqzsfpaFMjRjMlNtKBfSbHlzjj1EeysNsC3d56e VSfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678484723; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wtF0uqF8Lxp6HgvZFD9B2CTHDTfQGAcVmyEnYlQFxgg=; b=Teg2gKmwHy25HLwH+SMuyAVZsO9ModbPbXS2slZEGc2KdCswuscSpc2fNXEktv/zcj gnNpMTJJ6acmzQCdwjtMvNHTkXGCgIUtspnmsT4dfocr/0oIQqfLT3g2vNHmPZ542YDw +Bfxn/tiH1Ol2KIN62rh6BFpJWR9/dJmYKgJFe8U3FXPolzOzYlAicmZoqbvTHf5Otd2 TpTt49e03gKTJlX4/UeglKdZjDidKEVt8s0Ofvp5KAT5wnZFznz46+D+rYetPbmucrRr VGBQkm8gjTXYH8/rCRknLalaCZfpdG+yj4cbVu811n1+uT5XiGByWJYO+hHyJ77mdrBO KCOA== X-Gm-Message-State: AO0yUKXAJPuLFToFZzLQ3OfLGLH54ivSLckgUcBEv0f8wDqdyGSJzPW/ lxMp5lMlRQLtFFVMj5Kc4LozzvaWik8= X-Google-Smtp-Source: AK7set+qsbVLy+o+jrgztR3EOLHpdzTUIVSs4ca7wsaS3spW6NA0BZ0bL8lbvSR+ICcPjF7EHmJ8tA== X-Received: by 2002:a9d:2e7:0:b0:690:f7da:5390 with SMTP id 94-20020a9d02e7000000b00690f7da5390mr13931423otl.25.1678484723710; Fri, 10 Mar 2023 13:45:23 -0800 (PST) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id c26-20020a9d615a000000b0068bbc9e7cc9sm509255otk.53.2023.03.10.13.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 13:45:23 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?Antoine_Beaupr=C3=A9?= , Phillip Wood , Felipe Contreras Subject: [RFC PATCH 3/3] rebase: update branch tail after rebasing Date: Fri, 10 Mar 2023 15:45:15 -0600 Message-Id: <20230310214515.39154-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0.rc2.1.gf652911b76.dirty In-Reply-To: <20230310214515.39154-1-felipe.contreras@gmail.com> References: <20230310214515.39154-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Felipe Contreras --- builtin/rebase.c | 15 +++++++++++++++ t/t1514-rev-parse-tail.sh | 10 ++++++++++ 2 files changed, 25 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index 6635f10d52..19cfb0d0e4 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -252,6 +252,16 @@ static int init_basic_state(struct replay_opts *opts, const char *head_name, return write_basic_state(opts, head_name, onto, orig_head); } +static void update_tail(struct rebase_options *opts) +{ + const char *shortname = NULL; + struct strbuf ref = STRBUF_INIT; + skip_prefix(opts->head_name, "refs/heads/", &shortname); + strbuf_addf(&ref, "refs/tails/%s", shortname); + update_ref(NULL, ref.buf, &opts->onto->object.oid, NULL, 0, UPDATE_REFS_DIE_ON_ERR); + strbuf_release(&ref); +} + static int do_interactive_rebase(struct rebase_options *opts, unsigned flags) { int ret = -1; @@ -294,6 +304,9 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags) shortrevisions, opts->onto_name, opts->onto, &opts->orig_head->object.oid, &opts->exec, opts->autosquash, opts->update_refs, &todo_list); + + if (!ret) + update_tail(opts); } cleanup: @@ -564,6 +577,8 @@ static int finish_rebase(struct rebase_options *opts) strbuf_release(&dir); } + update_tail(opts); + return ret; } diff --git a/t/t1514-rev-parse-tail.sh b/t/t1514-rev-parse-tail.sh index 6024b4276c..7b3482de55 100755 --- a/t/t1514-rev-parse-tail.sh +++ b/t/t1514-rev-parse-tail.sh @@ -26,4 +26,14 @@ test_expect_success 'test @{tail}' ' test_cmp expect actual ' +test_expect_success 'test rebase tail update' ' + git checkout -b next master && + echo three > content && + git commit -a -m three && + git rebase --onto next test@{tail} test && + git rev-parse test@{tail} > actual && + git rev-parse next > expect && + test_cmp expect actual +' + test_done