Skip to content
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

Blame uses committer not author #33

Closed
KenCoder opened this issue Apr 4, 2018 · 2 comments
Closed

Blame uses committer not author #33

KenCoder opened this issue Apr 4, 2018 · 2 comments

Comments

@KenCoder
Copy link

KenCoder commented Apr 4, 2018

If the committer and author are different for a commit, blame always uses committer even if you specify author.name. I wonder if this is what's behind #32

Looking at the code, I believe it is due to the following problem. When blame.ts initializes a commit object, it uses the exact same reference for emptyAuthor for both author and commit. When stream.ts reads the information, it mutates the owner object, which in this case points to both the author and the commit. I think the solution is simply to copy the object when initializing in blame.ts.

I would submit a CR but don't want to spend the time setting everything up, reproing, creating a test, etc.

Fix in blame.ts

const commitInfo = {
            author: {...emptyAuthor},
            committer: {...emptyAuthor},

Original blame.ts

const commitInfo = {
            author: emptyAuthor,
            committer: emptyAuthor,
            filename: "",
            generated: true,
            hash: HASH_NO_COMMIT_GIT,
            summary: "",
        } as IGitCommitInfo;

stream.ts - point where it is mutated

       if (keyPrefix === "author") {
            owner = commitInfo.author;
        } else if (keyPrefix === "committer") {
            owner = commitInfo.committer;
        }

        if (!owner.temporary && !keySuffix) {
            owner.name = value;
@Sertion
Copy link
Owner

Sertion commented Apr 5, 2018

Hey KenCoder! Thank you for the issue and investigation.

This will be fixed in the upcoming version.

@Sertion
Copy link
Owner

Sertion commented Apr 5, 2018

This has been solved in 2.4.2.

@Sertion Sertion closed this as completed Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants