Skip to content

RewriteHistory: PruneEmptyCommits#494

Merged
nulltoken merged 2 commits into
libgit2:vNextfrom
dahlbyk:FilterBranchPrune
Aug 21, 2013
Merged

RewriteHistory: PruneEmptyCommits#494
nulltoken merged 2 commits into
libgit2:vNextfrom
dahlbyk:FilterBranchPrune

Conversation

@dahlbyk

@dahlbyk dahlbyk commented Aug 17, 2013

Copy link
Copy Markdown
Member

As promised, support for --prune-empty (or something like it).

I didn't actually replicate these tests with git filter-branch, but the resulting commit graphs in each case seem reasonable. I should probably check how filter-branch handles cases where a ref can't reasonably be rewritten (see https://github.com/dahlbyk/libgit2sharp/blob/66777c927990ff9dad0fb42ce0dc67c23ccc2e90/LibGit2Sharp.Tests/FilterBranchFixture.cs#L156-162), though I can't think of anything reasonable to do other than remove it - anyone already know, or have a different idea how to handle it?

I also didn't cover a scenario where all trees are empty...necessary? What should it do?

@dahlbyk

dahlbyk commented Aug 17, 2013

Copy link
Copy Markdown
Member Author

I also didn't cover a scenario where all trees are empty...necessary? What should it do?

Added test for this - master becomes an orphan, because all commits are empty and thus pruned. Seems reasonable to me.

Forgot to /cc @ben

@dahlbyk

dahlbyk commented Aug 17, 2013

Copy link
Copy Markdown
Member Author

Interesting...since this PR is based on vNext, I would have expected the first two commits to fall off now that @7b7aef0 has been merged.

@nulltoken

Copy link
Copy Markdown
Member

Interesting...since this PR is based on vNext, I would have expected the first two commits to fall off now that @7b7aef0 has been merged.

I've noticed this as well while working on #491. I've had to force push in order to clean the commits up.

@nulltoken

Copy link
Copy Markdown
Member

This looks quite thorough from a test coverage perspective. I like this quite much!

@ben ?

@nulltoken

Copy link
Copy Markdown
Member

I also didn't cover a scenario where all trees are empty...necessary? What should it do?

What's the definition of an empty commit?

  • A commit which produces an empty diff when compared against its parent
  • A commit with no content?

@dahlbyk

dahlbyk commented Aug 17, 2013

Copy link
Copy Markdown
Member Author

Empty tree = tree with 0 entries.
Empty commit = tree matches first parent, or tree is empty if no parents.

@nulltoken

Copy link
Copy Markdown
Member

As we agree on the definitions, I think making the reference orphan makes sense.

@dahlbyk

dahlbyk commented Aug 18, 2013

Copy link
Copy Markdown
Member Author

I've had to force push in order to clean the commits up.

That did the trick.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ❤️ this test data so hard.

@ben

ben commented Aug 19, 2013

Copy link
Copy Markdown
Member

👍 I like it.

@nulltoken

Copy link
Copy Markdown
Member

@dahlbyk I also like Option 3.

LET'S MAKE THIS HAPPEN 🎉

@dahlbyk

dahlbyk commented Aug 21, 2013

Copy link
Copy Markdown
Member Author

Rebased for great justice. :shipit:

@nulltoken
nulltoken merged commit fbcefda into libgit2:vNext Aug 21, 2013
@nulltoken

Copy link
Copy Markdown
Member

Merged for posterity. :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants