git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug: fetch with deepen shortens history

From
BSBenjamin Stein <benji_stein@hotmail.com>
Date
Jul 25, 2023, 00:03 UTC
Message-ID
<PH8P223MB0699B4956F3FE9DC736419FA9F03A@PH8P223MB0699.NAMP223.PROD.OUTLOOK.COM>
In-Reply-To
<PH8P223MB06996E110EF25C386AA314E19F26A@PH8P223MB0699.NAMP223.PROD.OUTLOOK.COM>
> Hello git gurus,
Show 8 quoted lines
> 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.

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

Previous: Benjamin SteinNext: Bagas Sanjaya
Message 2 of 3 in “Bug: fetch with deepen shortens history”
  1. Benjamin SteinJun 26, 2023
  2. Benjamin SteinJul 25, 2023
  3. Bagas SanjayaJul 31, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.