Skip to content

chore: update gix to 0.73 #579

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
419 changes: 159 additions & 260 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ clap = { version = "~4.5", default-features = false, features = [
ctrlc = "3.4"
encoding_rs = "0.8"
flate2 = "1"
gix = { version = "0.71", default-features = false, features = [
gix = { version = "0.73", default-features = false, features = [
"command",
"revision",
] }
Expand Down
9 changes: 7 additions & 2 deletions src/cmd/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,12 @@ fn run(matches: &clap::ArgMatches) -> Result<()> {
replacements.insert("authemail", Cow::Borrowed(author.email));
replacements.insert(
"authdate",
Cow::Owned(author.time.format(gix::date::time::format::ISO8601).into()),
Cow::Owned(
author
.time()?
.format(gix::date::time::format::ISO8601)
.into(),
),
);
let committer = patch_commit.committer()?;
replacements.insert("commname", Cow::Borrowed(committer.name));
Expand All @@ -242,7 +247,7 @@ fn run(matches: &clap::ArgMatches) -> Result<()> {
"commdate",
Cow::Owned(
committer
.time
.time()?
.format(gix::date::time::format::ISO8601)
.into(),
),
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,10 @@ fn create_patch<'repo>(
gix::actor::Signature {
name: BString::from(name),
email: BString::from(email),
time: default_author.time,
time: default_author.time()?,
}
} else {
default_author.to_owned()
default_author.to_owned()?
}
};

Expand Down
8 changes: 4 additions & 4 deletions src/cmd/pick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,11 @@ fn pick_picks(
let author = commit.author_strict()?;
let default_committer = stack.repo.get_committer()?;
let committer = if matches.get_flag("committer-date-is-author-date") {
let mut committer = default_committer.to_owned();
let mut committer = default_committer.to_owned()?;
committer.time = author.time;
committer
} else {
default_committer.to_owned()
default_committer.to_owned()?
};
let parent = if let Some(parent) = opt_parent.as_ref() {
parent.clone()
Expand All @@ -332,8 +332,8 @@ fn pick_picks(
(commit.clone(), parent)
};
let new_commit_id = stack.repo.commit_ex(
&author,
&committer,
author.to_ref(&mut gix::date::parse::TimeBuf::default()),
committer.to_ref(&mut gix::date::parse::TimeBuf::default()),
message,
top.tree_id()?.detach(),
[bottom.id],
Expand Down
4 changes: 3 additions & 1 deletion src/cmd/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ fn run(matches: &ArgMatches) -> Result<()> {

// Make temp patch
let temp_commit_id = stack.repo.commit_ex(
&repo.get_author()?.override_author(matches),
repo.get_author()?
.override_author(matches)
.to_ref(&mut gix::date::parse::TimeBuf::default()),
repo.get_committer()?,
&Message::from(format!("Refresh of {patchname}")),
tree_id,
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/spill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ fn run(matches: &ArgMatches) -> Result<()> {
let author = patch_commit.author_strict()?;
let default_committer = repo.get_committer()?;
let committer = if matches.get_flag("committer-date-is-author-date") {
let mut committer = default_committer.to_owned();
let mut committer = default_committer.to_owned()?;
committer.time = author.time;
committer
} else {
default_committer.to_owned()
default_committer.to_owned()?
};

let commit_id = repo.commit_ex(
&author,
&committer,
author.to_ref(&mut gix::date::parse::TimeBuf::default()),
committer.to_ref(&mut gix::date::parse::TimeBuf::default()),
&patch_commit.message_ex(),
tree_id,
patch_commit_ref.parents(),
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ fn run(matches: &clap::ArgMatches) -> Result<()> {
let author = commit.author_strict()?;
let default_committer = trans.repo().get_committer()?;
let committer = if matches.get_flag("committer-date-is-author-date") {
let mut committer = default_committer.to_owned();
let mut committer = default_committer.to_owned()?;
committer.time = author.time;
committer
} else {
default_committer.to_owned()
default_committer.to_owned()?
};
let commit_id = trans.repo().commit_ex(
&author,
&committer,
author.to_ref(&mut gix::date::parse::TimeBuf::default()),
committer.to_ref(&mut gix::date::parse::TimeBuf::default()),
&commit.message_ex(),
tree_id,
[parent_id],
Expand Down
2 changes: 1 addition & 1 deletion src/ext/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<'a> CommitExtended<'a> for gix::Commit<'a> {
Ok(gix::actor::Signature {
name: BString::from(name.as_ref()),
email: BString::from(email.as_ref()),
time: sig.time,
time: sig.time()?,
})
} else {
Err(anyhow!(
Expand Down
4 changes: 2 additions & 2 deletions src/ext/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ impl RepositoryExtended for gix::Repository {
let commit_id = self.write_object(&gix::objs::Commit {
tree: tree_id,
parents: parent_ids.into_iter().collect(),
author: author.to_owned(),
committer: committer.to_owned(),
author: author.to_owned()?,
committer: committer.to_owned()?,
encoding: commit_encoding.map(|enc| enc.name().into()),
message: message.raw_bytes().into(),
extra_headers: vec![],
Expand Down
21 changes: 15 additions & 6 deletions src/patch/edit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ impl<'a, 'repo> EditBuilder<'a, 'repo> {
// existing patch commit's author is broken, but only if the author
// signature has to be derived from that commit.
let patch_commit = patch_commit.expect("existing patch or author overlay is required");
if let Some(args_author) = author_from_args(matches, Some(patch_commit.author()?.time))?
if let Some(args_author) =
author_from_args(matches, Some(patch_commit.author()?.time()?))?
{
Some(args_author)
} else {
Expand Down Expand Up @@ -473,7 +474,7 @@ impl<'a, 'repo> EditBuilder<'a, 'repo> {
Some(None) => Some(if let Some(commit) = patch_commit {
commit.author_strict()?
} else {
repo.get_author()?.to_owned()
repo.get_author()?.to_owned()?
}),
None => patch_description.author.take(),
};
Expand Down Expand Up @@ -543,11 +544,11 @@ impl<'a, 'repo> EditBuilder<'a, 'repo> {
};

let committer = if matches.get_flag("committer-date-is-author-date") {
let mut committer = default_committer.to_owned();
let mut committer = default_committer.to_owned()?;
committer.time = author.time;
committer
} else {
default_committer.to_owned()
default_committer.to_owned()?
};

let new_commit_id = if patch_commit
Expand All @@ -558,14 +559,22 @@ impl<'a, 'repo> EditBuilder<'a, 'repo> {
// N.B.: intentionally not comparing commiter.when()
&& patch_commit_ref.author().name == author.name
&& patch_commit_ref.author().email == author.email
&& patch_commit_ref.author().time == author.time
&& patch_commit_ref.author().time == author.time.to_str(
&mut gix::date::parse::TimeBuf::default()
)
&& patch_commit_ref.message == message.raw_bytes()
&& patch_commit_ref.tree() == tree_id
&& patch_commit_ref.parents().next() == Some(parent_id)
}) {
None
} else {
Some(repo.commit_ex(&author, &committer, &message, tree_id, [parent_id])?)
Some(repo.commit_ex(
author.to_ref(&mut gix::date::parse::TimeBuf::default()),
committer.to_ref(&mut gix::date::parse::TimeBuf::default()),
&message,
tree_id,
[parent_id],
)?)
};

let new_patchname = if original_patchname.as_ref() == Some(&patchname) {
Expand Down
16 changes: 8 additions & 8 deletions src/stack/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,17 +558,17 @@ impl<'repo> StackTransaction<'repo> {
let author = patch_commit.author_strict()?;
let default_committer = repo.get_committer()?;
let committer = if self.options.committer_date_is_author_date {
let mut committer = default_committer.to_owned();
let mut committer = default_committer.to_owned()?;
committer.time = author.time;
committer
} else {
default_committer.to_owned()
default_committer.to_owned()?
};
let message = patch_commit.message_ex();
let parent_ids = [self.top().id];
let new_commit_id = repo.commit_ex(
&author,
&committer,
author.to_ref(&mut gix::date::parse::TimeBuf::default()),
committer.to_ref(&mut gix::date::parse::TimeBuf::default()),
&message,
patch_commit.tree_id()?.detach(),
parent_ids,
Expand Down Expand Up @@ -1111,15 +1111,15 @@ impl<'repo> StackTransaction<'repo> {
if new_tree_id != patch_commit_ref.tree() || new_parent.id != old_parent.id {
let author = patch_commit.author_strict()?;
let committer = if self.options.committer_date_is_author_date {
let mut committer = default_committer.to_owned();
let mut committer = default_committer.to_owned()?;
committer.time = author.time;
committer
} else {
default_committer.to_owned()
default_committer.to_owned()?
};
let commit_id = repo.commit_ex(
&author,
&committer,
author.to_ref(&mut gix::date::parse::TimeBuf::default()),
committer.to_ref(&mut gix::date::parse::TimeBuf::default()),
&patch_commit.message_ex(),
new_tree_id,
[new_parent.id],
Expand Down
4 changes: 2 additions & 2 deletions src/stupid/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,11 @@ impl StupidContext<'_, '_> {
// TODO: re-encode dates?
.env(
"GIT_AUTHOR_DATE",
author.time.format(gix::date::time::format::RAW),
author.time()?.format(gix::date::time::format::RAW),
)
.env(
"GIT_COMMITTER_DATE",
committer.time.format(gix::date::time::format::RAW),
committer.time()?.format(gix::date::time::format::RAW),
)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
Expand Down
Loading