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

[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
Next: Johannes Schindelin
Message 1 of 16 in “Teach `git fsck` a new option: `--name-objects`”
  1. 0/3 Teach `git fsck` a new option: `--name-objects`Johannes Schindelin, Jul 14, 2016
  2. 1/3 fsck: refactor how to describe objectsJohannes Schindelin, Jul 14, 2016
  3. Junio C HamanoJul 14, 2016
  4. 2/3 fsck_walk(): optionally name objects on the goJohannes Schindelin, Jul 14, 2016
  5. Junio C HamanoJul 14, 2016
  6. Johannes SchindelinJul 17, 2016
  7. 3/3 fsck: optionally show more helpful info for broken linksJohannes Schindelin, Jul 14, 2016
  8. Eric SunshineJul 15, 2016
  9. Johannes SchindelinJul 17, 2016
  10. Junio C HamanoJul 14, 2016
  11. 0/4 Teach `git fsck` a new option: `--name-objects`Johannes Schindelin, Jul 17, 2016
  12. 2/4 fsck_walk(): optionally name objects on the goJohannes Schindelin, Jul 17, 2016
  13. 3/4 fsck: give the error function a chance to see the fsck_optionsJohannes Schindelin, Jul 17, 2016
  14. 4/4 fsck: optionally show more helpful info for broken linksJohannes Schindelin, Jul 17, 2016
  15. 1/4 fsck: refactor how to describe objectsJohannes Schindelin, Jul 17, 2016
  16. Junio C HamanoJul 18, 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.