Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump all dependencies #209

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
673 changes: 395 additions & 278 deletions Cargo.lock

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,23 @@ required-features = ["build-man"]
build-man = ["man"]

[build-dependencies]
vergen = "7.4.4"
vergen = { version = "8.0.0", features = ["build", "cargo", "git", "gitcl"] }
anyhow = "1.0.86"

[dependencies]
dialoguer = "0.10.2"
env_logger = "0.10.0"
git2 = "0.15.0"
log = "0.4.17"
dialoguer = "0.11.0"
env_logger = "0.11.3"
git2 = "0.18.3"
log = "0.4.21"
paw = "1.0.0"
clap = { version = "4.0.27", features = ["derive"] }
anyhow = "1.0.66"
rayon = "1.6.0"
thiserror = "1.0.37"
crossbeam-channel = "0.5.6"
textwrap = { version = "0.16.0", features = ["terminal_size"] }
clap = { version = "4.5.4", features = ["derive"] }
anyhow = "1.0.86"
rayon = "1.10.0"
thiserror = "1.0.61"
crossbeam-channel = "0.5.13"
textwrap = { version = "0.16.1", features = ["terminal_size"] }

man = { version = "0.3.0", optional = true }

[dev-dependencies]
tempfile = "3.3.0"
tempfile = "3.10.1"
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ You might need to install `libssl-dev` and `pkg-config` packages if you build fr

#### Are you using git-flow?

Don't forget to `git config trim.bases develop,master`.
Don't forget to `git config trim.bases develop,main`.

## Why have you made this? Show me how it works.

Expand All @@ -46,7 +46,7 @@ After some working with the repository, you'll execute `git fetch --prune` or `g
However, you'll likely see the mess of local branches whose upstreams are already merged and deleted on the remote.
Because `git fetch --prune` only deletes remote-tracking branches (or remote references, `refs/remotes/<remote>/<branch>`) but not local tracking branches (`refs/heads/<branch>`) for you.
It is worse if remote branches that are merged but the maintainer forgot to delete them,
the remote-tracking branches would not be deleted and so on even if you know that it is merged into the master.
the remote-tracking branches would not be deleted and so on even if you know that it is merged into the main.

![before](images/0-before.png)

Expand Down Expand Up @@ -111,7 +111,7 @@ Not because `--force` is dangerous. Just `gone` doesn't mean it is fully merged

* It inspects the upstream of tracking branches whether they are 'fully' merged, not just whether they are gone.
I've spent about half of the code on scenario tests. I wanted to make sure that it doesn't delete unmerged contents accidentally in any case.
* It supports github flow (master-feature tiered branch strategy), git flow (master-develop-feature tiered branch strategy),
* It supports github flow (main-feature tiered branch strategy), git flow (main-develop-feature tiered branch strategy),
and simple workflow (with a remote repo and a local clone), and triangular workflow (with two remote repos and a local clone).
* It is merge styles agnostic. It can detect common merge styles such as merge with a merge commit, rebase/ff merge and squash merge.
* It can also inspect remote branches so it deletes them from remotes for you in case you've forgotten to.
Expand All @@ -136,12 +136,12 @@ The term is borrowed from the git's remote tracking states.

### I'm even more lazy to type `git trim`

