From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Benjamin Stein <benji_stein@hotmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>, Taylor Blau <me@ttaylorr.com>
Subject: Re: Bug: fetch with deepen shortens history
Date: Mon, 31 Jul 2023 17:56:07 +0700 [thread overview]
Message-ID: <ZMeTR1rj9RH27CUL@debian.me> (raw)
In-Reply-To: <PH8P223MB0699B4956F3FE9DC736419FA9F03A@PH8P223MB0699.NAMP223.PROD.OUTLOOK.COM>
[-- Attachment #1: Type: text/plain, Size: 2977 bytes --]
On Tue, Jul 25, 2023 at 12:03:31AM +0000, Benjamin Stein wrote:
> > Hello git gurus,
>
> > Here's an atypical bug report for you. I'm sorry for not starting with the template, but the context/setup are longer
> > than felt useful in that format.
> >
> > I have what I believe to be a (relatively) simple, reproducible test case (repo setup/steps below) around shallow
> > checkouts at merge commits and deepening where the behavior is quite surprising - I end up with a smaller history
> > after a fetch operation than when I started!
> >
> > [...snip...]
>
> Hello again. It's been a month, and I didn't even get a "yes, we tested this and confirm the problem", so I thought I'd check in on this.
>
> I also found a commit setup where even my "working" solution steps (only using deepen) still ends up with the unexpected behavior, so I thought I'd add that in here as a simpler scenario to experiment with. It happens when both sides of the merge are the same number of commits to the merge base.
>
> Let me know if there's any additional information I can provide or something I can do to help resolve.
(also Cc: Junio and Taylor.)
I think in most cases, people doing shallow clones for testing mainline
branch of whatever project they're hacking. If at some later date they
wish to deepen their clones, they can do that up to specified date:
```
$ git clone <clone url> project && cd project
(hack, hack, hack)
$ git checkout main
$ git fetch --shallow-since=2023-01-01 && git repack -A -d
```
I often use this method when cloning quite large repos when I'm on mobile
data (via WiFi tethering) due to bandwidth limitation.
>
> Thanks,
> Benji
>
> ---------simple-bug-setup.sh---------
> set -x
> # Setup working folder for easy cleanup
> mkdir git-test && cd git-test
>
> # Setup repo
> mkdir source-repo && cd source-repo
> git init
> git branch -m trunk
> for i in {01..05}; do echo "start${i}" >> start; git add start; git commit -m "start${i}"; done
> git branch old-checkpoint
> for i in {01..10}; do echo "new${i}" >> new; git add new; git commit -m "new${i}"; done
> git checkout -b feature HEAD~4
> for i in {01..03}; do echo "feature${i}" >> feature; git add feature; git commit -m "feature${i}"; done
> git checkout trunk
> git merge --no-edit feature
> cd ..
> sleep 1
>
> # simple checkout
> git clone --no-local source-repo --depth=1 --branch trunk shallow-clone-only-deepen
> cd shallow-clone-only-deepen
> git remote set-branches --add origin '*'
> git fetch --deepen=4 origin HEAD feature # this also works if we use feature
> git fetch origin --shallow-exclude=old-checkpoint feature
> git log --oneline origin/feature | wc -l # 9, expected
> git fetch --deepen=1 origin feature
> git log --oneline origin/feature | wc -l # 4, unexpected
> cd ..
> sleep 1
>
Thanks for the script that you provided.
--
An old man doll... just what I always wanted! - Clara
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-07-31 10:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-26 21:24 Bug: fetch with deepen shortens history Benjamin Stein
2023-07-25 0:03 ` Benjamin Stein
2023-07-31 10:56 ` Bagas Sanjaya [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-08-04 18:22 Benjamin Stein
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=ZMeTR1rj9RH27CUL@debian.me \
--to=bagasdotme@gmail.com \
--cc=benji_stein@hotmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.com \
/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;
as well as URLs for NNTP newsgroup(s).