Allow first commit in repo
Before you had to do it through vanilla git
This commit is contained in:
parent
77bdcc1024
commit
08771733b1
@ -1487,6 +1487,7 @@ def tree_from_index(repo, index, commit_map, author, commit_time, message):
|
|||||||
if path in commit_map:
|
if path in commit_map:
|
||||||
(subcommit_hash, subcommit) = commit_map[path]
|
(subcommit_hash, subcommit) = commit_map[path]
|
||||||
else:
|
else:
|
||||||
|
subcommit_hash = None
|
||||||
subcommit = None
|
subcommit = None
|
||||||
|
|
||||||
if subcommit == None or subcommit.kvlm[b'tree'] != sha.encode('ascii'):
|
if subcommit == None or subcommit.kvlm[b'tree'] != sha.encode('ascii'):
|
||||||
@ -1530,12 +1531,18 @@ def cmd_commit(args):
|
|||||||
repo = repo_find()
|
repo = repo_find()
|
||||||
index = index_read(repo)
|
index = index_read(repo)
|
||||||
root_commit_sha = object_find(repo, "HEAD")
|
root_commit_sha = object_find(repo, "HEAD")
|
||||||
|
if root_commit_sha:
|
||||||
root_commit = object_read(repo, root_commit_sha)
|
root_commit = object_read(repo, root_commit_sha)
|
||||||
|
else:
|
||||||
|
root_commit = None
|
||||||
|
|
||||||
commit_time = datetime.now()
|
commit_time = datetime.now()
|
||||||
author = gitconfig_user_get(gitconfig_read())
|
author = gitconfig_user_get(gitconfig_read())
|
||||||
|
|
||||||
|
if root_commit:
|
||||||
commit_map = create_commit_map(repo, root_commit)
|
commit_map = create_commit_map(repo, root_commit)
|
||||||
|
else:
|
||||||
|
commit_map = dict()
|
||||||
|
|
||||||
tree = tree_from_index(repo,
|
tree = tree_from_index(repo,
|
||||||
index,
|
index,
|
||||||
|
Loading…
Reference in New Issue
Block a user