Avoid creating empty commits when pushing changes to FederatedCode#1888
Conversation
- Untracked file enumeration is a very costly operation for large git repo Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
JonoYang
left a comment
There was a problem hiding this comment.
@keshav-space lgtm, i just have a small question
|
|
||
| repo.index.add(files_to_commit) | ||
| repo.index.commit(textwrap.dedent(commit_message)) | ||
| repo.git.commit( |
There was a problem hiding this comment.
@keshav-space just wondering what the difference between repo.index.commit and repo.git.commit
There was a problem hiding this comment.
@JonoYang repo.index is python abstraction of git while repo.git runs the native command line git. We switched from repo.index to repo.git for committing our changes because repo.index by default allows empty commits and there is no way to change this behavior. So we ended up using the native repo.git to disallow empty commits.
There was a problem hiding this comment.
This means that git is now a system requirement that needs to be installed too. Please double check the docs.
There was a problem hiding this comment.
@pombredanne we already have git as system requirement
Line 66 in 5e4aff9
5935d48 to
781420b
Compare
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
781420b to
14e2c9f
Compare
…1888) * Do not enumerate untracked files to compute commit message - Untracked file enumeration is a very costly operation for large git repo Signed-off-by: Keshav Priyadarshi <git@keshav.space> * Set allow_empty to false to avoid empty commits Signed-off-by: Keshav Priyadarshi <git@keshav.space> * Bump minecode_pipelines to 0.0.1b8 Signed-off-by: Keshav Priyadarshi <git@keshav.space> --------- Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Related: aboutcode-org/purldb#667 and aboutcode-org/purldb#721