Skip to content

Commit 4ee9dc8

Browse files
committed
fix: gix 0.73 breaking changes
1 parent a3c9b9f commit 4ee9dc8

File tree

16 files changed

+61
-64
lines changed

16 files changed

+61
-64
lines changed

src/cmd/export.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ fn run(matches: &clap::ArgMatches) -> Result<()> {
233233
replacements.insert("authemail", Cow::Borrowed(author.email));
234234
replacements.insert(
235235
"authdate",
236-
Cow::Owned(author.time.format(gix::date::time::format::ISO8601).into()),
236+
Cow::Owned(author.time()?.format(gix::date::time::format::ISO8601).into()),
237237
);
238238
let committer = patch_commit.committer()?;
239239
replacements.insert("commname", Cow::Borrowed(committer.name));
@@ -242,7 +242,7 @@ fn run(matches: &clap::ArgMatches) -> Result<()> {
242242
"commdate",
243243
Cow::Owned(
244244
committer
245-
.time
245+
.time()?
246246
.format(gix::date::time::format::ISO8601)
247247
.into(),
248248
),

src/cmd/import.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,10 +599,10 @@ fn create_patch<'repo>(
599599
gix::actor::Signature {
600600
name: BString::from(name),
601601
email: BString::from(email),
602-
time: default_author.time,
602+
time: default_author.time()?,
603603
}
604604
} else {
605-
default_author.to_owned()
605+
default_author.to_owned()?
606606
}
607607
};
608608

