rev-list: add commit object support in --missing
option
The `--missing` object option in rev-list currently works only with missing blobs/trees. For missing commits the revision walker fails with a fatal error. Let's extend the functionality of `--missing` option to also support commit objects. This is done by adding a `missing_objects` field to `rev_info`. This field is an `oidset` to which we'll add the missing commits as we encounter them. The revision walker will now continue the traversal and call `show_commit()` even for missing commits. In rev-list we can then check if the commit is a missing commit and call the existing code for parsing `--missing` objects. A scenario where this option would be used is to find the boundary objects between different object directories. Consider a repository with a main object directory (GIT_OBJECT_DIRECTORY) and one or more alternate object directories (GIT_ALTERNATE_OBJECT_DIRECTORIES). In such a repository, using the `--missing=print` option while disabling the alternate object directory allows us to find the boundary objects between the main and alternate object directory. Helped-by: Patrick Steinhardt <ps@pks.im> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b49529230d
commit
9830926c7d
@ -4,6 +4,7 @@
|
||||
#include "commit.h"
|
||||
#include "grep.h"
|
||||
#include "notes.h"
|
||||
#include "oidset.h"
|
||||
#include "pretty.h"
|
||||
#include "diff.h"
|
||||
#include "commit-slab-decl.h"
|
||||
@ -373,6 +374,9 @@ struct rev_info {
|
||||
|
||||
/* Location where temporary objects for remerge-diff are written. */
|
||||
struct tmp_objdir *remerge_objdir;
|
||||
|
||||
/* Missing commits to be tracked without failing traversal. */
|
||||
struct oidset missing_commits;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user