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

Provide log functionality wrapping the revwalk #3041

Open
5 tasks
carlosmn opened this issue Apr 13, 2015 · 2 comments
Open
5 tasks

Provide log functionality wrapping the revwalk #3041

carlosmn opened this issue Apr 13, 2015 · 2 comments

Comments

@carlosmn
Copy link
Member

The revwalk code provides a way to specify a range of commits to work with but little else (it does do first-parent walks as that was relatively easy to put into the code).

Users want to perform more complex operations, similarly to how git-log provides features on top of git-rev-list. We want to provide them, but we also don't want the revwalk code to become unwieldy. Thus some code which leverages the revwalk to provide the range of commits but does simplification or filtering on top sounds like a good way to do both of these.

Some of the feature this git_log (or similar) namespace/object would provide would be:

  • Limit revisions (pass-through to revwalk)
  • First-parent walk (pass-through to revwalk)
  • Limit the number of returned commits
  • Allow filtering by path(s) touched by the commits
  • Something akin to --cherry-pick

A combination of limiting the number of returned commits and filtering by path would allow a caller to ask for the last commit (in whatever sorting) to touch a particular path.

I will be closing some of the issues which deal with specific aspects of this and redirect them here.

@carlosmn
Copy link
Member Author

Just a note that if you activate path-based history simplification, you can't use the revwalk to guide you since you need to be able to skip sub-histories without hiding, which the revwalk can't let you do.

@mattyclarkson
Copy link

What is the current thinking here?

I assume we would add something to git_revwalk to understand a pathspec or even a direct single filepath?

/**
 * Push a single filepath into the revwalk
 *
 * Enqueues commits relating to the history of the file.
 * Often combined with `git_revwalk_simplify_first_parent`
 *
 * @param walk the walker being used for the traversal
 * @param path the relative path of the file to be walked
 * @return 0 or an error code
 *
 */
GIT_EXTERN(int) git_revwalk_push_path(git_revwalk *walk, const char *path);

This would then allow the walker to do efficient detection of whether a commit is relevant because it affected the file, as mentioned here. Need some of the TREESAME magic

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

2 participants