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

5 messages from 2009-03-02 to 2009-03-03. Participants: Peter Rosin, Johannes Schindelin, Junio C Hamano, Johannes Sixt.
Thread: https://gitlist.dev/t/18100

## Peter Rosin, 2009-03-02 23:10

Subject: [PATCH] git filter-branch: Process commits in --date-order
Message-ID: <1236035454-12236-1-git-send-email-peda@lysator.liu.se>
URL: https://gitlist.dev/e/1236035454-12236-1-git-send-email-peda%40lysator.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

```

## Johannes Schindelin, 2009-03-03 00:28

Subject: Re: [PATCH] git filter-branch: Process commits in --date-order
Message-ID: <alpine.DEB.1.00.0903030126530.10279@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0903030126530.10279%40pacific.mpi-cbg.de
In-Reply-To: <1236035454-12236-1-git-send-email-peda@lysator.liu.se>

```
Hi,

On Tue, 3 Mar 2009, Peter Rosin wrote:

> 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.

I'd rather have this as an option.  God knows what breaks with time-skewed 
repositories if you use date-order instead of topo-order, and I'd rather 
not break that not quite uncommon case.

Ciao,
Dscho

```

## Peter Rosin, 2009-03-03 00:39

Subject: Re: [PATCH] git filter-branch: Process commits in --date-order
Message-ID: <49AC7C2B.2050505@lysator.liu.se>
URL: https://gitlist.dev/e/49AC7C2B.2050505%40lysator.liu.se
In-Reply-To: <alpine.DEB.1.00.0903030126530.10279@pacific.mpi-cbg.de>

```
Hi Johannes,

Den 2009-03-03 01:28 skrev Johannes Schindelin:
> Hi,
> 
> On Tue, 3 Mar 2009, Peter Rosin wrote:
> 
>> 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.
> 
> I'd rather have this as an option.  God knows what breaks with time-skewed 
> repositories if you use date-order instead of topo-order, and I'd rather 
> not break that not quite uncommon case.

Well, from the git rev-list docs:

        --date-order
               This option is similar to --topo-order in the sense that no
               parent comes before all of its children, but otherwise things
               are still ordered in the commit timestamp order.

Sounds pretty safe to me?

Cheers,
Peter

```

## Junio C Hamano, 2009-03-03 00:51

Subject: Re: [PATCH] git filter-branch: Process commits in --date-order
Message-ID: <7vbpsjl97d.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vbpsjl97d.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <alpine.DEB.1.00.0903030126530.10279@pacific.mpi-cbg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Tue, 3 Mar 2009, Peter Rosin wrote:
>
>> 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.
>
> I'd rather have this as an option.  God knows what breaks with time-skewed 
> repositories if you use date-order instead of topo-order, and I'd rather 
> not break that not quite uncommon case.

I am wondering if it even makes sense to allow users to disable
topological ordering.

Doesn't filter-branch have the same "child commits build on top of parent
commits" dependency as fast-export has?  And didn't you guys fix
fast-export recently?

```

## Johannes Sixt, 2009-03-03 07:41

Subject: Re: [PATCH] git filter-branch: Process commits in --date-order
Message-ID: <49ACDF3A.1090309@viscovery.net>
URL: https://gitlist.dev/e/49ACDF3A.1090309%40viscovery.net
In-Reply-To: <7vbpsjl97d.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano schrieb:
> I am wondering if it even makes sense to allow users to disable
> topological ordering.
> 
> Doesn't filter-branch have the same "child commits build on top of parent
> commits" dependency as fast-export has?  And didn't you guys fix
> fast-export recently?

Doesn't --date-order have the same guarantee as --topo-order with respect
to parents and children, only that commits that can be rearranged such
that the guarantee remains are emitted in date order?

Anyway, the patch is unnecessary: If --date-order is needed, it can be
passed on the command line; this will override --topo-order.

-- Hannes

```
