Skip to content

Commit

Permalink
TMP: Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Nov 28, 2023
1 parent 42ff9d8 commit 4d93a76
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/src/rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,22 @@ pub fn back_out_commit(
.write()?)
}

/// Assumes that `parent_mapping` does not contain cycles
/// TODO: More details
/// This function computes where `old_commits` ended up after the previous
/// rebases, as recorded by `parent_mapping`.
///
/// This function is appropriate when the original plan was to rebase some other
/// commit onto `old_commits`, but some rebases had to happen first.
///
/// May Panic:
/// - If any values in `parent_mapping` are empty vectors.
/// - If `parent_mapping` contains cycles. For example, if `(A, [B,C])`` is in
/// there, the mapping cannot contain `(B, [A, anything])`; longer cycles are
/// also disallowed.
///
/// One way to avoid cycles is as follows: when inserting `(A, [B,C])` into the
/// parent_mapping, make sure that neither `B` nor `C` are there already. Often,
/// this will be a consequence of the order of rebases, but it can also be
/// checked explicitly.
pub fn new_parents_via_mapping(
old_ids: &[CommitId],
parent_mapping: &HashMap<CommitId, Vec<CommitId>>,
Expand Down

0 comments on commit 4d93a76

Please sign in to comment.