Commit 508a30c
committed
filter-repo: reduce export dump differences
While the order of files passed to `git fast-import` do not matter, we
can help users inspect --dry-run results if we can match the order that
fast-export uses. fast-export uses a depth-first sorting order to
ensure that entries underneath a directory would appear before the
directory or some kind of file or symlink that has replaced a directory.
However, its depth-first ordering is implemented in a way that affects
things besides directories becoming symlinks or files -- in contrast to
normal lexicographic ordering where a substring would sort before a
longer string, fast-export reverses that. This means that when we try
to inspect differences after a --dry-run, we may see a spurious
difference such as:
```
$ ./git-filter-repo --dry-run --proceed
$ diff -u .git/filter-repo/fast-export.original .git/filter-repo/fast-export.filtered
...
@@ -1451,25 +1329,23 @@
D testcases/expected/case1-twenty
D testcases/inputs/case1
M 100755 0a13abf testcases/t9390-repo-filter.sh
+M 100644 de3799f testcases/t9390/case1
M 100644 e0c8845 testcases/t9390/case1-filename
M 100644 a1aa78f testcases/t9390/case1-ten
M 100644 488cbd9 testcases/t9390/case1-twenty
-M 100644 de3799f testcases/t9390/case1
```
Fix this by modifying filter-repo to use the same sorting of paths as
fast-export when --dry-run is specified.
Signed-off-by: Sylvain Beucler <[email protected]>1 parent 2d39146 commit 508a30c
1 file changed
+24
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
3940 | 3941 | | |
3941 | 3942 | | |
3942 | 3943 | | |
3943 | | - | |
| 3944 | + | |
| 3945 | + | |
| 3946 | + | |
| 3947 | + | |
| 3948 | + | |
| 3949 | + | |
| 3950 | + | |
| 3951 | + | |
| 3952 | + | |
| 3953 | + | |
| 3954 | + | |
| 3955 | + | |
| 3956 | + | |
| 3957 | + | |
| 3958 | + | |
| 3959 | + | |
| 3960 | + | |
| 3961 | + | |
| 3962 | + | |
| 3963 | + | |
| 3964 | + | |
| 3965 | + | |
| 3966 | + | |
3944 | 3967 | | |
3945 | 3968 | | |
3946 | 3969 | | |
| |||
0 commit comments