Skip to content

add author and committer in params of the commit function #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 17, 2014
Merged

Conversation

firm1
Copy link
Contributor

@firm1 firm1 commented Mar 24, 2014

Currently, when doing a commit with GitPython, it is based solely on the parameters defined in the environment variables GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL.
It is very painful as a way of doing things.

This Pull Request allow to make a commit through the function commit the index class.

With this update, we can make a commit like that.

repo = Repo('my/repo/')
index = repo.index
index.add['manifest.txt']
index.commit(msg.encode('utf-8'), 
              author=Actor('firm1', '[email protected]'), 
              committer=Actor('firm2', '[email protected]')
            )

When author or committer params aren't specified, the default value is variable environment.

Results are off course in the logs entry.

@Byron
Copy link
Member

Byron commented May 4, 2014

trigger travis-ci : close and reopen on mergeable request.

@Byron Byron closed this May 4, 2014
@Byron Byron reopened this May 4, 2014
@Byron Byron added this to the v0.3.3 milestone Nov 17, 2014
@Byron
Copy link
Member

Byron commented Nov 17, 2014

Thank you.
This can be merged with just a few fixes that I am doing right now. Please see the commit notes in case you are interested.

@@ -247,7 +247,7 @@ def append_entry(cls, config_reader, filepath, oldbinsha, newbinsha, message):
raise ValueError("Shas need to be given in binary format")
#END handle sha type
assure_directory_exists(filepath, is_file=True)
entry = RefLogEntry((bin_to_hex(oldbinsha), bin_to_hex(newbinsha), Actor.committer(config_reader), (int(time.time()), time.altzone), message))
entry = RefLogEntry((bin_to_hex(oldbinsha), bin_to_hex(newbinsha), config_reader, (int(time.time()), time.altzone), message))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config_reader is now actually just the Actor instance of the committer. It would be very confusing to leave that name.
Also it breaks the API due to the type change. Code must be added to check the type of the input and act accordingly.

@Byron Byron merged commit 3a1e0d7 into gitpython-developers:0.3 Nov 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants