Commit Graph

62 Commits

Author SHA1 Message Date
renovate[bot] 6a604b4671 build(deps): update rust crate gix to 0.74.0 (#7061)
* build(deps): update rust crate gix to 0.74.0

* chore: fix for enum change

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2025-10-25 09:41:49 +02:00
Sergio Livi f42b53edd8 fix(git_status): Do not show up-to-date when untracked (#6755) 2025-08-17 16:51:34 +02:00
danieleades 3760f29560 style: pedantic refactoring (#6771)
---------

Co-authored-by: daniel.eades <daniel.eades@seebyte.com>
2025-08-17 16:51:04 +02:00
Dominic Slee 1c2f4d4659 perf(git_status): avoid gix index load when core.fsmonitor is used (#6817) 2025-07-13 19:53:53 +02:00
danieleades 3d2cf2a2fc style: use inline format args (clippy::uninlined_format_args) (#6734)
use inline format args (clippy::uninlined_format_args)

Co-authored-by: daniel.eades <daniel.eades@seebyte.com>
2025-06-22 15:39:22 +02:00
Sebastian Thiel daf8d93d27 perf: use gitoxide for git_status and git_metrics modules (#6476) 2025-04-26 22:43:41 +09:00
David Knaack 2a3ca68457 refactor: switch to rust 2024 edition & handle dependency updates (#6609) 2025-03-09 19:24:45 +01:00
David Knaack a5631a17dd refactor: bump msrv to remove once-cell, improve logger test & handle clippy warnings (#6315)
* refactor: replace `once_cell`-crate with stdlib

* test(logger): make log cleanup-test cross-platform

* chore: handle clippy warnings

* build(deps): update dependency dprint/dprint-plugin-toml to v0.6.3

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-17 16:03:22 +02:00
larswirzenius 6000231d12 chore: Minor changes to use more idiomatic Rust (integer max values; complicates nested expressions) (#6090)
* chore: use current way to get max value of an integer type

The std::usize::MAX way has been obsolete for quite some time now.
Found by clippy (clippy::legacy_numeric_constants).

Signed-off-by: Lars Wirzenius <liw@liw.fi>

* chore: use helper variable for a more idiomatic pattern matching

A nested expression can be harder to understand than two simpler
expressions. (Found by clippy lint clippy::blocks_in_conditions.)

Signed-off-by: Lars Wirzenius <liw@liw.fi>

---------

Signed-off-by: Lars Wirzenius <liw@liw.fi>
Co-authored-by: Lars Wirzenius <liw@liw.fi>
2024-07-24 21:06:40 +02:00
David Knaack 00d3dc86a2 fix(git_status): Avoid printing error on missing stash ref (#5434)
* fix(git_status): Avoid printing error on missing stash ref

* ensure we only proceed if the returned reference has the expected name
2023-12-16 16:58:45 +01:00
William Howard ac4a839103 perf(git_status): avoid running in bare repos (#5581)
* fix: git_status bare repo handling

* perform the git_status bare repo check earlier

* Adjusted test
2023-11-29 07:26:35 +01:00
David Knaack 03278e4de4 fix(git): prevent core.fsmonitor from executing external commands (#3981) 2023-07-31 21:44:31 +02:00
David Knaack 410f107c72 perf(git_status): query git stash count via gitoxide (#5238) 2023-07-11 11:26:50 +02:00
Dom Slee ce7f984932 fix(config): Make print-config not panic without a config (#5001) 2023-04-13 19:29:21 -05:00
Chad Denyar edb96cad58 feat: add typechange to git_status module (#4829)
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2023-04-13 21:02:08 +02:00
David Knaack 5e123fcbce chore: fix clippy warnings for rust 1.67 (#4855) 2023-01-27 18:33:24 +09:00
David Knaack 6e38683c89 chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
David Knaack 6ac5df904b refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
David Knaack ac55a01d0f feat(git): replace git2 with git-repository (#3883) 2022-08-08 22:33:00 -04:00
David Knaack d4d84a592c build: bump nix from 0.23.1 to 0.24.1 (#3925)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-26 09:14:51 -04:00
David Knaack ff490b67ad test(git): enable fsync for git operations (#3889)
* test(git): enable `fsync` for git operations

* add comment
2022-04-20 18:39:24 +01:00
David Knaack 2d4b183fce refactor: replace module_config_derive with serde (#3786)
* refactor: replace module_config_derive with serde

Changes include:
* Removing `starship_module_config_derive` and replacing it with `serde::Deserialize`
* Removing `RootModuleConfig::load_config`. While potentially useful, it was only used in tests. And it would require something like `serde::DeserializeSeed` which is not derived by serde.
* Merging `RootModuleConfig` into `ModuleConfig`
* Implementing a `ValueDeserializer` that holds a reference to a `toml::Value` in `serde_utils.rs`
* Deserialization errors (invalid type) are now logged and include the current key and the struct names
* Unknown keys are now considered an error. "Did you mean?"-messages are still possible

* fix typo

Co-authored-by: Matan Kushner <hello@matchai.dev>

Co-authored-by: Matan Kushner <hello@matchai.dev>
2022-03-26 10:42:19 +01:00
David Knaack d2366ddb9c perf(git_status): add option to use windows starship to render in wsl (#2146) 2022-03-06 21:18:23 -06:00
arcnmx a95332485b perf(git_status): tweak exec flags to omit unnecessary info (#3287)
* perf(git_status): tweak flags to omit extra info

`git status` can be prohibitively slow on some repos, so allow the
config to influence what flags are passed to git. For instance, if there
is no configured symbol for untracked files, tell git to omit them from
its output. This can easily result in a 2~10x speedup in many cases, but
requires the user to opt-in to hiding information from the prompt.

* docs(git_status): add ignore_submodules option
2021-12-30 15:12:53 -06:00
Fred Cox c1f2d345aa fix(escaping): move escaping to individual variables (#3107) 2021-11-01 22:18:45 +01:00
David Knaack 9d3ec93d82 refactor: allow passing OsStr as-is to exec_cmd (#2997) 2021-08-23 18:49:30 +02:00
Elia Geretto 2e9223dd8c fix(git_status): show working tree status if index status is present (#2973) 2021-08-18 19:55:40 +02:00
filip 3139c6b8a3 feat(git_status): dont render module output if not in git repository (#2897)
* refactor get_repo method to not swallow error

* module git status don't render if not in git repository
2021-08-14 15:19:43 +02:00
Bill b2e2330cb0 feat(git_status): added symbol for local repos up-to-date with remote. (#2945)
* git_status: added symbol for when local branch is up-to-date with upstream

* updated docs

* removed unused variable, moved location of config comment

* changed uptodate default to empty string, simplified and made safer

* added uptodate default line back into docstring

* fixed linting and formatting errors

* refactored uptodate to up_to_date, removed redundant else statement
2021-08-07 19:22:00 +02:00
David Knaack af43aeefba fix(clippy): fix new clippy lints (#2939) 2021-07-29 14:27:46 -04:00
David Knaack 1eaf996a36 fix(windows): avoid inadvertly running exes from cwd (#2885)
On Windows when running commands with their name instead of the path with Command::new, executable with that name from the current working directory will be executed.

This PR replaces all instances of Command::new with a new create_command function which will first resolve any executable paths and avoid this issue.
2021-07-16 15:20:59 -04:00
Thomas O'Donnell 9e2da88d95 fix(git_status): Fix when the worktree != root dir (#2831)
Have updated the git_status module to work if the worktree has been
changed to a different directory than the repository root directory.
2021-07-05 17:19:09 -04:00
John Breen 45bb13047d fix(git_status): Show git add -N files as unstaged (#2702) 2021-05-07 19:31:18 -04:00
David Knaack ba40ad5ce6 chore(clippy): fix new lints (#2507) 2021-03-25 16:03:19 -04:00
Zachary Dodge 0a091bd236 perf(git_status): replace git2 in git status module with git cli (#2465) 2021-03-23 12:45:27 -04:00
David Knaack 04d1332f9c refactor(clippy): fix new lints (#2297) 2021-02-11 21:08:17 +01:00
David Knaack b2e8252785 refactor(git_status): simplify git status with once-cell (#2150)
I simplified the code in the git status module by moving everything from RwLock<_> to OnceCell<_>. I think this should also get rid of any remaining race conditions that remained after #1777.
2021-01-24 15:19:22 -05:00
SarthakSingh31 a73d7140eb perf(git_status): Improved git_status module performance (#1777) 2020-10-14 12:12:41 -04:00
Logan Magee 2693d125a8 fix: Pass --no-gpg-sign to git commit in tests (#1718)
Some users have commit.gpgSign set to true in their global git config,
causing tests which run `git commit` to fail if the configured
user.signingKey is not present (as is often the case with PGP smart
cards). Passing this flag overrides the global git configuration,
preventing git from attempting sign the specified commit. This change
has no effect on users who haven't set commit.gpgSign to true.
2020-10-03 12:22:19 +02:00
Tilmann Meyer 2233683410 feat: add error messaging (#1576)
This creates a custom logger for the log crate which logs everything to a file (/tmp/starship/session_$STARSHIP_SESSION_KEY.log) and it logs everything above Warn to stderr, but only if the log file does not contain the line that should be logged resulting in an error or warning to be only logged at the first starship invocation after opening the shell.
2020-09-28 16:38:50 -04:00
Tilmann Meyer 88b603be38 test: introduce env variable mocking (#1490) 2020-08-07 15:13:12 -04:00
Alexey Chernyshov 08b74c1672 fix(git_status): Fix file rename inconsistency compared to git (#1411)
* Remove renames_index_to_workdir() option from git status

This option causes advanced files rename detection which causes inconsistency between `git status` and Starship reports.
Closes #1371

* add test for manually remaned and deleted files in git_state module

* fix tests
2020-07-14 23:08:56 +02:00
Zhenhui Xie ec76fafff0 feat: refactor modules to use format strings (#1374) 2020-07-07 18:45:32 -04:00
Thomas O'Donnell 391add767f revert: fix(git_branch,git_status): implement fallback branch_n… (#1092)
This reverts commit 8d90baf0eb.
2020-04-11 16:10:39 -04:00
Hendrik Rombach 8d90baf0eb fix: implement fallback branch_name for bare git repos (#1035)
closes #686
2020-04-07 12:01:40 +02:00
Onielfa ddd8cfb388 perf: refactor git status to use HashMap for counts (#938) 2020-02-14 20:38:25 -05:00
marblenix b82ff321fa feat(git_status): Add a stash count segment (#598) 2019-12-28 22:20:36 -05:00
Brian Low 2710d02709 feat: Show git_status counts (#434)
The git_status module can show the count of files next to their respective symbols.
2019-10-26 15:20:20 +09:00
Matan Kushner 05210b9510 refactor: Go from Rust workspaces to a package with nested packages (#480) 2019-10-04 22:30:46 +09:00
Zhenhui Xie dd0b1a1aa2 refactor: Refactoring config (#383)
This PR refactors config and puts configuration files for all modules in `configs/`.
2019-09-30 21:10:35 +09:00