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
8pub struct Worktree<'repo> {8pub struct Worktree<'repo> {
9 pub(crate) parent: &'repo Repository,9 pub(crate) parent: &'repo Repository,
10 /// The root path of the checkout.10 /// The root path of the checkout.
11 #[allow(dead_code)]
11 pub(crate) path: &'repo std::path::Path,12 pub(crate) path: &'repo std::path::Path,
12}13}
13 14
gitoxide-core/src/repository/exclude.rs+2−2
@@ -16,8 +16,8 @@ pub mod query { · 15 unmodified lines
16 16
17pub fn query(17pub fn query(
18 repo: git::Repository,18 repo: git::Repository,
19 out: impl io::Write,19 _out: impl io::Write,
20 query::Options { format, pathspecs }: query::Options,20 query::Options { format, pathspecs: _ }: query::Options,
21) -> anyhow::Result<()> {21) -> anyhow::Result<()> {
22 if format != OutputFormat::Human {22 if format != OutputFormat::Human {
23 bail!("JSON output isn't implemented yet");23 bail!("JSON output isn't implemented yet");
src/plumbing/main.rs+18−9
@@ -157,7 +157,7 @@ pub fn main() -> Result<()> { · 156 unmodified lines
157 },157 },
158 Subcommands::Repository(repo::Platform { repository, cmd }) => {158 Subcommands::Repository(repo::Platform { repository, cmd }) => {
159 use git_repository as git;159 use git_repository as git;
160 let repository = git::open(repository)?.apply_environment();160 let repository = git::ThreadSafeRepository::open(repository)?;
161 match cmd {161 match cmd {
162 repo::Subcommands::Commit { cmd } => match cmd {162 repo::Subcommands::Commit { cmd } => match cmd {
163 repo::commit::Subcommands::Describe {163 repo::commit::Subcommands::Describe {
@@ -177,7 +177,7 @@ pub fn main() -> Result<()> { · 13 unmodified lines
177 None,177 None,
178 move |_progress, out, err| {178 move |_progress, out, err| {
179 core::repository::commit::describe(179 core::repository::commit::describe(
180 repository,180 repository.into(),
181 rev_spec.as_deref(),181 rev_spec.as_deref(),
182 out,182 out,
183 err,183 err,
@@ -203,7 +203,7 @@ pub fn main() -> Result<()> { · 19 unmodified lines
203 None,203 None,
204 move |_progress, out, _err| {204 move |_progress, out, _err| {
205 core::repository::exclude::query(205 core::repository::exclude::query(
206 repository,206 repository.into(),
207 out,207 out,
208 core::repository::exclude::query::Options { format, pathspecs },208 core::repository::exclude::query::Options { format, pathspecs },
209 )209 )
@@ -217,7 +217,9 @@ pub fn main() -> Result<()> { · 7 unmodified lines
217 progress,217 progress,
218 progress_keep_open,218 progress_keep_open,
219 None,219 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 },
221 ),223 ),
222 },224 },
223 repo::Subcommands::Odb { cmd } => match cmd {225 repo::Subcommands::Odb { cmd } => match cmd {
@@ -227,7 +229,7 @@ pub fn main() -> Result<()> { · 3 unmodified lines
227 progress,229 progress,
228 progress_keep_open,230 progress_keep_open,
229 None,231 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),
231 ),233 ),
232 repo::odb::Subcommands::Info => prepare_and_run(234 repo::odb::Subcommands::Info => prepare_and_run(
233 "repository-odb-info",235 "repository-odb-info",
@@ -235,7 +237,7 @@ pub fn main() -> Result<()> { · 1 unmodified line
235 progress,237 progress,
236 progress_keep_open,238 progress_keep_open,
237 None,239 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),
239 ),241 ),
240 },242 },
241 repo::Subcommands::Tree { cmd } => match cmd {243 repo::Subcommands::Tree { cmd } => match cmd {
@@ -251,7 +253,7 @@ pub fn main() -> Result<()> { · 9 unmodified lines
251 None,253 None,
252 move |_progress, out, _err| {254 move |_progress, out, _err| {
253 core::repository::tree::entries(255 core::repository::tree::entries(
254 repository,256 repository.into(),
255 treeish.as_deref(),257 treeish.as_deref(),
256 recursive,258 recursive,
257 extended,259 extended,
@@ -267,7 +269,14 @@ pub fn main() -> Result<()> { · 9 unmodified lines
267 progress_keep_open,269 progress_keep_open,
268 None,270 None,
269 move |_progress, out, err| {271 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 )
271 },280 },
272 ),281 ),
273 },282 },
@@ -287,7 +296,7 @@ pub fn main() -> Result<()> { · 13 unmodified lines
287 core::repository::verify::PROGRESS_RANGE,296 core::repository::verify::PROGRESS_RANGE,
288 move |progress, out, _err| {297 move |progress, out, _err| {
289 core::repository::verify::integrity(298 core::repository::verify::integrity(
290 repository,299 repository.into(),
291 out,300 out,
292 progress,301 progress,
293 &should_interrupt,302 &should_interrupt,
src/shared.rs+45−1
@@ -52,12 +52,56 @@ pub mod pretty { · 51 unmodified lines
52 52
53 use crate::shared::ProgressRange;53 use crate::shared::ProgressRange;
54 54
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"))]
55 pub fn prepare_and_run<T: Send + 'static>(99 pub fn prepare_and_run<T: Send + 'static>(
56 name: &str,100 name: &str,
57 verbose: bool,101 verbose: bool,
58 progress: bool,102 progress: bool,
59 #[cfg_attr(not(feature = "prodash-render-tui"), allow(unused_variables))] progress_keep_open: bool,103 #[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>>,
61 run: impl FnOnce(105 run: impl FnOnce(
62 progress::DoOrDiscard<prodash::tree::Item>,106 progress::DoOrDiscard<prodash::tree::Item>,
63 &mut dyn std::io::Write,107 &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