Skip to content

Commit

Permalink
hg-to-git: handle an empty dir in hg.
Browse files Browse the repository at this point in the history
Mark Drago had a subversion repository which was then converted to hg
and now is moving in to git.  The first commit in the svn repo was
just the creation of the empty directory.  This made its way in to the
hg repository fine, but converting from hg to git would cause an
error.  The problem was that hg-to-git.py tries to commit the change,
git-commit fails, and then hg-to-git.py tries to checkout the new
revision and that fails (because it was not created).  This may have
only caused an error because it was the first commit in the
repository.  If an empty directory was added in the middle of the repo
somewhere things might have worked out fine.

This patch will use the new --allow-empty option to git-commit to
record such an "empty" commit, to reproduce the history recorded in hg
more faithfully.

Tested-by: Mark Drago <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
gitster committed Dec 6, 2007
1 parent cec99d8 commit 90e0653
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/hg-to-git/hg-to-git.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def getgitenv(user, date):
os.system('git-ls-files -x .hg --deleted | git-update-index --remove --stdin')

# commit
os.system(getgitenv(user, date) + 'git-commit -a -F %s' % filecomment)
os.system(getgitenv(user, date) + 'git commit --allow-empty -a -F %s' % filecomment)
os.unlink(filecomment)

# tag
Expand Down

0 comments on commit 90e0653

Please sign in to comment.