History

fix build (#301)

Sebastian Thiel committed 4 years ago

Commit cb56f121 parent 61ea4c44 files · +66 −12Browse files

Unified · Split

4 files
  1. git-repository/src/types.rs +1 −0
  2. gitoxide-core/src/repository/exclude.rs +2 −2
  3. src/plumbing/main.rs +18 −9
  4. src/shared.rs +45 −1
git-repository/src/types.rs+1−0
@@ -8,6 +8,7 @@ use crate::head; · 7 unmodified lines
88 pub struct Worktree<'repo> {
99 pub(crate) parent: &'repo Repository,
1010 /// The root path of the checkout.
11+ #[allow(dead_code)]
1112 pub(crate) path: &'repo std::path::Path,
1213 }
1314
gitoxide-core/src/repository/exclude.rs+2−2
@@ -16,8 +16,8 @@ pub mod query { · 15 unmodified lines
1616
1717 pub fn query(
1818 repo: git::Repository,
19− out: impl io::Write,
20− query::Options { format, pathspecs }: query::Options,
19+ _out: impl io::Write,
20+ query::Options { format, pathspecs: _ }: query::Options,
2121 ) -> anyhow::Result<()> {
2222 if format != OutputFormat::Human {
2323 bail!("JSON output isn't implemented yet");
src/plumbing/main.rs+18−9
@@ -157,7 +157,7 @@ pub fn main() -> Result<()> { · 156 unmodified lines
157157 },
158158 Subcommands::Repository(repo::Platform { repository, cmd }) => {
159159 use git_repository as git;
160− let repository = git::open(repository)?.apply_environment();
160+ let repository = git::ThreadSafeRepository::open(repository)?;
161161 match cmd {
162162 repo::Subcommands::Commit { cmd } => match cmd {
163163 repo::commit::Subcommands::Describe {
@@ -177,7 +177,7 @@ pub fn main() -> Result<()> { · 13 unmodified lines
177177 None,
178178 move |_progress, out, err| {
179179 core::repository::commit::describe(
180− repository,
180+ repository.into(),
181181 rev_spec.as_deref(),
182182 out,
183183 err,
@@ -203,7 +203,7 @@ pub fn main() -> Result<()> { · 19 unmodified lines
203203 None,
204204 move |_progress, out, _err| {
205205 core::repository::exclude::query(
206− repository,
206+ repository.into(),
207207 out,
208208 core::repository::exclude::query::Options { format, pathspecs },
209209 )
@@ -217,7 +217,9 @@ pub fn main() -> Result<()> { · 7 unmodified lines
217217 progress,
218218 progress_keep_open,
219219 None,
220− move |_progress, out, err| core::repository::mailmap::entries(repository, format, out, err),
220+ move |_progress, out, err| {
221+ core::repository::mailmap::entries(repository.into(), format, out, err)
222+ },
221223 ),
222224 },
223225 repo::Subcommands::Odb { cmd } => match cmd {
@@ -227,7 +229,7 @@ pub fn main() -> Result<()> { · 3 unmodified lines
227229 progress,
228230 progress_keep_open,
229231 None,
230− move |_progress, out, _err| core::repository::odb::entries(repository, format, out),
232+ move |_progress, out, _err| core::repository::odb::entries(repository.into(), format, out),
231233 ),
232234 repo::odb::Subcommands::Info => prepare_and_run(
233235 "repository-odb-info",
@@ -235,7 +237,7 @@ pub fn main() -> Result<()> { · 1 unmodified line
235237 progress,
236238 progress_keep_open,
237239 None,
238− move |_progress, out, err| core::repository::odb::info(repository, format, out, err),
240+ move |_progress, out, err| core::repository::odb::info(repository.into(), format, out, err),
239241 ),
240242 },
241243 repo::Subcommands::Tree { cmd } => match cmd {
@@ -251,7 +253,7 @@ pub fn main() -> Result<()> { · 9 unmodified lines
251253 None,
252254 move |_progress, out, _err| {
253255 core::repository::tree::entries(
254− repository,
256+ repository.into(),
255257 treeish.as_deref(),
256258 recursive,
257259 extended,
@@ -267,7 +269,14 @@ pub fn main() -> Result<()> { · 9 unmodified lines
267269 progress_keep_open,
268270 None,
269271 move |_progress, out, err| {
270− core::repository::tree::info(repository, treeish.as_deref(), extended, format, out, err)
272+ core::repository::tree::info(
273+ repository.into(),
274+ treeish.as_deref(),
275+ extended,
276+ format,
277+ out,
278+ err,
279+ )
271280 },
272281 ),
273282 },
@@ -287,7 +296,7 @@ pub fn main() -> Result<()> { · 13 unmodified lines
287296 core::repository::verify::PROGRESS_RANGE,
288297 move |progress, out, _err| {
289298 core::repository::verify::integrity(
290− repository,
299+ repository.into(),
291300 out,
292301 progress,
293302 &should_interrupt,
src/shared.rs+45−1
@@ -52,12 +52,56 @@ pub mod pretty { · 51 unmodified lines
5252
5353 use crate::shared::ProgressRange;
5454
55+ #[cfg(feature = "small")]
56+ pub fn prepare_and_run<T>(
57+ name: &str,
58+ verbose: bool,
59+ progress: bool,
60+ #[cfg_attr(not(feature = "prodash-render-tui"), allow(unused_variables))] progress_keep_open: bool,
61+ range: impl Into<Option<ProgressRange>>,
62+ run: impl FnOnce(
63+ progress::DoOrDiscard<prodash::tree::Item>,
64+ &mut dyn std::io::Write,
65+ &mut dyn std::io::Write,
66+ ) -> Result<T>,
67+ ) -> Result<T> {
68+ crate::shared::init_env_logger();
69+
70+ match (verbose, progress) {
71+ (false, false) => {
72+ let stdout = stdout();
73+ let mut stdout_lock = stdout.lock();
74+ let stderr = stderr();
75+ let mut stderr_lock = stderr.lock();
76+ run(progress::DoOrDiscard::from(None), &mut stdout_lock, &mut stderr_lock)
77+ }
78+ (true, false) => {
79+ let progress = crate::shared::progress_tree();
80+ let sub_progress = progress.add_child(name);
81+
82+ use crate::shared::{self, STANDARD_RANGE};
83+ let handle = shared::setup_line_renderer_range(&progress, range.into().unwrap_or(STANDARD_RANGE));
84+
85+ let mut out = Vec::<u8>::new();
86+ let res = run(progress::DoOrDiscard::from(Some(sub_progress)), &mut out, &mut stderr());
87+ handle.shutdown_and_wait();
88+ std::io::Write::write_all(&mut stdout(), &out)?;
89+ res
90+ }
91+ #[cfg(not(feature = "prodash-render-tui"))]
92+ (true, true) | (false, true) => {
93+ unreachable!("BUG: This branch can't be run without a TUI built-in")
94+ }
95+ }
96+ }
97+
98+ #[cfg(not(feature = "small"))]
5599 pub fn prepare_and_run<T: Send + 'static>(
56100 name: &str,
57101 verbose: bool,
58102 progress: bool,
59103 #[cfg_attr(not(feature = "prodash-render-tui"), allow(unused_variables))] progress_keep_open: bool,
60− #[cfg_attr(not(feature = "prodash-render-line"), allow(unused_variables))] range: impl Into<Option<ProgressRange>>,
104+ range: impl Into<Option<ProgressRange>>,
61105 run: impl FnOnce(
62106 progress::DoOrDiscard<prodash::tree::Item>,
63107 &mut dyn std::io::Write,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t