Git Product home page Git Product logo

git-trim's People

Contributors

cbenoit avatar dpetersen avatar foriequal0 avatar majecty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

git-trim's Issues

Reference not found

When running, git trim --dry-run --no-update, on my company's main repo git-trim shows the error:

Error: Error { code: -3, klass: 4, message: "reference \'refs/remotes/origin/wezm/abort-on-panic\' not found" }

Not sure what other debugging information is useful, but happy to get anything you need.

Filter remotes

first of all, thanks for the nice utility! :)

I often use multiple remotes when maintaining open source projects, one for each contributor. git trim apparently looks at all the remotes when figuring out which remote branches to delete. unfortunately, that leads to read-only remote branches being flagged for removal, which fails and then also does not delete the local branches either.

would it be possible to add a filter on the remote names that git trim is supposed to analyze and clean up? 🙏

Unhelpful error message when push.default = matching

Hello,

I get the following error message when running git trim:
thread '<unnamed>' panicked at 'not yet implemented: push.default=nothing|matching is not implemented.', src/remote_ref.rs:132:13

I guess it happens because my push.default is matching, but it would be better to have a nice message rather than a thread panic :)

Create a man page

Man page is a standard way to find a tool's usage.
Git shows a man page if user execute git <subcommand> --help.

Unfortunately, we can't install the man page when a user uses cargo install git-trim command.
If we provide a deb or rpm package file, however, we can distribute the man page with a binary.

git trim doesn't delete a deleted branch on github

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. merge PR on github and remove that branch
  2. run git trim

Expected behavior
remind me the branch on remote is deleted, ask me if delete it in local.

Actual behaviour
only show local branches: and remote references:

Additional context and logs & dumps
You should remove sensitive informations before put them here.

  • Arch linux
  • 0.3.0
  • git rev-parse --abbrev-ref HEAD master
  • git show-ref
6c6aba623be17d1cbf637c837c4f901bc9e89788 refs/heads/custom-connector
ec7f2041392a9bc82943cc6897e8f4d18761ee25 refs/heads/master
df43f07e84eadcaeb451518718697ca6332bcf69 refs/heads/mount.rfs
32ff3644e9c5e6650f1fb801866a07bf3ed1383a refs/heads/remove-tokio-runtime
40882474879687bc5a680bd229c81279a91ddca2 refs/heads/retry-middleware
6c6aba623be17d1cbf637c837c4f901bc9e89788 refs/remotes/origin/custom-connector
ec7f2041392a9bc82943cc6897e8f4d18761ee25 refs/remotes/origin/master
32ff3644e9c5e6650f1fb801866a07bf3ed1383a refs/remotes/origin/remove-tokio-runtime
9b115e534261b52be3fc99fcc9fb2f6e6f335372 refs/stash
da371a7f1e9805cb7f9fb1620c48585d97f71237 refs/tags/0.1.0
  • git config --get-regexp '(push|fetch|remote|branch|trim).*' | sort
branch.custom-connector.merge refs/heads/custom-connector
branch.custom-connector.remote origin
branch.master.merge refs/heads/master
branch.master.remote origin
branch.mount.rfs.merge refs/heads/mount.rfs
branch.mount.rfs.remote origin
branch.remove-tokio-runtime.merge refs/heads/remove-tokio-runtime
branch.remove-tokio-runtime.remote origin
remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
remote.origin.url [email protected]:Sherlock-Holo/rfs.git

Logs and stacktraces

正在获取 origin

Branches that will remain:
  local branches:
    master
    mount.rfs
    custom-connector
    remove-tokio-runtime
    retry-middleware
  remote references:
    refs/remotes/origin/master
    refs/remotes/origin/custom-connector
    refs/remotes/origin/remove-tokio-runtime

[Security] Workflow build.yaml is using vulnerable action actions/checkout

The workflow build.yaml is referencing action actions/checkout using references v1. However this reference is missing the commit a6747255bd19d7a757dbdda8c654a9f84db19839 which may contain fix to the some vulnerability.
The vulnerability fix that is missing by actions version could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider to update the reference to the action.

Does not work on MacOS when homebrew is not installed in the default location

Check your version before submitting the bug

I downloaded the latest version from github releases.

$ git-trim
dyld: Library not loaded: /usr/local/opt/[email protected]/lib/libssl.1.1.dylib
  Referenced from: /Users/USER/.zinit/plugins/foriequal0---git-trim/git-trim/git-trim
  Reason: image not found
zsh: abort      git-trim --version

Describe the bug

git-trim appears to require libssl in /usr/local/opt. This appears to be a homebrew dependency. On MacOS, homebrew may be installed in any location, and may not be in /usr/local/opt (although this is the most likely location).

Resolution

For MacOS, you can change the location of libraries.

Use otool -L git-trim to find locations of all dependencies.

$ otool -L ~/.zinit/plugins/foriequal0---git-trim/git-trim/git-trim
/Users/USER/.zinit/plugins/foriequal0---git-trim/git-trim/git-trim:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 59306.140.5)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1677.104.0)
	/usr/local/opt/[email protected]/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	/usr/local/opt/[email protected]/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)

Use install_name_tool -change old new to change paths. I believe the recommendation is to use @rpath to change them, but that didn't work for me. I instead used brew --prefix and used the full path from there.