Try this `post-merge` hook. It automatically calls `git trim --no-update` everytime you `git pull` on `master` or `develop`. `git config fetch.prune true` is recommended with this hook.
Try this `post-merge` hook. It automatically calls `git trim --no-update` everytime you `git pull` on `main` or `develop`. `git config fetch.prune true` is recommended with this hook.
```shell
#!/bin/bash
BRANCH=$(git rev-parse --abbrev-ref HEAD)
case "$HEAD_BRANCH" in
"master"|"develop") ;;
"main"|"develop") ;;
*) exit ;;
esac

Expand Down
15 changes: 9 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use vergen::{vergen, Config};
use anyhow::Context;
use vergen::EmitBuilder;

fn main() {
// Generate the 'cargo:' key output
let mut config = Config::default();
*config.git_mut().skip_if_error_mut() = true;
vergen(config).expect("Unable to generate the cargo keys!");
fn main() -> anyhow::Result<()> {
EmitBuilder::builder()
.all_build()
.all_cargo()
.all_git()
.emit()
.context("Unable to generate the cargo keys!")
}
15 changes: 6 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ fn main() -> Result<()> {
let args = Args::parse();

env_logger::init();
info!("SEMVER: {}", env!("VERGEN_BUILD_SEMVER"));
info!("SHA: {:?}", option_env!("VERGEN_GIT_SHA"));
info!(
"COMMIT_DATE: {:?}",
option_env!("VERGEN_GIT_COMMIT_TIMESTAMP")
);
info!("SEMVER: {}", env!("VERGEN_GIT_DESCRIBE"));
info!("SHA: {:?}", env!("VERGEN_GIT_SHA"));
info!("COMMIT_DATE: {:?}", env!("VERGEN_GIT_COMMIT_TIMESTAMP"));
info!("TARGET_TRIPLE: {}", env!("VERGEN_CARGO_TARGET_TRIPLE"));

let git = Git::try_from(Repository::open_from_env()?)?;
Expand Down Expand Up @@ -104,9 +101,9 @@ fn error_no_bases(repo: &Repository, bases: &ConfigValue<HashSet<String>>) -> Re
}
}
const GENERAL_HELP: &[&str] = &[
"`git config trim.bases develop,master` for a repository.",
"`git config --global trim.bases develop,master` to set globally.",
"`git trim --bases develop,master` to set temporarily.",
"`git config trim.bases develop,main` for a repository.",
"`git config --global trim.bases develop,main` to set globally.",
"`git trim --bases develop,main` to set temporarily.",
];
match bases {
ConfigValue::Explicit(_) => {
Expand Down
6 changes: 3 additions & 3 deletions src/remote_head_change_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ impl RemoteHeadChangeChecker {
}
eprintln!(
r#"Or you can set base branches manually:
* `git config trim.bases develop,master` will set base branches for git-trim for a repository.
* `git config --global trim.bases develop,master` will set base branches for `git-trim` globally.
* `git trim --bases develop,master` will temporarily set base branches for `git-trim`"#
* `git config trim.bases develop,main` will set base branches for git-trim for a repository.
* `git config --global trim.bases develop,main` will set base branches for `git-trim` globally.
* `git trim --bases develop,main` will temporarily set base branches for `git-trim`"#
);

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion tests/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn test_bases_implicit_value() -> Result<()> {

assert_eq!(
config.bases,
ConfigValue::Implicit(HashSet::from_iter(vec!["master".to_owned()]))
ConfigValue::Implicit(HashSet::from_iter(vec!["main".to_owned()]))
);
Ok(())
}
Expand Down
10 changes: 5 additions & 5 deletions tests/filter_accidential_track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn fixture() -> Fixture {
echo "Hello World!" > README.md
git add README.md
git commit -m "Initial commit"
git push -u origin master
git push -u origin main
EOF

git clone origin contributer
Expand Down Expand Up @@ -75,9 +75,9 @@ fn test_default_config_tries_to_delete_accidential_track() -> Result<()> {
local <<EOF
git checkout --track contributer/feature

git checkout master
git checkout main
git merge feature --no-ff
git push -u origin master
git push -u origin main
EOF
"#,
)?;
Expand Down Expand Up @@ -112,9 +112,9 @@ fn test_accidential_track() -> Result<()> {
local <<EOF
git checkout --track contributer/feature

git checkout master
git checkout main
git merge feature --no-ff
git push -u origin master
git push -u origin main
EOF
"#,
)?;
Expand Down
2 changes: 1 addition & 1 deletion tests/fixture/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ macro_rules! set {
pub fn test_default_param() -> PlanParam<'static> {
use DeleteRange::*;
PlanParam {
bases: vec!["master"],
bases: vec!["main"],
protected_patterns: Vec::new(),
delete: DeleteFilter::from_iter(vec![
MergedLocal,
Expand Down
8 changes: 4 additions & 4 deletions tests/hub_cli_checkout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn fixture() -> Fixture {
git config push.default simple
git remote add upstream ../upstream
git fetch upstream
git branch -u upstream/master master
git branch -u upstream/main main
EOF
origin <<EOF
git checkout -b feature
Expand Down Expand Up @@ -81,7 +81,7 @@ fn test_accepted() -> Result<()> {
EOF
# clicked delete branch button
origin <<EOF
git checkout master
git checkout main
git branch -D feature
EOF
"#,
Expand Down Expand Up @@ -152,7 +152,7 @@ fn test_modified_and_accepted() -> Result<()> {
EOF
# click delete button
origin <<EOF
git checkout master
git checkout main
git branch -D feature
EOF
"#,
Expand Down Expand Up @@ -220,7 +220,7 @@ fn test_rejected() -> Result<()> {
EOF
# clicked delete branch button
origin <<EOF
git checkout master
git checkout main
git branch -D feature
EOF
"#,
Expand Down
22 changes: 11 additions & 11 deletions tests/merge_styles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn test_noff() -> Result<()> {
"local",
r#"
origin <<EOF
git checkout master
git checkout main
git merge feature --no-ff
git branch -D feature
EOF
Expand All @@ -73,8 +73,8 @@ fn test_rebase() -> Result<()> {
r#"
origin <<EOF
git checkout -b rebase-tmp feature
git rebase master
git checkout master
git rebase main
git checkout main
git merge rebase-tmp --ff-only
git branch -D rebase-tmp feature
EOF
Expand All @@ -98,7 +98,7 @@ fn test_squash() -> Result<()> {
"local",
r#"
origin <<EOF
git checkout master
git checkout main
git merge feature --squash && git commit --no-edit
git branch -D feature
EOF
Expand Down Expand Up @@ -149,9 +149,9 @@ fn test_mixed() -> Result<()> {
git push -u origin "$NAME"
}
local <<EOF
mk_test_branches master rebaseme 3
mk_test_branches master squashme 3
mk_test_branches master noffme 3
mk_test_branches main rebaseme 3
mk_test_branches main squashme 3
mk_test_branches main noffme 3
EOF
"#,
);
Expand All @@ -160,19 +160,19 @@ fn test_mixed() -> Result<()> {
r#"
origin <<EOF
# squash
git checkout master
git checkout main
git merge squashme --squash && git commit --no-edit
git branch -D squashme

# rebaseme
git checkout -b rebase-tmp rebaseme
git rebase master
git checkout master
git rebase main
git checkout main
git merge rebase-tmp --ff-only
git branch -D rebase-tmp rebaseme

# noff
git checkout master
git checkout main
git merge noffme --no-ff
git branch -D noffme
EOF
Expand Down
6 changes: 3 additions & 3 deletions tests/non_trackings_non_upstreams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn test_merged_non_tracking() -> Result<()> {
"local",
r#"
origin <<EOF
git checkout master
git checkout main
git merge feature
git branch -d feature
EOF
Expand All @@ -90,10 +90,10 @@ fn test_merged_non_upstream() -> Result<()> {
git config core.bare true
EOF
local <<EOF
git checkout master
git checkout main
git merge feature
git branch -D feature
git push origin master
git push origin main
EOF
"#,
)?;
Expand Down
Loading
Loading