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

bug: --shallow-since misbehaves on old branch heads

From
Andreas Krey <a.krey@gmx.de>
Date
May 22, 2018, 19:48 UTC
Message-ID
<20180522194854.GA29564@inner.h.apk.li>
Hi everybody,

I think I have discovered a problem with clone/fetch --shallow-since: When a ref that is fetches has a head that is already older than the 'since' time, then the entire branch is fetched, instead of just the current commit.

Repro:
  rm -rf tmp out deep
  git init tmp
  for i in `seq 10 31`; do
      d="2017-05-${i}T12:00"
      GIT_AUTOR_DATE="$d" GIT_COMMITTER_DATE="$d" git -C tmp commit -m nix$i --allow-empty
  done
  git -C tmp checkout -b test HEAD^^^
  for i in `seq 10 14`; do
      d="2017-06-${i}T12:00"
      GIT_AUTHOR_DATE="$d" GIT_COMMITTER_DATE="$d" git -C tmp commit -m nax$i --allow-empty
  done
  for i in `seq 1 4`; do
      git -C tmp commit -m new$i --allow-empty
  done
  echo "** This is fine:"
  git clone --shallow-since '1 month ago' file://`pwd`/tmp out --branch test
  git -C out log --oneline
  echo "** This should show one commit but shows all:"
  git clone --shallow-since '1 month ago' file://`pwd`/tmp deep --branch master
  git -C deep log --oneline
Do I expect the wrong thing?
- Andreas
-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800
Next: Duy Nguyen
Message 1 of 8 in “bug: --shallow-since misbehaves on old branch heads”
  1. Andreas KreyMay 22, 2018
  2. Duy NguyenMay 23, 2018
  3. upload-pack: reject shallow requests that would return nothingNguyễn Thái Ngọc Duy, May 26, 2018
  4. Junio C HamanoMay 28, 2018
  5. Duy NguyenMay 28, 2018
  6. Duy NguyenJun 2, 2018
  7. Junio C HamanoJun 4, 2018
  8. Duy NguyenJun 4, 2018

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.