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

[PATCH] git filter-branch: Process commits in --date-order

From
PRPeter Rosin <peda@lysator.liu.se>
Date
Mar 2, 2009, 23:10 UTC
Message-ID
<1236035454-12236-1-git-send-email-peda@lysator.liu.se>

When converting an svn repository to git, I am filtering the commits using --msg-filter. During this conversion I want to use the .git-rewrite/map data to fill in references to other commits. In the svn repo, there is a commit message e.g. "Cherry-pick r207", and I want to append "r207 = <commit>" to the git commit message, as r207 no longer means very much. This works fine when the git commit corresponding to r207 has been filtered before the current commit, and is present in the map. When filtering in --topo-order, this is not always the case, making it impossible to look up the git commit.

Signed-off-by: Peter Rosin <peda@lysator.liu.se>
---
 git-filter-branch.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 9a09ba1..dbb2bb3 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -257,11 +257,11 @@ mkdir ../map || die "Could not create map/ directory"
 
 case "$filter_subdir" in
 "")
-	git rev-list --reverse --topo-order --default HEAD \
+	git rev-list --reverse --date-order --default HEAD \
 		--parents --simplify-merges "$@"
 	;;
 *)
-	git rev-list --reverse --topo-order --default HEAD \
+	git rev-list --reverse --date-order --default HEAD \
 		--parents --simplify-merges "$@" -- "$filter_subdir"
 esac > ../revs || die "Could not get the commits"
 commits=$(wc -l <../revs | tr -d " ")
-- 
1.6.0.4
Next: Johannes Schindelin
Message 1 of 5 in “git filter-branch: Process commits in --date-order”
  1. git filter-branch: Process commits in --date-orderPeter Rosin, Mar 2, 2009
  2. Johannes SchindelinMar 3, 2009
  3. Peter RosinMar 3, 2009
  4. Junio C HamanoMar 3, 2009
  5. Johannes SixtMar 3, 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.