2

I have a broken tree with the hash given by

$ git fsck Checking object directories: 100% (256/256), done. warning in tree <tree-hash>: nullSha1: contains entries pointing to null sha1 

and I want to find the commit that introduced it. I know I can find that info if I try to filter the branch with, e.g.:

$ git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch <my_broken_subdir>' --prune-empty --tag-name-filter cat -- --all ... Rewrite <commit_hash> error: cache entry has null sha1: <my_broken_subdir> 

However, I have a long history project and running git-filter would take too long.

UPDATE

Actually, the tree is broken by that it contains a null sha1. Therefore, git bisect won't work, since in any commit I check out, running

 git fsck 

would always give me the

warning in tree <tree-hash>: nullSha1: contains entries pointing to null sha1 
1
  • Maybe something with git bisect? That'd at least get you to log N commits to check. Somebody more clever than I could probably give you a useful example. Commented Apr 12, 2018 at 12:35

1 Answer 1

1

In general, trying to find a tree via the commits doesn't sound like fun, since the "broken" TREE could be anywhere in the TREE hierarchy of any given commit. It sounds like maybe you know the corresponding directory path, which would simplify things a little, but that still sounds like a pretty involved bit of custom scripting.

It might be simpler to use git bisect, with git fsck (looking for the error) as your test for each commit.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.