[PATCH 0/3] Teach `git fsck` a new option: `--name-objects`
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jul 14, 2016, 15:30 UTC
- Message-ID
- <cover.1468510191.git.johannes.schindelin@gmx.de>
When using experimental features (such as worktrees), it is quite possible to end up with a repository that is a little bit corrupted. In this developer's case, the auto gc run during interactive rebases in worktrees completely messed up the reflogs.
The symptoms are broken links between commits/trees/blobs.
Trying to work around such problems can be a real challenge: while several tools will report when objects are missing, all of them simply state the SHA-1. This is not useful when the user has to kiss the offending reflog good-bye, but does not even know which one.
This patch series introduces a new option to `git fsck`: --name-objects. With this option, the fsck command will report not only the SHA-1 of missing objects, but also a name by which this object is supposed to be reachable.
Example output:
...
broken link from tree b5eb6ff... (refs/stash@{<date>}~37:)
to blob ec5cf80...Originally, I intended to teach name-rev a new mode where it would also name objects other than commits and tags, but since the objects in question were lost to a garbage collection, and therefore there would not have been any objects to call names to begin with, I had to abandon said quest.
Johannes Schindelin (3): fsck: refactor how to describe objects fsck_walk(): optionally name objects on the go fsck: optionally show more helpful info for broken links
Documentation/git-fsck.txt | 9 +++++- builtin/fsck.c | 77 ++++++++++++++++++++++++++++++++++++---------- fsck.c | 72 +++++++++++++++++++++++++++++++++++++++++++ fsck.h | 1 + t/t1450-fsck.sh | 22 +++++++++++++ 5 files changed, 163 insertions(+), 18 deletions(-)
Published-As: https://github.com/dscho/git/releases/tag/fsck-name-objects-v1
-- 2.9.0.278.g1caae67 base-commit: 79ed43c28f626a4e805f350a77c54968b59be6e9