$ install_name_tool -change /usr/local/opt/[email protected]/lib/libssl.1.1.dylib $(brew --prefix)/opt/[email protected]/lib/libssl.1.1.dylib ~/.zinit/plugins/foriequal0---git-trim/git-trim/git-trim
$ install_name_tool -change /usr/local/opt/[email protected]/lib/libcrypto.1.1.dylib $(brew --prefix)/opt/[email protected]/lib/libcrypto.1.1.dylib ~/.zinit/plugins/foriequal0---git-trim/git-trim/git-trim

Crash on confirmation prompt

Describe the bug
It crashes right after asking Confirm? [y/N]

To Reproduce
git trim on git-bash or mintty

Expected behavior
It asks confirmation and wait for the input.

Actual behaviour
It crashes.

Additional context and logs & dumps

  • Windows 10, git-bash
  • git-trim 0.2.3
------>8------
Delete merged local branches:
  - asdf
Delete merged remote refs:
  - refs/remotes/origin/asdf
Confirm? [y/N] Error: Os { code: 1, kind: Other, message: "잘못된 기능입니다." }

Let `git` inherit stdin

Releated issue:
#55 (comment)
#59

Sometimes git prompts to ask a password. We need a way to user to put the password directly to the git although it is not a recommended way wince we call git internally many times (ssh-add is recommended).

--help output is hard to read on narrow (<120 char) terminal windows

Check your version before submitting the bug

❯ git-trim --version
git-trim 0.4.2

Describe the bug
git-trim --help output is hard to read on a terminal window less than 120 characters in width. This mostly concerns the "OPTIONS" section which seems to assume a terminal width of 120 characters.

To Reproduce

  1. Shrink terminal window to <120 characters, the smaller the worse
  2. git-trim --help

Expected behavior
Help output should be readable at terminal widths down to 80 characters, which I believe is a more standard "minimum" terminal width than 120.

Actual behaviour
--help output has line breaks that make it hard to read. Example, with width of 100 characters:

Screen Shot 2021-06-02 at 10 28 31 AM

Hide "Branches that will remain" section

I have a few projects where the "Branches that will remain" section has so many entries that I have to scroll up to see the list of branche that will be removed. It would be great to either swap the order of these sections, or to add an option to hide the list of remaining branches. :)

Add licence file

This looks like a super handy tool, thanks for building it. The Cargo.toml indicates that the license is MIT. However, the MIT license includes the clause:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

In order to comply with this I need a copyright notice to include. Specifically I've added an AUR package for git-trim and to comply with the license, I need a license to copy. 😀

[Security] Workflow build.yaml is using vulnerable action actions/checkout

The workflow build.yaml is referencing action actions/checkout using references v1. However this reference is missing the commit a6747255bd19d7a757dbdda8c654a9f84db19839 which may contain fix to the some vulnerability.
The vulnerability fix that is missing by actions version could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider to update the reference to the action.

git-trim 0.2.5 brew formula upgrade issue

relates to Homebrew/homebrew-core#51999

