1
0
mirror of https://github.com/o2sh/onefetch synced 2024-07-02 15:48:51 +00:00
Commit Graph

8 Commits

Author SHA1 Message Date
o2sh
2e48f9ea31
refacto pending info 2024-03-17 00:32:14 +01:00
Ossama Hjaji
1955153a9f
Added File Churn Metric (#1071)
* add churn metric

* add diff_count

* revert

* rename

* add churn cli flags

* fix integration test

* add unit tests

* try fix codeowners

* fix codeowners

* Optimize diff implementation

* delay conversion to String for filepaths to the last moment. That way, only the paths that
  are displayed will be converted in an operation that isn't free.
* change diff implementation to decode parents only once, instead of three times in the commmon case.
* setup an object cache in the `Repository` for faster traversals and much faster diffs.

* Don't fail on missing parent as we want to work in shallow repos, too

* Increase performance by decoding the commit only once

Previously, each time we would query commit information, the commit would
lazily be decoded until the point of interest under the hood.

Now we decode everything once, which is faster than what happened before.

Note that diffs are still causing the parents to be decoded even we *could*
pass them in, but it's not worth the complexity for just 100 commits
(the default value for churn).

* track changes on executable files

* remove for_each method

* use horizontal ellipsis

* review

* use MAIN_SEPERATOR when building path

* revert

* run expensive diffs in parallel and abort them once we run out of time.

That way, we could even use higher amounts of diffs if we wanted to, or could
warn if there was not enough time to reach the desired amount of diffs.

* Always calculate at least one diff for 'churn'

That way, there is always some data to work with.
This is important in case the repo is very small and the thread needs some time
to start-up and finish.

* improved readability + churn_pool_size CLI flag

The churn_pool_size allow the user to force onefetch to be deterministic
in the number of commits used to create the churn summary

* fix test

* halt if the churn pool size is bigger than the total number of commits

* improve readability

* add unit test

* refactor

* simplify `should_break()`

* update to latest `gix` version

* Avoid exhaustive memory consumption by sending the commit-id instead of its buffer.

The delta-processing happens by referring to a commit, and previously we could
send the whole commit buffer (which is expensive) as the overall amount of buffers
in flight would be bounded.

Now that the bound was removed, it's necessary to limit the costs of the commit,
and we do this by referring to it by id instead.

That way, on the linux kernel, we get these values for memory consumption:

* bounded: 960MB
* unbounded buffer: 2156
* unbounded id: 1033

---------

Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
2023-06-09 20:43:28 +02:00
o2sh
daf1aea04a cargo insta accept 2023-04-09 17:52:15 +02:00
Ossama Hjaji
4a3ef8c23d
Info struct to holds a Vec<InfoField> (#911)
* use vec of info fields

* update CODEOWNERS

* cargo sort

* address PR comment

* fix unit test
2022-12-30 21:23:38 +01:00
Spenser Black
fdb42e6040
Use ISO time for snapshot tests (#908)
Fixes tests failing after enough time has passed.

ref: https://github.com/o2sh/onefetch/pull/904#issuecomment-1365788241
2022-12-28 11:47:18 -05:00
Ossama Hjaji
3cff2d20bb
Add --number-separator CLI flag (#892)
* format-numbers cli flag

* only affect thousands seperator

* Rename enum NumberFormat -> ThousandsSeparator

* rename flag to number-separator

* fix serialization types

* don't serialize number_separator
2022-12-12 22:13:17 +01:00
Ossama Hjaji
ed96c4547d
Add manifest crate (#851)
* add manifest crate

* read deps and repo_name from manifest

* fix tests

* address some PR comments

* use Option<&T> instead of &Option<T>

* merge two functions in manifest crate

* read version from manifest

* revert last commit

* fallback to manifest for version

* avoid panicking when reading cargo.toml is workspace and not package

* rename manifest to onefetch-manifest and create workspace

* fix typo

* cargo clippy

* remove Cargo.lock from manifest

* break line after every 5 words in the description

* Update src/info/repo/description.rs

Co-authored-by: Spenser Black <spenserblack01@gmail.com>

* add fallback to manifest entry for license info line

* remove section in contributing.md about adding support for a package manager

* Update manifest/Cargo.toml

Co-authored-by: Spenser Black <spenserblack01@gmail.com>

* fix Cargo.toml

* add integration test for manifest (cargo)

* add integration test for manifest (npm)

* revert new line

* update screenshots

* update screenshots

* add unit test for long description

* add unit test to dependencies

* update manifest's readme

Co-authored-by: Spenser Black <spenserblack01@gmail.com>
2022-11-12 12:21:41 +01:00
o2sh
6b852c82fb move integration tests to separate folder 2022-10-29 23:21:41 +02:00