On this page:
git_  revwalk_  add_  hide_  cb
git_  revwalk_  free
git_  revwalk_  hide
git_  revwalk_  hide_  glob
git_  revwalk_  hide_  head
git_  revwalk_  hide_  ref
git_  revwalk_  new
git_  revwalk_  next
git_  revwalk_  push
git_  revwalk_  push_  glob
git_  revwalk_  push_  head
git_  revwalk_  push_  range
git_  revwalk_  push_  ref
git_  revwalk_  repository
git_  revwalk_  reset
git_  revwalk_  simplify_  first_  parent
git_  revwalk_  sorting
git_  sort/  c
8.12

41 Revwalk🔗ℹ

 (require libgit2/include/revwalk) package: libgit2

procedure

(git_revwalk_add_hide_cb walk    
  hide_cb    
  payload)  integer?
  walk : revwalk?
  hide_cb : git_revwalk_hide_cb
  payload : bytes?
Adds a callback function to hide a commit and its parents

procedure

(git_revwalk_free walk)  void?

  walk : revwalk?
Free a revision walker previously allocated.

procedure

(git_revwalk_hide walk commit_id)  integer?

  walk : revwalk?
  commit_id : oid?
Mark a commit (and its ancestors) uninteresting for the output.

The given id must belong to a committish on the walked repository.

The resolved commit and all its parents will be hidden from the output on the revision walk.

procedure

(git_revwalk_hide_glob walk glob)  integer?

  walk : revwalk?
  glob : string?
Hide matching references.

The OIDs pointed to by the references that match the given glob pattern and their ancestors will be hidden from the output on the revision walk.

A leading ’refs/’ is implied if not present as well as a trailing ’/*’ if the glob lacks ’?’, ’*’ or ’[’.

Any references matching this glob which do not point to a committish will be ignored.

procedure

(git_revwalk_hide_head walk)  integer?

  walk : revwalk?
Hide the repository’s HEAD

procedure

(git_revwalk_hide_ref walk refname)  integer?

  walk : revwalk?
  refname : string?
Hide the OID pointed to by a reference

The reference must point to a committish.

procedure

(git_revwalk_new repo)  revwalk?

  repo : repository?
Allocate a new revision walker to iterate through a repo.

This revision walker uses a custom memory pool and an internal commit cache, so it is relatively expensive to allocate.

For maximum performance, this revision walker should be reused for different walks.

This revision walker is not thread safe: it may only be used to walk a repository on a single thread; however, it is possible to have several revision walkers in several different threads walking the same repository.

procedure

(git_revwalk_next walk)  (or/c oid? #f)

  walk : revwalk?
Pops the next commit from walk, or, there are no more commits, returns #f

The initial call to this method is not blocking when iterating through a repo with a time-sorting mode.

Iterating with Topological or inverted modes makes the initial call blocking to preprocess the commit list, but this block should be mostly unnoticeable on most repositories (topological preprocessing times at 0.3s on the git.git repo).

The revision walker is reset when the walk is over.

procedure

(git_revwalk_push walk id)  integer?

  walk : revwalk?
  id : oid?
Add a new root for the traversal

The pushed commit will be marked as one of the roots from which to start the walk. This commit may not be walked if it or a child is hidden.

At least one commit must be pushed onto the walker before a walk can be started.

The given id must belong to a committish on the walked repository.

procedure

(git_revwalk_push_glob walk glob)  integer?

  walk : revwalk?
  glob : string?
Push matching references

The OIDs pointed to by the references that match the given glob pattern will be pushed to the revision walker.

A leading ’refs/’ is implied if not present as well as a trailing ’/*’ if the glob lacks ’?’, ’*’ or ’[’.

Any references matching this glob which do not point to a committish will be ignored.

procedure

(git_revwalk_push_head walk)  integer?

  walk : revwalk?
Push the repository’s HEAD

procedure

(git_revwalk_push_range walk range)  integer?

  walk : revwalk?
  range : string?
Push and hide the respective endpoints of the given range.

The range should be of the form .. where each is in the form accepted by ’git_revparse_single’. The left-hand commit will be hidden and the right-hand commit pushed.

procedure

(git_revwalk_push_ref walk refname)  integer?

  walk : revwalk?
  refname : string?
Push the OID pointed to by a reference

The reference must point to a committish.

procedure

(git_revwalk_repository walk)  repository?

  walk : revwalk?
Return the repository on which this walker is operating.

procedure

(git_revwalk_reset walker)  void?

  walker : revwalk?
Reset the revision walker for reuse.

This will clear all the pushed and hidden commits, and leave the walker in a blank state (just like at creation) ready to receive new commit pushes and start a new walk.

The revision walk is automatically reset when a walk is over.

procedure

(git_revwalk_simplify_first_parent walk)  void?

  walk : revwalk?
Simplify the history by first-parent

No parents other than the first for each commit will be enqueued.

procedure

(git_revwalk_sorting walk sort_mode)  void?

  walk : revwalk?
  sort_mode : git_sort/c

value

git_sort/c : flat-contract?

Change the sorting mode when iterating through the repository’s contents.

Changing the sorting mode resets the walker.