mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-11-07 09:20:29 +00:00
6a6d21aff5
fast-import syntax declares how to specify the parents of a commit with 'from' and possibly 'merge' directives, but it oddly also allows parents to be implicitly specified via branch name. The documentation is easy to misread: "Omitting the from command in the first commit of a new branch will cause fast-import to create that commit with no ancestor." Note that the "in the first commit of a new branch" is key here. It is reinforced later in the document with: "Omitting the from command on existing branches is usually desired, as the current commit on that branch is automatically assumed to be the first ancestor of the new commit." Desirability of operating this way aside, this raises an interesting question: what if you only have one branch in some repository, but that branch has more than one root commit? How does one use the fast-import format to import such a repository? The fast-import documentation doesn't state as far as I can tell, but using a 'reset' directive without providing a 'from' reference for it is the way to go. Modify filter-repo to understand implicit 'from' commits, and to appropriately issue 'reset' directives when we need additional root commits. Signed-off-by: Elijah Newren <newren@gmail.com>
129 lines
3.0 KiB
Plaintext
129 lines
3.0 KiB
Plaintext
feature done
|
|
# Simple repo with only two files, with a whole bunch of cases dealing with
|
|
# empty pruning, particularly commits that start empty.
|
|
#
|
|
# As with case1, the original-oid directives are very fake, but if an error
|
|
# is hit that shows one of these, it makes it really easy to know where it
|
|
# came from.
|
|
blob
|
|
mark :1
|
|
original-oid 0000000000000000000000000000000000000001
|
|
data 10
|
|
nukeme v1
|
|
|
|
blob
|
|
mark :2
|
|
original-oid 0000000000000000000000000000000000000002
|
|
data 10
|
|
keepme v1
|
|
|
|
blob
|
|
mark :3
|
|
original-oid 0000000000000000000000000000000000000003
|
|
data 10
|
|
nukeme v2
|
|
|
|
blob
|
|
mark :4
|
|
original-oid 0000000000000000000000000000000000000004
|
|
data 10
|
|
keepme v2
|
|
|
|
commit refs/heads/master
|
|
mark :5
|
|
original-oid 0000000000000000000000000000000000000010
|
|
author Full Name <user@organization.tld> 1000000000 +0100
|
|
committer Full Name <user@organization.tld> 1000000000 +0100
|
|
data 2
|
|
A
|
|
|
|
commit refs/heads/master
|
|
mark :6
|
|
original-oid 0000000000000000000000000000000000000011
|
|
author Full Name <user@organization.tld> 1000010000 +0100
|
|
committer Full Name <user@organization.tld> 1000010000 +0100
|
|
data 2
|
|
B
|
|
from :5
|
|
|
|
reset refs/heads/master
|
|
commit refs/heads/master
|
|
mark :7
|
|
original-oid 0000000000000000000000000000000000000012
|
|
author Full Name <user@organization.tld> 1000020000 +0100
|
|
committer Full Name <user@organization.tld> 1000020000 +0100
|
|
data 2
|
|
C
|
|
M 100644 :1 nukeme
|
|
|
|
commit refs/heads/master
|
|
mark :8
|
|
original-oid 0000000000000000000000000000000000000013
|
|
author Full Name <user@organization.tld> 1000030000 +0100
|
|
committer Full Name <user@organization.tld> 1000030000 +0100
|
|
data 2
|
|
D
|
|
from :7
|
|
|
|
commit refs/heads/master
|
|
mark :9
|
|
original-oid 0000000000000000000000000000000000000014
|
|
author Full Name <user@organization.tld> 1000040000 +0100
|
|
committer Full Name <user@organization.tld> 1000040000 +0100
|
|
data 29
|
|
E: Merge commit 'D' into 'B'
|
|
from :6
|
|
merge :8
|
|
M 100644 :2 keepme
|
|
|
|
commit refs/heads/master
|
|
mark :10
|
|
original-oid 0000000000000000000000000000000000000015
|
|
author Full Name <user@organization.tld> 1000050000 +0100
|
|
committer Full Name <user@organization.tld> 1000050000 +0100
|
|
data 29
|
|
F: Merge commit 'D' into 'B'
|
|
from :6
|
|
merge :8
|
|
|
|
commit refs/heads/master
|
|
mark :11
|
|
original-oid 0000000000000000000000000000000000000016
|
|
author Full Name <user@organization.tld> 1000060000 +0100
|
|
committer Full Name <user@organization.tld> 1000060000 +0100
|
|
data 2
|
|
G
|
|
from :9
|
|
M 100644 :3 nukeme
|
|
|
|
commit refs/heads/master
|
|
mark :12
|
|
original-oid 0000000000000000000000000000000000000017
|
|
author Full Name <user@organization.tld> 1000070000 +0100
|
|
committer Full Name <user@organization.tld> 1000070000 +0100
|
|
data 2
|
|
H
|
|
from :11
|
|
|
|
commit refs/heads/master
|
|
mark :13
|
|
original-oid 0000000000000000000000000000000000000018
|
|
author Full Name <user@organization.tld> 1000080000 +0100
|
|
committer Full Name <user@organization.tld> 1000080000 +0100
|
|
data 2
|
|
I
|
|
from :10
|
|
M 100644 :4 keepme
|
|
|
|
commit refs/heads/master
|
|
mark :14
|
|
original-oid 0000000000000000000000000000000000000019
|
|
author Full Name <user@organization.tld> 1000090000 +0100
|
|
committer Full Name <user@organization.tld> 1000090000 +0100
|
|
data 29
|
|
J: Merge commit 'I' into 'H'
|
|
from :12
|
|
merge :13
|
|
|
|
done
|