15:54:49    Compiling git2 v0.10.2
15:54:49 error[E0658]: use of unstable library feature 'matches_macro'
15:54:49   --> src/simple_glob.rs:22:12
15:54:49    |
15:54:49 22 |         if matches!(
15:54:49    |            ^^^^^^^
15:54:49    |
15:54:49    = note: for more information, see https://github.com/rust-lang/rust/issues/65721
15:54:49 
15:54:49 error: aborting due to previous error

Valid .gitconfig is rejected and prevent usage of the tool

Check your version before submitting the bug

> git trim --version
git-trim 0.4.2

Describe the bug

Valid .gitconfig is rejected.

To Reproduce

  1. Put this in your .gitconfig (source: delta)
    [delta "zebra-dark"]
        map-styles = \
           bold purple => syntax "#380233", \
           bold blue => syntax "#1b0738", \
           bold cyan => syntax "#00302b", \
           bold yellow => syntax "#222f14"
    
  2. Run git trim

Expected behavior

Just works ™️

Actual behaviour

Error: failed to parse config file: invalid configuration key (in /home/[redacted]/.gitconfig:5); class=Config (7)

Additional context and logs & dumps if necessary

> uname -srm
Linux 5.16.15-1-default x86_64

Linux distribution: openSUSE Tumbleweed.

Do not delete the checked-out branch (also don't delete master/main).

Check your version before submitting the bug
git-trim is still 0.x version and I do make a lot of silly bugs.
Some bugs might be fixed on upstream version. Please update it and make sure that you're using the upstream version
especially you've installed git-trim other than cargo install such as Homebrew or AUR.

Describe the bug
It seems to have issues with having an 'upstream' and an 'origin' remote (as created by gh pr create). After my PR got merged, git-trim determined that the master branch could be deleted.

To Reproduce

  1. Minimal reproducible git repo if available:
    upstream: foriequal0/git-trim, origin: foriequal0/git-trim
  2. CLI command and configs
    See below. Just 'git trim'
  3. Steps to reproduce the behavior

Run git-trim in this very repo, while having "master" checked out. However master tracks my forked repo and my PR got merged. Hence, there's no need for the master-branch exactly anymore.

Expected behavior
Git-trim should not try to remove the master branch.

Actual behaviour

git-trim tries to delete the master branch. Git refuses because the branch is currently checked out. And git-trim exits with an error.

If applicable, add logs and stacktraces to help explain your problem.

Additional context and logs & dumps if necessary
You should remove sensitive informations before put them here.

  • OS: Ubuntu 18.04
  • Version:
  • git rev-parse --abbrev-ref HEAD: master
  • git show-ref (see below)
  • git config --get-regexp '(push|fetch|remote|branch|trim).*' | sort
branch.master.merge refs/heads/master
branch.master.remote origin
remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
remote.origin.url https://[email protected]/siedentop/git-trim.git
remote.upstream.fetch +refs/heads/*:refs/remotes/upstream/*
remote.upstream.gh-resolved base
remote.upstream.url https://github.com/foriequal0/git-trim.git

Logs and stacktraces if necessary
You should remove sensitive informations before put them here.
You can get more detailed and clean logs by setting some environment variable with follwing command

export RUST_LOG=trace
export RAYON_NUM_THREADS=1
export RUST_BACKTRACE=full
git trim --no-confirm 2>&1 | tee <log_file>

--> Attached
git-trim-bug.log

git show-ref:

148f55753db6052755b451f63a0e710bc53ca5cc refs/heads/master
148f55753db6052755b451f63a0e710bc53ca5cc refs/remotes/origin/master
385d8818e3b8db9a73b0f32993f53d1ba0d31386 refs/remotes/upstream/HEAD
385d8818e3b8db9a73b0f32993f53d1ba0d31386 refs/remotes/upstream/master
97a7bad4cadb3c6f0894a574f313c8732819ec89 refs/tags/v0.1.0
4e05e2478cd5a210728f840497ec14ba492792df refs/tags/v0.1.1
251751283e579b8bf10f6853772fdc3d432b858b refs/tags/v0.1.2
ee6ab9212a5d425d17890bb412a58eaae2c43516 refs/tags/v0.1.3
327fdc706d7ebc2d276db1d101c62259788f0b3d refs/tags/v0.1.4
d516cc7a32ff6a4b2e02edbfe8a1c3fd04173852 refs/tags/v0.1.5
29cb02632501c774e7151547509bf1ff016f3b0a refs/tags/v0.2.0
f711e1b9b48fb490f75ccea3b39f57984339df15 refs/tags/v0.2.1
68d3d506dc3b394b563277ac2c471cc9a7aa0cc6 refs/tags/v0.2.2
e425a9f67fa357be44f3e901183c4156298af9b3 refs/tags/v0.2.3
331f74d4adb64e01ddad950ecfd9bc62aab4571e refs/tags/v0.2.4
50d06cf4985577da7c51e93e486ee912fd9c308f refs/tags/v0.2.5
b066877b1a913648a53fce2ab745c396bb1c3298 refs/tags/v0.3.0
0612c818337bcd3ad99f23580d7d230ba58e1f3d refs/tags/v0.3.1
bba3d0967fd4f785e7c5c7e64b537dd31bb1a543 refs/tags/v0.3.2
17d975773913fa0261fe8df5c56563af49cfef85 refs/tags/v0.4.0
4ab4cad8994d3c3c0c0a258c7cd44740cd7b78f2 refs/tags/v0.4.0-alpha.1
761f81046c7843bb8ac0e985c910e1a2998da31e refs/tags/v0.4.0-alpha.2
9b5e2c6e28482bc8a9390b456c5cf2a53262b4be refs/tags/v0.4.0-alpha.3
61b60c6d6c5cf83a5a10043cae6c37d27d076efc refs/tags/v0.4.0-alpha.4
58d3ee9ddbd23edd85756b4718e7cdd8b026882b refs/tags/v0.4.1
eb9dcc574e6d90140c98ea36a30f5b594162e392 refs/tags/v0.4.2

Distribute binaries as NPM package

I would be nice if you could distribute the release binaries as an NPM package. So people could simply run npm install git-trim/yarn add git-trim to get up and running instantly.

It would allow a team to easily install git-trim, integrate it with a typicode/husky git hook, commit that logic to git, and distribute that logic to the rest of the teams build system. No worries about where to download the release, having to keep the binary up to date by manually checking and notifying team members, adding logic in the hook for a missing binary, etc...

Rename gone -> stray

gone is coined after git's gone branch. It was the start of the git-trim. However, gone is not gone anymore. It is more subtle to call it gone.
I propose to rename them to stray.

I wanted them to be conceived as not safe to delete. stray is the opposite of merged. It is not merged, not safe to delete, but it exists out there. It needs extra care.

Support git-flow

We only have test cases for github-flow. However, on some git branch management strategy, there are long-running branches that are constantly merged into another branch. For example, git-flow's develop branch will be classified as 'merged but not deleted' in the current verision. This will be very annoying.

TODO:

  • can specify multiple base branches (e,g. base=master,develop)
  • can specify a pattern of branches that shouldn't be removed. (e,g. protected=release-*,docker)

Feature Request - ignore some branches

Hello (again),

I'm working on a project consisting in a fork of another project. Our master branch is the one from the original repository we forked - we merge master with our own development branch from time to time to make sure we have the latest development of their end.

It is possible to set another branch as a base with the -b option - however, when setting our development branch as base, the --dry-run indicates that the master branch would be deleted (since it has been merged with our development branch). It is important for us to keep this master branch intact.

Could it be possible in the future to provide an option telling git-trim to ignore certain branches? So that, in our specific use case, the master branch would be preserved

Thanks for this project !

git-trim is too verbose about remote references

Check your version before submitting the bug

$ git trim --version
git-trim 0.4.2

Describe the bug

When you work in a repository with many other collaborators, the git-trim output looks like this:

Branches that will remain:
  local branches:
    foo # here are my branches I'm interested in
    bar
  remote references:
    origin/blabla1 # here is a huge list of remote branches from all collaborators
    origin/blabla2

The list of remote references is so long that the "local branches" part is actually not visible unless I scroll up. However, in this kind of repositories, I'm only interested in removing my own branches, and not in all remote ones.

To Reproduce

  1. Clone any repository with multiple branches
  2. git trim --delete merged-local,local

Expected behavior
Remote references are not listed.

Actual behaviour
Remote references are listed, although I explicitly specified that I have no intention to clean them up.

Bring back comma separated git config entries

I accidentely broke comma separated git config entry parser.

[trim]
    protected = release-*
    protected = master,develop

should be treated as trim.protected = {"release-*", "master", "develop" }

Feature Request: Delete remote merged branches

Hey,

I started to use git-trim to cleanup my local git repositories and replaced my one line script with it. I work for a company where we use Bitbucket and developers work on many different projects over time.

By default Bitbucket does not delete the branches of merged pull requests which results in many branches on the Bitbucket server nobody needs anymore. Among the merged branches there are some that were not yet merged or have commits that were not yet merged to the master branch. Sometimes these commits are irrelevant, but sometimes they commit review feedback that was forgotten. Unfortunately the Bitbucket UI incapable of filtering branches based on a branch state like 'merged'.

I think it helps to get rid of merged branches because they do not contain additional information and instead clutter the list of branches. Instead it would be nice to have a list of branches that need attention. As of now I use a one liner to delete remote branches which suffers from the same problems as the one to cleanup local branches
git branch -r --merged | egrep -v '(master|release)' | sed 's|origin/||g' | xargs -n 1 git push --delete origin

Is this something that would fit the use cases of git-trim?

cheers & thanks
Marco

entered unreachable code: matching refspec is not found

Describe the bug

See logs at bottom

To Reproduce

Repo: LibPQ.git.tar.gz
git trim --dry-run or git trim

Expected behavior

Not crashing

Actual behaviour

See error at bottom

Additional context and logs & dumps
You should remove sensitive informations before put them here.

  • OS: macOS 10.14.6
  • Version: git-trim 0.2.4
  • git rev-parse --abbrev-ref HEAD: master
  • git show-ref:
ac873429bf7e2c47de52c9a0d69f739815fdd836 refs/heads/master
11f3cee3e24af1265b6c1b9826a25dfafc9a6342 refs/remotes/cache/heads/binaryprovider
2e796c1c9d8b6cfcbe79a4389c7a3e8e613b8d60 refs/remotes/cache/heads/gh-pages
defa092437d819d02d121bbab993902a20bcc845 refs/remotes/cache/heads/master
b92f54203ec0cbaceeb25d55862e76f9fe6b6c5e refs/remotes/cache/heads/memento
02fa3fbe11a81c94e615ddf2b9fd76c41cbde104 refs/remotes/cache/heads/multi-postgresql
6d77710f94144fee4863838825f1d098dba0aeca refs/remotes/cache/pull/1/head
5e011a2a97d6122012a0db4069a1fb3efaab8181 refs/remotes/cache/pull/1/merge
eb015a9cdb5bdb4c0964972636df9e47caeb1144 refs/remotes/cache/pull/14/head
294c9ffa22d7a610799361fc32f1ac7c06038672 refs/remotes/cache/pull/15/head
b92f54203ec0cbaceeb25d55862e76f9fe6b6c5e refs/remotes/cache/pull/16/head
5d74466fac0186e9d27325efe85bc59ac01297c8 refs/remotes/cache/pull/17/head
809887f2ece2157864c10d0d6da024f9582abd64 refs/remotes/cache/pull/18/head
7cfb035f1859c30f18a707f9778948c17b92bf8c refs/remotes/cache/pull/19/head
fb7671a889ba9834a35cbfd98bca2eae735526f0 refs/remotes/cache/pull/2/head
e5d076e3b34f950227eb38fa9d8065a462804a01 refs/remotes/cache/pull/2/merge
f06eaf7b37b30fa7f518fc7b5fa5b0d7e7bad2fb refs/remotes/cache/pull/20/head
02fa3fbe11a81c94e615ddf2b9fd76c41cbde104 refs/remotes/cache/pull/22/head
987375c566b45ac704347fe2f466000ea6308489 refs/remotes/cache/pull/24/head
32e572869ba5438f865cfe03f835a55ac791c85e refs/remotes/cache/pull/26/head
7baea845f991b48fc43e8c3053c97e021a06fc59 refs/remotes/cache/pull/27/head
11f3cee3e24af1265b6c1b9826a25dfafc9a6342 refs/remotes/cache/pull/29/head
23fe2850bbf679a13032126adbfb51fcff8f4f5e refs/remotes/cache/pull/3/head
b1f11338e8c05d8738d2cbabce029ff7877e527e refs/remotes/cache/pull/31/head
8b7dfe4cc978b3b709fc1919abc8b2df0b00036d refs/remotes/cache/pull/34/head
b529f2ea6f9f42ee2ee952cae12c1e71a37ec313 refs/remotes/cache/pull/36/head
d053c23758d8c4f9dec997d6ed8d45fcc1e1597b refs/remotes/cache/pull/40/head
ef84870c184e6847dddc9357c1c30cec1443eecb refs/remotes/cache/pull/41/head
2e72ade1d0f0de16da9ecb4a4572f68428f8e35a refs/remotes/cache/pull/41/merge
2c825cfcfa2f6da88fc8a138e13dc30396bd9cb6 refs/remotes/origin/ed/debug-closing
cec4788b1d8b1e8d5c6a863303409ff8be85ad64 refs/remotes/origin/ed/pgc-ci
6b3175ed6f5356497f8ca5493515626841e15960 refs/remotes/origin/ed/tstzrange
c8ef008b952f032fae9872831339c03d9b612d04 refs/remotes/origin/gh-pages
ac873429bf7e2c47de52c9a0d69f739815fdd836 refs/remotes/origin/master
5cadcd4d458590b797d0584f5798ff0350e6e4c2 refs/remotes/origin/ne/test
0ff3d0aeabb9629e519ffe4ae15ba8bf460ac389 refs/remotes/origin/ne/up-dataframes
9d7761f12bf75ea9b3fa6ad916265ce994007626 refs/remotes/origin/npr/style-badge
ad01a7082cb6e7ddfa610ca33b2675eed36bcde3 refs/remotes/origin/release-0.8
4b1c3266d9ea964575937adce02d09f90de971e8 refs/remotes/origin/rf/async-connect
0ad4a44d7d22d8f26095a1d56dacdc6a43728537 refs/remotes/origin/rf/connect_timeout
  • git config --get-regexp '(push|fetch|remote|branch|trim).*' | sort
alias.forcepush push --force-with-lease
branch.ed/array-params.merge refs/heads/ed/array-params
branch.ed/array-params.remote origin
branch.ed/async-connect-timeout.merge refs/heads/ed/async-connect-timeout
branch.ed/async-connect-timeout.remote origin
branch.ed/async-connect.merge refs/heads/ed/async-connect
branch.ed/async-connect.remote origin
branch.ed/async-execute.merge refs/heads/ed/async-execute
branch.ed/async-execute.remote origin
branch.ed/capital-columns.merge refs/heads/ed/capital-columns
branch.ed/capital-columns.remote origin
branch.ed/catch-ebadf.merge refs/heads/ed/catch-ebadf
branch.ed/catch-ebadf.remote origin
branch.ed/copy.merge refs/heads/ed/copy
branch.ed/copy.remote origin
branch.ed/date-n-time-parsing.merge refs/heads/ed/date-n-time-parsing
branch.ed/date-n-time-parsing.remote origin
branch.ed/debug-closing.merge refs/heads/ed/debug-closing
branch.ed/debug-closing.remote origin
branch.ed/docs-n-cleanup.merge refs/heads/ed/docs-n-cleanup
branch.ed/docs-n-cleanup.remote origin
branch.ed/docs-updates.merge refs/heads/ed/docs-updates
branch.ed/docs-updates.remote origin
branch.ed/drop-0.6.merge refs/heads/ed/drop-0.6
branch.ed/drop-0.6.remote origin
branch.ed/ebadf-connection-fix.merge refs/heads/ed/ebadf-connection-fix
branch.ed/ebadf-connection-fix.remote origin
branch.ed/exception-types.merge refs/heads/ed/exception-types
branch.ed/exception-types.remote origin
branch.ed/finalize-connections.merge refs/heads/ed/finalize-connections
branch.ed/finalize-connections.remote origin
branch.ed/fix-bpchar-parse.merge refs/heads/ed/fix-bpchar-parse
branch.ed/fix-bpchar-parse.remote origin
branch.ed/fix-cenum-show.merge refs/heads/ed/fix-cenum-show
branch.ed/fix-cenum-show.remote origin
branch.ed/fix-column-types-undef-ref.merge refs/heads/ed/fix-column-types-undef-ref
branch.ed/fix-column-types-undef-ref.remote origin
branch.ed/fix-conninfoparseerror.merge refs/heads/ed/fix-conninfoparseerror
branch.ed/fix-conninfoparseerror.remote origin
branch.ed/fix-docs-nt.merge refs/heads/ed/fix-docs-nt
branch.ed/fix-docs-nt.remote origin
branch.ed/fix-ebadf-test.merge refs/heads/ed/fix-ebadf-test
branch.ed/fix-ebadf-test.remote origin
branch.ed/fix-linkcheck.merge refs/heads/ed/fix-linkcheck
branch.ed/fix-linkcheck.remote origin
branch.ed/fix-tables-support.merge refs/heads/ed/fix-tables-support
branch.ed/fix-tables-support.remote origin
branch.ed/indexing-iteration.merge refs/heads/ed/indexing-iteration
branch.ed/indexing-iteration.remote origin
branch.ed/interval-parsing.merge refs/heads/ed/interval-parsing
branch.ed/interval-parsing.remote origin
branch.ed/modern-docs.merge refs/heads/ed/modern-docs
branch.ed/modern-docs.remote origin
branch.ed/new-binaries.merge refs/heads/ed/new-binaries
branch.ed/new-binaries.remote origin
branch.ed/new-travis-platforms.merge refs/heads/ed/new-travis-platforms
branch.ed/new-travis-platforms.remote origin
branch.ed/null-sqlstate.merge refs/heads/ed/null-sqlstate
branch.ed/null-sqlstate.remote origin
branch.ed/only-azure.merge refs/heads/ed/only-azure
branch.ed/only-azure.remote origin
branch.ed/password-buffer.merge refs/heads/ed/password-buffer
branch.ed/password-buffer.remote origin
branch.ed/pgc-ci.merge refs/heads/ed/pgc-ci
branch.ed/pgc-ci.remote origin
branch.ed/poll_fd.merge refs/heads/ed/poll_fd
branch.ed/poll_fd.remote origin
branch.ed/pqflush.merge refs/heads/ed/pqflush
branch.ed/pqflush.remote origin
branch.ed/redshift.merge refs/heads/ed/redshift
branch.ed/redshift.remote origin
branch.ed/rm-clutter.merge refs/heads/ed/rm-clutter
branch.ed/rm-clutter.remote origin
branch.ed/rm-datastreams.merge refs/heads/ed/rm-datastreams
branch.ed/rm-datastreams.remote origin
branch.ed/simpler-ci.merge refs/heads/ed/simpler-ci
branch.ed/simpler-ci.remote origin
branch.ed/taskfailedexception.merge refs/heads/ed/taskfailedexception
branch.ed/taskfailedexception.remote origin
branch.ed/tstzrange.merge refs/heads/ed/tstzrange
branch.ed/tstzrange.remote origin
branch.ed/version-updates.merge refs/heads/ed/version-updates
branch.ed/version-updates.remote origin
branch.ed/versions.merge refs/heads/ed/versions
branch.ed/versions.remote origin
branch.master.merge refs/heads/master
branch.master.remote origin
branch.release-0.8.merge refs/heads/release-0.8
branch.release-0.8.remote origin
remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
remote.origin.pushurl [email protected]:invenia/LibPQ.jl
remote.origin.url https://github.com/invenia/LibPQ.jl.git

Logs and stacktraces
You should remove sensitive informations before put them here.

> RUST_BACKTRACE=full git trim --dry-run

Branches that will remain:
  local branches:
    master
  remote references:
thread 'main' panicked at 'internal error: entered unreachable code: matching refspec is not found', src/branch.rs:133:9
stack backtrace:
   0:        0x10ae007b5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h253e83cc475a85d0
   1:        0x10ae18531 - core::fmt::write::h5b2ae886983aa058
   2:        0x10ae0056b - std::io::Write::write_fmt::h25524112e4cce8f5
   3:        0x10ae03c03 - std::panicking::default_hook::{{closure}}::h770880a3b7065f3d
   4:        0x10ae0392f - std::panicking::default_hook::h8a113dafa31143b6
   5:        0x10ae0429b - std::panicking::rust_panic_with_hook::ha2f5dac743ef67b3
   6:        0x10ae03e39 - rust_begin_unwind
   7:        0x10ae2893f - std::panicking::begin_panic_fmt::h360de49299ebe5b0
   8:        0x10ac979a1 - git_trim::branch::RemoteBranch::from_remote_tracking::haeae1c242797d5df
   9:        0x10ac69820 - git_trim::main::h8af275e2e349105c
  10:        0x10ac654fb - std::rt::lang_start::{{closure}}::hd43737e64b86cf87
  11:        0x10ae03d28 - std::panicking::try::do_call::hcc2f2b88c6645a8c
  12:        0x10ae0606f - __rust_maybe_catch_panic
  13:        0x10adf6625 - std::rt::lang_start_internal::h5c91a3e7c72ca35f
  14:        0x10ac6b1c9 - main

Fails if no origin

Describe the bug
Seems to fail if there is no origin remote. (For triangular flows, I'll often use the remotes mine and upstream.)

Note that both git trim and git-trim -d merged:upstream trigger this problem

To Reproduce
Steps to reproduce the behavior:

  1. Make a repo without an origin remote
  2. Use git trim

Expected behavior
Do something useful

Actual behaviour

Error: remote 'origin' does not exist; class=Config (7); code=NotFound (-3)

Additional context and logs & dumps
You should remove sensitive informations before put them here.

  • Debian testing
  • 0.2.4
  • Installed via cargo

Logs and stacktraces

🐚 git trim
Fetching upstream
Fetching mine
Fetching pathunstrom
Fetching nbraud

Error: remote 'origin' does not exist; class=Config (7); code=NotFound (-3)

Crash when branch does not have common ancestor

Check your version before submitting the bug
git-trim 0.4.0-alpha.1

Describe the bug
Orphan branches cause crash which cannot be ignored by making them protected.

To Reproduce
Steps to reproduce the behavior:

  1. Take any repo
  2. git checkout --orphan new-test
  3. git commit -a -m "just testing"
  4. git push origin new-test
  5. git trim --dry-run

Expected behavior

git-trim realises that the branch does not have a common ancestor and doesn't crash.

Actual behaviour

$ git trim --dry-run 

Error: base=RemoteTrackingBranch { refname: "refs/remotes/origin/develop" }, branch=LocalBranch { refname: "refs/heads/new-test" }

Caused by:
    no merge base found; class=Merge (22); code=NotFound (-3)

$ git trim --dry-run -p new-test

Error: base=RemoteTrackingBranch { refname: "refs/remotes/origin/develop" }, branch=LocalBranch { refname: "refs/heads/new-test" }

Caused by:
    no merge base found; class=Merge (22); code=NotFound (-3)

Additional context and logs & dumps
N/A

Logs and stacktraces
N/A

Error: 'git@domain:path.git' is not a valid remote name

Describe the bug

Since I use hub pr checkout occasionally, I get in my `.git/config entries such as:

[branch "new-feature"]
	remote = [email protected]:someone/fork.git
	merge = refs/heads/new-feature

I'm not sure hub ( https://github.com/github/hub ) is operating fine when it creates these remotes / branches, but in any case I think git-trim should be resilient to this.

To Reproduce
Steps to reproduce the behavior:

  1. Run a hub pr checkout # on a github repo with a PR open.
  2. Run git trim --dry-run.

Expected behavior
No error produced.

Actual behaviour
Getting the error:

Error: '[email protected]:someone/fork.git' is not a valid remote name.; class=Config (7); code=InvalidSpec (-12)

FAQ

can you describe difference and advantage to git fetch --prune ?

Manage a man page using a smart way

The PR #50 added a man page. We need a method to manage the man page in a smart way.

There are too many methods to create a man page. We need to research them and choose one.

"Consider following to scan them" message looks awkward

Check your version before submitting the bug
0.42

Describe the bug

When I run the git-trim, I can see the message like below:

Some branches are skipped. Consider following to scan them:
    *2: Set an upstream to make it a tracking branch or add `--delete 'local' flag.
    *3: Make it upstream of a tracking branch or add `--delete 'remote:origin' flag.

To Reproduce

  1. Clone git-trim: git clone git-trim
  2. Move to the git-trim directory: cd git-trim
  3. Create any branch: git branch -f x
  4. Run git-trim: git-trim

Expected behavior

There is a ` before --delete 'remove:origin'. There is no closing ` in the message. Shouldn' it be `--delete 'remote:origin'` ?

Actual behaviour

git-trim prints add `--delete 'remote:origin' flag. The message does not close `.

Additional context and logs & dumps if necessary

Logs and stacktraces if necessary

Survey: Are you using push upstream (`git config remote.*.push`)?

Hi! I think you've come here after seeing the "Help wanted!" message in git-trim.
This was the message:

Help wanted!
I recognize that you've set a config `git config remote.origin.push`!
I once (mis)used that config to classify branches, but I retracted it after realizing that I don't understand the config well.
It would be very helpful to me if you share your use cases of the config to me.
Here's the survey URL: https://github.com/foriequal0/git-trim/issues/134
Thank you!

As you saw in the message, I'm lack of understanding about git config remote.<name>.push.
Even Google doesn't seem to know about it (there is about 600 search results at the time of writing).

So I retracted it to reduce the surface of the git-trim for now, and to focus on simpler use cases.
But I still expect that there are interesting scenarios and useful properties on it. So I've opened this survey to hear use cases of it from you.

`git-trim` fails to work correctly when trying to delete branches that are contributor PRs

Check your version before submitting the bug

$ git-trim --version
git-trim 0.4.2

Describe the bug

Sometimes when a contributor submits a PR, I run hub pr checkout $PrNumber in the repository, where hub is a binary install from https://github.com/github/hub. This allows me to make commits directly to the contributor's branch before merging the PR.

However, when I try to delete those local branches using git-trim it doesn't work. git-trim --delete local suggests adding the --delete 'merged:*' flag.

$ git-trim --delete local
Fetching origin

Branches that will remain:
  local branches:
    brightpuddle-master *1
    delete-prompt-and-change-delete-keybinding *1
    history *1
    improve-cpu-usage *1
    interpolate-variables *1
    master *1
    multiple-selection *1
    update-help-menu *1
  remote references:
    origin/delete-prompt-and-change-delete-keybinding *1
    origin/gh-pages *3
    origin/history *1
    origin/master *1
    origin/multiple-selection *1
    origin/update-help-menu *1
  Some branches are skipped. Consider following to scan them:
    *1: Add `--delete 'merged:*' flag.
    *3: Make it upstream of a tracking branch or add `--delete 'remote:origin' flag.

When I add that flag I get the following error

$ git-trim --delete local --delete 'merged:*'
Fetching origin

Branches that will remain:
  local branches:
    delete-prompt-and-change-delete-keybinding
    history
    interpolate-variables [stray, but: delete range `stray` was not given]
    master [base]
    multiple-selection
    update-help-menu
  remote references:
    origin/delete-prompt-and-change-delete-keybinding
    origin/gh-pages *3
    origin/history
    origin/master [base]
    origin/multiple-selection
    origin/update-help-menu
  Some branches are skipped. Consider following to scan them:
    *3: Make it upstream of a tracking branch or add `--delete 'remote:origin' flag.

Delete merged local branches:
  - brightpuddle-master
  - improve-cpu-usage
Delete diverged remote refs:
  - [email protected]:brightpuddle/taskwarrior-tui.git, refs/heads/master
  - [email protected]:desbma/taskwarrior-tui.git, refs/heads/improve-cpu-usage
Confirm? yes
To github.com:brightpuddle/taskwarrior-tui.git
 ! [remote rejected] master (permission denied)
error: failed to push some refs to 'github.com:brightpuddle/taskwarrior-tui.git'
Error: Operation not permitted (os error 1)

Obviously, I can't and shouldn't be able to delete a remote branch on someone else's repo. Ideally git-trim will just delete the local branches in my repo. I'm not a git expert, so I'm not sure if the diverged remote refs are stored locally somewhere, but if it is, I would like git-trim to delete those as well.

Additional context and logs & dumps if necessary
You should remove sensitive informations before put them here.

  • MacOS

I can provide additional information dumps if required. The repo in question is here: https://github.com/kdheepak/taskwarrior-tui/. Happy to answer more questions.

Thanks for making git-trim, I use it all the time!

Local branch and remote branch can deviate

Since it does git fetch --prune, not git pull --prune on the all branches, local branch and the remote branch might not be the same. So merge test on the remote branch is necessary before classify it as merged_remotes.

Diverged branch?

Sometimes the local one is merged, while the remote tracking one is not.

Current behaviour:
git-trim classifies the local one as a merged local, while the remote one as a stray remote. merged local branches are delete by default.
And then I run git-trim again, the remote one lost its tracking branch in previous command so it doesn't show up as stray remote anymore.

Suggested change:
Add a diverged to classifications. stray remote seems useless.

`git-trim` fails when multiple delete filters apply to the same branch

Check your version before submitting the bug

$ git-trim -V
git-trim 0.4.2

Describe the bug
I have trim.delete = merged-local,merged-remote:origin,stray in my git config. When I git fetch --prune before running git trim and multiple delete filters apply to the same ref name the output is e.g.:

[...]

Delete merged local branches:
  - some-branch
Delete stray local branches:
  - some-branch
Confirm? yes
error: could not delete references: multiple updates for ref 'refs/heads/some-branch' not allowed
error: could not delete references:
Error: Operation not permitted (os error 1)

Steps to reproduce
Not actual git-trim reproduction steps but with the git CLI that gets executed by branch_delete:

$ git checkout -b some-branch
$ git checkout -
$ # git-trim behavior
$ git branch --delete --force some-branch some-branch
error: could not delete references: multiple updates for ref 'refs/heads/some-branch' not allowed
error: could not delete references:

Expected behavior
branch_names in

let mut branch_names = Vec::new();
should probably be a HashSet instead of Vec so the branches are deleted.

Actual behaviour
git subprocess fails.

Additional context and logs & dumps if necessary
You should remove sensitive informations before put them here.

  • OS: macOS 11.2.3
  • Version: 0.4.2

Make performance counter

To diagnosis operations, I need a performance counter.
How many branches are there? How big is a repository? How long it takes for each operation?

openssl 3 is unsupported

Archlinux has updated to openssl 3, when compiling git-trim, it will fail and report

The following warnings were emitted during compilation:

warning: build/expando.c:4:24: 错误:pasting "RUST_VERSION_OPENSSL_" and "(" does not give a valid preprocessing token
warning: 4 | #define VERSION2(n, v) RUST_VERSION_##n##_##v
warning: | ^~~~~~~~~~~~~
warning: build/expando.c:5:23: 附注:in expansion of macro ‘VERSION2’
warning: 5 | #define VERSION(n, v) VERSION2(n, v)
warning: | ^~~~~~~~
warning: build/expando.c:10:1: 附注:in expansion of macro ‘VERSION’
warning: 10 | VERSION(OPENSSL, OPENSSL_VERSION_NUMBER)
warning: | ^~~~~~~

error: failed to run custom build command for openssl-sys v0.9.58

Caused by:
process didn't exit successfully: /home/sherlock/.cache/yay/git-trim/src/git-trim-0.4.2/target/release/build/openssl-sys-666a532735c180d7/build-script-main (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
cargo:rustc-link-lib=ssl
cargo:rustc-link-lib=crypto
OPT_LEVEL = Some("3")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = Some("-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection")
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-march=x86-64" "-mtune=generic" "-O2" "-pipe" "-fno-plt" "-fexceptions" "-Wp,-D_FORTIFY_SOURCE=2" "-Wformat" "-Werror=format-security" "-fstack-clash-protection" "-fcf-protection" "-I" "/usr/include" "-E" "build/expando.c"
cargo:warning=build/expando.c:4:24: 错误:pasting "RUST_VERSION_OPENSSL_" and "(" does not give a valid preprocessing token
cargo:warning= 4 | #define VERSION2(n, v) RUST_VERSION_##n##_##v
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=build/expando.c:5:23: 附注:in expansion of macro ‘VERSION2’
cargo:warning= 5 | #define VERSION(n, v) VERSION2(n, v)
cargo:warning= | ^~~~~~~~
cargo:warning=build/expando.c:10:1: 附注:in expansion of macro ‘VERSION’
cargo:warning= 10 | VERSION(OPENSSL, OPENSSL_VERSION_NUMBER)
cargo:warning= | ^~~~~~~
exit code: 1

--- stderr
thread 'main' panicked at '
Header expansion error:
Error { kind: ToolExecError, message: "Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-march=x86-64" "-mtune=generic" "-O2" "-pipe" "-fno-plt" "-fexceptions" "-Wp,-D_FORTIFY_SOURCE=2" "-Wformat" "-Werror=format-security" "-fstack-clash-protection" "-fcf-protection" "-I" "/usr/include" "-E" "build/expando.c" with args "cc" did not execute successfully (status code exit code: 1)." }

Failed to find OpenSSL development headers.

You can try fixing this setting the OPENSSL_DIR environment variable
pointing to your OpenSSL installation or installing OpenSSL headers package
specific to your distribution:

  # On Ubuntu
  sudo apt-get install libssl-dev
  # On Arch Linux
  sudo pacman -S openssl
  # On Fedora
  sudo dnf install openssl-devel

See rust-openssl README for more information:

  https://github.com/sfackler/rust-openssl#linux

', /home/sherlock/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.58/build/main.rs:140:13
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

consider openssl crate is supported openssl3 sfackler/rust-openssl#1694
maybe you should just update the openssl version?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.