Skip to content

fast-import: disallow empty branches as parents

Dmitry Ivankov git 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 8 repliesIn review
  2. v11 patch 2 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3fast-import: do not write null_sha1 as a merge parentfast-import.c t/t9300-fast-import.sh+23 -12 replies
2/3fast-import: allow "merge $null_sha1" commandfast-import.c t/t9300-fast-import.sh+9 -64 replies
3/3fast-import: disallow "merge $itself" commandfast-import.c t/t9300-fast-import.sh+22 -32 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchJonathan Nieder
1/3A-b
2/3
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH/RFC v2 0/3] fast-import: disallow empty branches as parents

This is a rewrite of [1].

First of all the patch is split into several parts now.

1/3 prevents writing invalid commit objects (with null_sha1 parents)

For 2/3 and 3/3 I've changed my mind almost completely. The commands in question are:
A 'from null_sha1'
B 'from empty_branch'
C 'from itself'
D 'merge null_sha1'
E 'merge empty_branch'
F 'merge itself'

Currently C is disallowed, D and E lead to 1/3 bug, F looks broken, A and B are allowed.

In [1] I kept A allowed, but made B, C, D, E disallowed and "fixed" F.
The idea was too keep A as legacy, fix F as it may have applications and disallow others as they look like errors in import stream.

This time I keep A and B allowed, allow D and E, disallow F.
Now I think of null_sha1 as of a special feature, empty_branch things as a mix of legacy and this feature (one can 'reset' branch to null_sha1, then use it's name and expect it to work as if null_sha1 was used, and null_sha1 is allowed). "Fix" for F is dropped for now and will later go separately with it's own set of tests and a new discussion I guess.

[1] http://thread.gmane.org/gmane.comp.version-control.git/200339

Dmitry Ivankov (3):
fast-import: do not write null_sha1 as a merge parent
fast-import: allow "merge $null_sha1" command
fast-import: disallow "merge $itself" command

 fast-import.c          |   29 +++++++++++++++++++----------
 t/t9300-fast-import.sh |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 10 deletions(-)
Signature · 1 line
1.7.3.4