From: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
To: Bagas Sanjaya <bagasdotme@gmail.com>, git@vger.kernel.org
Subject: Re: [BUG] Amending a shallow clone -> orphan branch
Date: Fri, 6 Aug 2021 16:16:57 +0300 [thread overview]
Message-ID: <20d768d5-2fe2-5540-b7e7-2174db7c80cf@syntevo.com> (raw)
In-Reply-To: <b3083a15-f2da-0eae-b07b-8a641c613906@gmail.com>
A bit more details:
$ git clone --depth 1 --single-branch --branch master
https://github.com/git/git
$ cd git
Here, a shallow clone is made with just 1 commit.
$ git show -s --pretty=%P HEAD
Outputs nothing; that's already a small bug.
Surely the commit has parents!
$ git cat-file -p HEAD | grep parent
OK, that's better, finally the true parents are shown.
$ >1.txt
$ git add 1.txt
$ git commit --amend
Here, the top (and only in our clone) commit is amended.
$ git cat-file -p HEAD | grep parent
Nothing! This is the bug I'm reporting: amending the commit orphaned it.
To give a bit more background: I have a heavy-weight repo which I was
testing on different machines. Since it's heavy, I decided to shallow
clone just 1 commit. Upon testing on some machine, I found a small bug
and amended a fix. Then I force-pushed. I expected the branch to be amended.
Instead, what I got was an orphaned branch, disconnected from all repo's
branches, containing all files at once! Clearly not the best thing.
prev parent reply other threads:[~2021-08-06 13:17 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
2021-08-06 12:24 ` Alexandr Miloslavskiy
2021-08-06 12:27 ` Alexandr Miloslavskiy
2021-08-06 13:16 ` Alexandr Miloslavskiy [this message]
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=20d768d5-2fe2-5540-b7e7-2174db7c80cf@syntevo.com \
--to=alexandr.miloslavskiy@syntevo.com \
--cc=bagasdotme@gmail.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