foriequal0 / git-trim

Automatically trims your branches whose tracking remote refs are merged or stray
MIT License
492 stars 14 forks source link

Crash when branch does not have common ancestor #148

Closed cs278 closed 4 years ago

cs278 commented 4 years ago

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

foriequal0 commented 4 years ago

Can you confirm that these builds don't crash? https://github.com/foriequal0/git-trim/actions/runs/206393332

cs278 commented 4 years ago

Can you confirm that these builds don't crash? https://github.com/foriequal0/git-trim/actions/runs/206393332

:+1: Works perfectly.

foriequal0 commented 4 years ago

Thank you!