Git development
 help / color / mirror / Atom feed
From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>,
	git@vger.kernel.org
Subject: Re: [BUG] Amending a shallow clone -> orphan branch
Date: Fri, 6 Aug 2021 19:21:24 +0700	[thread overview]
Message-ID: <b3083a15-f2da-0eae-b07b-8a641c613906@gmail.com> (raw)
In-Reply-To: <64760969-1ead-2bfb-6f98-1161d385c0ca@syntevo.com>

Hi Alexandr, welcome to Git mailing list!

On 06/08/21 07.04, Alexandr Miloslavskiy wrote:
> Consider the following steps :
> 
> git clone --depth 1 --single-branch --branch master 
> https://github.com/git/git
> cd git
>  >1.txt
> git add 1.txt
> git commit --amend
> 
> This results in an orphaned branch, where a single commit contains 
> entire tree.
> 
> I understand that this is a bug, because certainly git knew shallow 
> commit's parents and could reuse that when amending?

I tested that, and below is `git status` after the test (using Git 2.32.0):

> On branch master
> Your branch and 'origin/master' have diverged,
> and have 1 and 1 different commits each, respectively.
>   (use "git pull" to merge the remote branch into yours)
> 
> nothing to commit, working tree clean

So you're amending merge commit by adding dummy file, so that your 
`master` branch becomes divergent against origin. That dummy file isn't 
contained in any commits that are included with that merge commit.

-- 
An old man doll... just what I always wanted! - Clara

  reply	other threads:[~2021-08-06 12:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06  0:04 [BUG] Amending a shallow clone -> orphan branch Alexandr Miloslavskiy
2021-08-06 12:21 ` Bagas Sanjaya [this message]
2021-08-06 12:24   ` Alexandr Miloslavskiy
2021-08-06 12:27   ` Alexandr Miloslavskiy
2021-08-06 13:16   ` Alexandr Miloslavskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b3083a15-f2da-0eae-b07b-8a641c613906@gmail.com \
    --to=bagasdotme@gmail.com \
    --cc=alexandr.miloslavskiy@syntevo.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox