From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id B68C81F66E for ; Fri, 14 Aug 2020 16:28:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728127AbgHNQ2u (ORCPT ); Fri, 14 Aug 2020 12:28:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726320AbgHNQ2t (ORCPT ); Fri, 14 Aug 2020 12:28:49 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFB4FC061384 for ; Fri, 14 Aug 2020 09:28:49 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id u126so11233043iod.12 for ; Fri, 14 Aug 2020 09:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+TFLXJJ6G5bDOyiWpMbaix4M/P0J0nNAaUlb0tvWh7M=; b=e1aRJr/sYtMSXqXrhIo1dEmDnNFCgjuXL9h1F8ZCeua3cVQ0vBWB9JnmScWyvLUgcM cL0tdVqWG5uqwg+/UCoyPf86y4ndORyU26/MoPVEaK8kbT8LTcHp//6nyrWfzP+fNnaZ iJcJMw9LhePgbqVi4GxvMkwyjfcyctTSCkUyjHq222RWz++t9Rv7B8whoOo9SJSuZcls zEIVxoJymJNu1cOnbcvbjKuqB3Qk+9jbTs2sXGc4FHb9Ft2LDYBBz5QAsBcsqijDcVKl a+k0I2C5Gjp9wxhTvJk6l1Yh5BqRHCh57NFoj7/YNowydY18aYaVIt+oA5JCMaHnVwSS SgBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+TFLXJJ6G5bDOyiWpMbaix4M/P0J0nNAaUlb0tvWh7M=; b=nSF2s9ZiuMeLkvTWFjvW7SsTCl9UwWQYckKxmVbFFYBar7d+jtJYxOF58tUEO2/zf4 6hKfhCi+pnyqRkDUlRtrLkYerTDQZEfKm2+zZAEXMLeXlxS4XUp1tDmdCAX/n1VpUSm2 2bukGHewwDiY3nZ/z0xF9JiID1N7oA8zGwzCZlY6mbdIj+HWuJz0xT8txmcl5Qoi+BTw 12pH7GrYinezdAJ+K9s1aLrjC2Uh+WGwHvXq8aT1ch+Qcz3YT9PnQSnjT+o1+a53OFe8 3O5qbUgmDRzbrt3CQcCPR6DkY0QNsGVsQVjPQPUuLP/lMMe3smRIOVvpveWNnztY/aFl DO7A== X-Gm-Message-State: AOAM532mdtMGHG3KQEjhSZR8tAsIruXPIqOnUlXynzX89Qd1f7dsD9/I TDbnjafH3q/cILzKMqQyQbXHcp7FxFj/vumKmQzx+Kyovm1rwqkb X-Google-Smtp-Source: ABdhPJwx7IB81i+7Kh5PBiCzLIrG6CoQlkRYBEdIGvAMF4ypNdHG95WhJpB7uBe0X0Fp/70kP9uJFyoBJxtEN/KNXhI= X-Received: by 2002:a05:6602:2515:: with SMTP id i21mr2714457ioe.120.1597422528818; Fri, 14 Aug 2020 09:28:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Danny Lin Date: Sat, 15 Aug 2020 00:28:31 +0800 Message-ID: Subject: Re: [BUG] Branches before "git subtree add --squash" are pushed via "git subtree push" To: git develop Cc: Junio C Hamano , "David A. Greene" , Dave Ware , apenwarr@gmail.com, Roger Strain , Jonathan Nieder , Stephen R Guglielmo Content-Type: text/plain; charset="UTF-8" Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Sadly no one cares about this issue... This bug is especially obvious if we simply run `git subtree push` after a `git subtree add --squash`: If master is at commit D, which is generated by `git subtree add --squash -P sub Y`: A---B---C---D master / Y' X---Y sub After running `git subtree push -P sub . sub`, we get: A---B---C---D' sub (after push, actual) / X---Y While the sub branch should not change at all! This bug, seemingly introduced by 933cfeb90b5d03b4096db6d60494a6eedea25d03 critically makes --squash approach for `git subtree` almost unusable. Added related developers to CC list for better notice. > > Say we have a repository with "master" and "sub" branches like below: > > A---B---C---D---E---F master > / > X---Y > > X---Y sub > > where commits A and B include changes in subdirectory "sub", commit C > removes subdirectory "sub", commit D is generated by "git subtree add > -P sub Y", and commits E and F also include changes in subdirectory > "sub". > > We'd get this if we run "git subtree push -P sub . sub" on master at F: > > X---Y---E'--F' sub (after push) > > On the other hand, if we have simliar trees except that commit D is > generated by "git subtree add --squash -P sub Y": > > A---B---C---D---E---F master > / > Y' > > X---Y sub > > We'd expect to get this when we run "git subtree push -P sub . sub" on > master at F: > > X---Y---E'--F' sub (after push, expected) > > But actually we get this (in Git 2.22.0): > > A---B---C---D'--E'--F' sub (after push, actual) > / > X---Y > > This seems to be a side effect of 2.7.0 -> 2.7.1 in which a change is > made to include merged branches in "git subtree push", but mistakenly > causes branches before "git subtree add --squash" be included.