git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-filter-branch: Add an example on how to remove empty commits

From
Deskin Miller <deskinm@umich.edu>
Date
Oct 30, 2008, 15:06 UTC
Message-ID
<20081030150617.GA14098@euler>
In-Reply-To
<20081030132623.GC24098@artemis.corp>
On Thu, Oct 30, 2008 at 02:26:23PM +0100, Pierre Habouzit wrote:
> Why not add an option to filter-branch that removes a commit if it's
> empty ? It's quite useful, it helps the user concentrating on just
> keeping what matches *his* criteriums, and not caring about the minor
> details of cleansing the result.

I've thought this would be useful at times myself. One potential complication, however, is that the history could come from a SVN repository via git-svn, in which case it's possible that empty commits exist due to an incomplete mapping of SVN's changes, e.g. SVN property changes will get their own revision, even if the file content does not change.

Therefore, if one were to write a patch such as Pierre suggests, I'd strongly suggest checking the commit message first for any git-svn-id: line, and either refusing to work without some --force option from the user, or giving a strong warning to the user that their git-svn setup may not work properly any more, and clear instructions on how to recover those refs, or update the svn-related metadata.

On further thought, automatically updating the svn metadata might be useful to add as an option to filter-branch regardless; I'll think about that some myself, any thoughts from others?

My $0.02, Deskin Miller

Previous: Pierre HabouzitNext: Pierre Habouzit
Message 5 of 25 in “git-filter-branch: Add an example on how to remove empty commits”
  1. git-filter-branch: Add an example on how to remove empty commitsPetr Baudis, Oct 30, 2008
  2. Sam VilainOct 30, 2008
  3. Johannes SchindelinOct 30, 2008
  4. Pierre HabouzitOct 30, 2008
  5. Deskin MillerOct 30, 2008
  6. Pierre HabouzitOct 30, 2008
  7. filter-branch enhancementsPierre Habouzit, Oct 30, 2008
  8. make git-filter-branch use parse-options.Pierre Habouzit, Oct 30, 2008
  9. implement --prune-empty switch for filter-branchPierre Habouzit, Oct 30, 2008
  10. Pierre HabouzitOct 31, 2008
  11. filter-branch: add git_commit_non_empty_tree and --prune-empty.Pierre Habouzit, Oct 31, 2008
  12. Johannes SchindelinOct 31, 2008
  13. Pierre HabouzitOct 31, 2008
  14. Junio C HamanoNov 3, 2008
  15. Pierre HabouzitNov 3, 2008
  16. Pierre HabouzitNov 3, 2008
  17. Jay SoffianJan 9, 2009
  18. Pierre HabouzitJan 11, 2009
  19. Johannes SchindelinJan 11, 2009
  20. Pierre HabouzitJan 11, 2009
  21. Sverre RabbelierJan 11, 2009
  22. Pierre HabouzitJan 11, 2009
  23. Sverre RabbelierJan 11, 2009
  24. Junio C HamanoJan 11, 2009
  25. Johannes SchindelinJan 11, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.