Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git fsck fails #2115

Closed
chrwen-omicron opened this issue Dec 19, 2016 · 8 comments
Closed

git fsck fails #2115

chrwen-omicron opened this issue Dec 19, 2016 · 8 comments

Comments

@chrwen-omicron
Copy link

There seems to be something wrong in the database:

error in tag ebbca17dd2ef2868649dd7b6efd355108a9b66f6: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 79ab8214b64c6bca52c113fbed8433ca2313a2c7: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 4b0fc03a51f984fcfe8997dc5ec02476907d6fdf: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag e464508bdb3b3079a9fb9f46c9ba49f26e10910c: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag cbed261df2c2fa53bc8a84e480bb562293f03d70: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 7c49ba934ae7b9a5c30ae0ac2689cc399e12072d: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag e87b3eafa6a21cfcbd9d91bab401a171a6971365: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag c66e3f0be7063bbc211535756430b4c150703ddc: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag bf8ffa694b5ab66ced06d881c48cf2259a32b676: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 526aacb6e5fb7dce91def2d8d3aa2727d78507af: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag b8a8ce05c825b068c6661b1a6869a2d3e2c3f5a7: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 27a87e5364d93506487051daee5fcdd39ef18458: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 1616d98039f5bcbbbb9542502fce3e4ca27e1059: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 3c53801a76a3c62e41150b9e984e3c6870ac161c: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag b42c2620f2a374125360612878c05035f24e27ef: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag c2eeab14095484075c6d7782cd815f0a1769179a: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag bab71d8add6fa4ab508e4a784ba7382364b75d4c: missingSpaceBeforeDate: invalid author/committer line - missing space before date

Just thought I'd inform you guys.

@octo
Copy link
Member

octo commented Dec 22, 2016

Hi @ chrwen-omicron,

this is an issue with you local Git repository, not with our public one. If you clone the repo again, this should be fixed (or you should stop trusting your disks ;-).

Best regards,
—octo

@octo octo closed this as completed Dec 22, 2016
@rubenk
Copy link
Contributor

rubenk commented Dec 22, 2016

@octo I don't think so, I see exactly the same issue on a freshly cloned repo from GitHub:

ruben@wodan: src$ git clone git@github.com:collectd/collectd.git collectd-fresh
Cloning into 'collectd-fresh'...
remote: Counting objects: 44340, done.
remote: Total 44340 (delta 0), reused 0 (delta 0), pack-reused 44340
Receiving objects: 100% (44340/44340), 16.01 MiB | 4.45 MiB/s, done.
Resolving deltas: 100% (32735/32735), done.
ruben@wodan: src$ cd collectd-fresh/
ruben@wodan: collectd-fresh (master=)$ git fsck
Checking object directories: 100% (256/256), done.
error in tag ebbca17dd2ef2868649dd7b6efd355108a9b66f6: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 79ab8214b64c6bca52c113fbed8433ca2313a2c7: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 4b0fc03a51f984fcfe8997dc5ec02476907d6fdf: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag e464508bdb3b3079a9fb9f46c9ba49f26e10910c: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag cbed261df2c2fa53bc8a84e480bb562293f03d70: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 7c49ba934ae7b9a5c30ae0ac2689cc399e12072d: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag e87b3eafa6a21cfcbd9d91bab401a171a6971365: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag c66e3f0be7063bbc211535756430b4c150703ddc: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag bf8ffa694b5ab66ced06d881c48cf2259a32b676: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 526aacb6e5fb7dce91def2d8d3aa2727d78507af: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag b8a8ce05c825b068c6661b1a6869a2d3e2c3f5a7: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 27a87e5364d93506487051daee5fcdd39ef18458: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 1616d98039f5bcbbbb9542502fce3e4ca27e1059: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag 3c53801a76a3c62e41150b9e984e3c6870ac161c: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag b42c2620f2a374125360612878c05035f24e27ef: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag c2eeab14095484075c6d7782cd815f0a1769179a: missingSpaceBeforeDate: invalid author/committer line - missing space before date
error in tag bab71d8add6fa4ab508e4a784ba7382364b75d4c: missingSpaceBeforeDate: invalid author/committer line - missing space before date
Checking objects: 100% (44340/44340), done.
ruben@wodan: collectd-fresh (master=)$ git --version
git version 2.11.0

@philpennock
Copy link

This is a git fsck change dating from around git 2.5ish, catching content which was always bad but not reported before. Anyone not seeing this is working with ancient git(1). Current release is 2.11.0.

The repo has bad content which may continue to work for old clients, or anyone not doing repo integrity checks, but is really now in "technical debt" status. There are scripts floating around to rewrite git history to fix this date formatting issue; pushing that will then become a "force push" and so require the usual "oh no not another force-push flag day" song and dance.

With git config transfer.fsckObjects set true, this repo won't currently even clone.

If you have a local canonical repo, I think (but am not certain) git repack -Ad may help keep these refs from being transferred to clients from that repo unexpectedly. You might need to do aggressive pruning though. If the canonical repos are fixed, "blow away your client and re-clone" becomes the sanest approach.

@octo
Copy link
Member

octo commented May 12, 2017

I just realized (with the help of @igorpeshansky) that this only affects tags, so no history-rewriting necessary → all currently pending PRs will still work cleanly after fixing this. I'm feeling much better about this now :)

@igorpeshansky
Copy link
Contributor

FWIW, I've used the following variant of the script from https://sunweavers.net/blog/node/36:

#!/bin/bash
set -x
git fsck 2>&1 | tee git-fsck.log | sed -re 's/error in tag ([0-9a-f]+):.*/\1/' | while read broken; do
    echo $broken
    commit=$(git rev-parse ${broken}^{commit})
    tag=$(git cat-file tag $broken | sed -n 's/^tag //p')
    tag_msg=$(git cat-file tag $broken | sed -n '/^$/,$p' | tail -n +2)
    export GIT_COMMITTER_NAME="$(git log -1 --format='%cn' $commit)"
    export GIT_COMMITTER_EMAIL="$(git log -1 --format='%ce' $commit)"
    [ "${GIT_COMMITTER_EMAIL%%@*}" -eq "${GIT_COMMITTER_EMAIL}" ] && \
      GIT_COMMITTER_EMAIL="${GIT_COMMITTER_EMAIL}@collectd.org"
    export GIT_COMMITTER_DATE="$(git log -1 --format='%cD' $commit)"
    git tag -a -f -m "$tag_msg" $tag $commit
done
# drop all old content...
git reflog expire --expire=all --all
git gc --prune=all
# no more errors should be reported...
git fsck

@philpennock
Copy link

Not fixed. With transfer.fsckObjects enabled:

Cloning into 'collectd'...
remote: Counting objects: 45756, done.
remote: Compressing objects: 100% (58/58), done.
error: object ebbca17dd2ef2868649dd7b6efd355108a9b66f6: missingSpaceBeforeDate: invalid author/committer line - missing space before date
fatal: Error in object
fatal: index-pack failed

If I use git -c transfer.fsckObjects=false clone git@github.com:collectd/collectd then a subsequent git fsck yields 17 error in tag complaints.

Did the fixed tags get pushed to GitHub?

@octo
Copy link
Member

octo commented Sep 25, 2017

I've updated the broken tags:

/tmp$ git clone git://github.com/collectd/collectd.git && cd collectd && git fsck
Cloning into 'collectd'...
remote: Counting objects: 46786, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 46786 (delta 0), reused 17 (delta 0), pack-reused 46767
Receiving objects: 100% (46786/46786), 17.61 MiB | 2.58 MiB/s, done.
Resolving deltas: 100% (34700/34700), done.
Checking object directories: 100% (256/256), done.
Checking objects: 100% (46786/46786), done.
/tmp/collectd$ echo $?
0

@octo octo closed this as completed Sep 25, 2017
@philpennock
Copy link

I confirm that this now works for me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants