mirror of
https://github.com/git/git.git
synced 2026-01-11 21:33:13 +09:00
Move the core logic used to replay commits into "libgit.a" so that it can be easily reused by other commands. It will be used in a subsequent commit where we're about to introduce a new git-history(1) command. Note that with this change we have no sign-comparison warnings anymore, and neither do we depend on `the_repository`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
62 lines
1.5 KiB
C
62 lines
1.5 KiB
C
#ifndef REPLAY_H
|
|
#define REPLAY_H
|
|
|
|
#include "hash.h"
|
|
|
|
struct repository;
|
|
struct rev_info;
|
|
|
|
/*
|
|
* A set of options that can be passed to `replay_revisions()`.
|
|
*/
|
|
struct replay_revisions_options {
|
|
/*
|
|
* Starting point at which to create the new commits; must be a branch
|
|
* name. The branch will be updated to point to the rewritten commits.
|
|
* This option is mutually exclusive with `onto`.
|
|
*/
|
|
const char *advance;
|
|
|
|
/*
|
|
* Starting point at which to create the new commits; must be a
|
|
* committish. References pointing at decendants of `onto` will be
|
|
* updated to point to the new commits.
|
|
*/
|
|
const char *onto;
|
|
|
|
/*
|
|
* Update branches that point at commits in the given revision range.
|
|
* Requires `onto` to be set.
|
|
*/
|
|
int contained;
|
|
};
|
|
|
|
/* This struct is used as an out-parameter by `replay_revisions()`. */
|
|
struct replay_ref_updates {
|
|
/*
|
|
* The set of reference updates that are caused by replaying the
|
|
* commits.
|
|
*/
|
|
struct replay_ref_update {
|
|
char *refname;
|
|
struct object_id old_oid;
|
|
struct object_id new_oid;
|
|
} *items;
|
|
size_t nr, alloc;
|
|
};
|
|
|
|
void replay_ref_updates_release(struct replay_ref_updates *updates);
|
|
|
|
/*
|
|
* Replay a set of commits onto a new location. Leaves both the working tree,
|
|
* index and references untouched. Reference updates caused by the replay will
|
|
* be recorded in the `updates` out pointer.
|
|
*
|
|
* Returns 0 on success, a negative error code otherwise.
|
|
*/
|
|
int replay_revisions(struct repository *repo, struct rev_info *revs,
|
|
struct replay_revisions_options *opts,
|
|
struct replay_ref_updates *updates);
|
|
|
|
#endif
|