src/cmd/new.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ fn run(matches: &ArgMatches) -> Result<()> {
195195
.allow_implicit_edit(true)
196196
.allow_template_save(!is_refreshing)
197197
.original_patchname(patchname.as_ref())
198-
.default_author(repo.get_author()?.override_author(matches))
198+
.default_author(repo.get_author()?.override_author(matches)?)
199199
.override_tree_id(tree_id)
200200
.override_parent_id(parent_id)
201201
.edit(&stack, &repo, matches)?

src/cmd/pick.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,11 @@ fn pick_picks(
314314
let author = commit.author_strict()?;
315315
let default_committer = stack.repo.get_committer()?;
316316
let committer = if matches.get_flag("committer-date-is-author-date") {
317-
let mut committer = default_committer.to_owned();
317+
let mut committer = default_committer.to_owned()?;
318318
committer.time = author.time;
319319
committer
320320
} else {
321-
default_committer.to_owned()
321+
default_committer.to_owned()?
322322
};
323323
let parent = if let Some(parent) = opt_parent.as_ref() {
324324
parent.clone()

src/cmd/refresh.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,11 @@ fn run(matches: &ArgMatches) -> Result<()> {
180180
let opt_annotate = matches.get_one::<String>("annotate");
181181

182182
// Make temp patch
183+
let overridden_author = repo.get_author()?.override_author(matches)?;
184+
let committer = repo.get_committer()?.to_owned()?;
183185
let temp_commit_id = stack.repo.commit_ex(
184-
&repo.get_author()?.override_author(matches),
185-
repo.get_committer()?,
186+
&overridden_author,
187+
&committer,
186188
&Message::from(format!("Refresh of {patchname}")),
187189
tree_id,
188190
[stack.get_branch_head().id],

src/cmd/spill.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ fn run(matches: &ArgMatches) -> Result<()> {
101101
let author = patch_commit.author_strict()?;
102102
let default_committer = repo.get_committer()?;
103103
let committer = if matches.get_flag("committer-date-is-author-date") {
104-
let mut committer = default_committer.to_owned();
104+
let mut committer = default_committer.to_owned()?;
105105
committer.time = author.time;
106106
committer
107107
} else {
108-
default_committer.to_owned()
108+
default_committer.to_owned()?
109109
};
110110

111111
let commit_id = repo.commit_ex(

src/cmd/squash.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn run(matches: &ArgMatches) -> Result<()> {
110110
.allow_diff_edit(false)
111111
.allow_template_save(true)
112112
.template_patchname(patchname.as_ref())
113-
.default_author(repo.get_author()?.override_author(matches))
113+
.default_author(repo.get_author()?.override_author(matches)?)
114114
.default_message(prepare_message(&stack, &squash_patchnames)?)
115115
.edit(&stack, &repo, matches)?
116116
{
@@ -271,7 +271,7 @@ fn try_squash(
271271
} else {
272272
repo.get_author()?
273273
}
274-
.override_author(matches),
274+
.override_author(matches)?,
275275
)
276276
.default_message(prepare_message(trans, patchnames)?)
277277
.edit(trans, repo, matches)?

src/cmd/sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ fn run(matches: &clap::ArgMatches) -> Result<()> {
225225
let author = commit.author_strict()?;
226226
let default_committer = trans.repo().get_committer()?;
227227
let committer = if matches.get_flag("committer-date-is-author-date") {
228-
let mut committer = default_committer.to_owned();
228+
let mut committer = default_committer.to_owned()?;
229229
committer.time = author.time;
230230
committer
231231
} else {
232-
default_committer.to_owned()
232+
default_committer.to_owned()?
233233
};
234234
let commit_id = trans.repo().commit_ex(
235235
&author,

src/ext/commit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<'a> CommitExtended<'a> for gix::Commit<'a> {
5353
Ok(gix::actor::Signature {
5454
name: BString::from(name.as_ref()),
5555
email: BString::from(email.as_ref()),
56-
time: sig.time,
56+
time: sig.time()?,
5757
})
5858
} else {
5959
Err(anyhow!(

src/ext/repository.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ pub(crate) trait RepositoryExtended {
5353
///
5454
/// - Respecting `i18n.commitEncoding` for commit messages.
5555
/// - Respecting `commit.gpgSign` and creating signed commits when enabled.
56-
fn commit_ex<'a>(
56+
fn commit_ex(
5757
&self,
58-
author: impl Into<gix::actor::SignatureRef<'a>>,
59-
committer: impl Into<gix::actor::SignatureRef<'a>>,
58+
author: &gix::actor::Signature,
59+
committer: &gix::actor::Signature,
6060
message: &Message,
6161
tree_id: gix::ObjectId,
6262
parent_ids: impl IntoIterator<Item = gix::ObjectId>,
@@ -66,10 +66,10 @@ pub(crate) trait RepositoryExtended {
6666
///
6767
/// The provided [`CommitOptions`] gives finer-grained control versus
6868
/// [`RepositoryExtended::commit_ex()`].
69-
fn commit_with_options<'a>(
69+
fn commit_with_options(
7070
&self,
71-
author: impl Into<gix::actor::SignatureRef<'a>>,
72-
committer: impl Into<gix::actor::SignatureRef<'a>>,
71+
author: &gix::actor::Signature,
72+
committer: &gix::actor::Signature,
7373
message: &Message,
7474
tree_id: gix::ObjectId,
7575
parent_ids: impl IntoIterator<Item = gix::ObjectId>,
@@ -195,10 +195,10 @@ impl RepositoryExtended for gix::Repository {
195195
Ok(())
196196
}
197197

198-
fn commit_ex<'a>(
198+
fn commit_ex(
199199
&self,
200-
author: impl Into<gix::actor::SignatureRef<'a>>,
201-
committer: impl Into<gix::actor::SignatureRef<'a>>,
200+
author: &gix::actor::Signature,
201+
committer: &gix::actor::Signature,
202202
message: &Message,
203203
tree_id: gix::ObjectId,
204204
parent_ids: impl IntoIterator<Item = gix::ObjectId>,
@@ -219,17 +219,15 @@ impl RepositoryExtended for gix::Repository {
219219
)
220220
}
221221

222-
fn commit_with_options<'a>(
222+
fn commit_with_options(
223223
&self,
224-
author: impl Into<gix::actor::SignatureRef<'a>>,
225-
committer: impl Into<gix::actor::SignatureRef<'a>>,
224+
author: &gix::actor::Signature,
225+
committer: &gix::actor::Signature,
226226
message: &Message,
227227
tree_id: gix::ObjectId,
228228
parent_ids: impl IntoIterator<Item = gix::ObjectId>,
229229
options: &CommitOptions<'_>,
230230
) -> Result<gix::ObjectId> {
231-
let author = author.into();
232-
let committer = committer.into();
233231
let commit_encoding = match &options.commit_encoding {
234232
Some(s) => {
235233
let encoding = encoding_rs::Encoding::for_label(s)
@@ -256,7 +254,7 @@ impl RepositoryExtended for gix::Repository {
256254
let commit_id = self.write_object(&gix::objs::Commit {
257255
tree: tree_id,
258256
parents: parent_ids.into_iter().collect(),
259-
author: author.to_owned(),
257+
author: author.clone(),
260258
committer: committer.to_owned(),
261259
encoding: commit_encoding.map(|enc| enc.name().into()),
262260
message: message.raw_bytes().into(),

0 commit comments

Comments
 (0)