MCPcopy
hub / github.com/gitless-vcs/gitless / main

Function main

gitless/cli/gl_commit.py:44–78  ·  view source on GitHub ↗
(args, repo)

Source from the content-addressed store, hash-verified

42
43
44def main(args, repo):
45 commit_files = helpers.oei_fs(args, repo)
46
47 if not commit_files:
48 pprint.err('No files to commit')
49 pprint.err_exp('use gl track f if you want to track changes to file f')
50 return False
51
52 curr_b = repo.current_branch
53 partials = None
54 if args.p:
55 partials = _do_partial_selection(commit_files, curr_b)
56
57 if not _author_info_is_ok(repo):
58 return False
59
60 msg = args.m if args.m else commit_dialog.show(commit_files, repo)
61 if not msg.strip():
62 if partials:
63 git.reset('HEAD', partials)
64 raise ValueError('Missing commit message')
65
66 _auto_track(commit_files, curr_b)
67 ci = curr_b.create_commit(commit_files, msg, partials=partials)
68 pprint.ok('Commit on branch {0} succeeded'.format(repo.current_branch))
69
70 pprint.blank()
71 pprint.commit(ci)
72
73 if curr_b.fuse_in_progress:
74 _op_continue(curr_b.fuse_continue, 'Fuse')
75 elif curr_b.merge_in_progress:
76 _op_continue(curr_b.merge_continue, 'Merge')
77
78 return True
79
80
81def _author_info_is_ok(repo):

Callers

nothing calls this directly

Calls 5

_do_partial_selectionFunction · 0.85
_author_info_is_okFunction · 0.85
_auto_trackFunction · 0.85
_op_continueFunction · 0.85
create_commitMethod · 0.80

Tested by

no test coverage detected