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

BUG? git log --no-merges shows grafted merges in shallow clones

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Feb 26, 2016, 19:49 UTC
Message-ID
<vpq4mcvs146.fsf@anie.imag.fr>
Hi,

I don't think that's intended. When running "git log --no-merges" in a shallow clone, and the last commit in the history is a merge commit, "git log --no-merges" still shows it.

I've just hit this in a test running on a --depth=50 clone on Travis-CI on git-multimail:

$ git cat-file -p c3c1cc25b27d448e9ef67b265a11be8735ff2df4 tree c341dd60c4b639eac1d6dcc3caffb5d7201c2245 parent b312e3f90dfef73ba0288999981694b09affdf6b parent 842ac6e867885af041499723dc46f2197705204c author Matthieu Moy <Matthieu.Moy@imag.fr> 1441031540 +0200 committer Matthieu Moy <Matthieu.Moy@imag.fr> 1441031540 +0200

Merge remote-tracking branch 'edward/utf-8-email-support4'
$ git log --no-merges c3c1cc25b27d448e9ef67b265a11be8735ff2df4
commit c3c1cc25b27d448e9ef67b265a11be8735ff2df4 (grafted)
Author: Matthieu Moy <Matthieu.Moy@imag.fr>
Date:   Mon Aug 31 16:32:20 2015 +0200
    Merge remote-tracking branch 'edward/utf-8-email-support4'

I guess Git counts the number of parents that are actually in the repository, but it could check the number of "parents" field in the object (cat-file -p was still able to show 2).

Thanks,
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Next: Junio C Hamano
Message 1 of 4 in “BUG? git log --no-merges shows grafted merges in shallow clones”
  1. Matthieu MoyFeb 26, 2016
  2. Junio C HamanoFeb 26, 2016
  3. Matthieu MoyFeb 26, 2016
  4. Junio C HamanoFeb 26, 2016

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.