Skip to content

Repository.createCommitOnHead ignores filesToAdd argument #655

@freder

Description

@freder

hi,

it looks like Repository.createCommitOnHead ignores the first argument filesToAdd. it is not using it at all, and instead adds all the files!

and that is why this function to create empty commits doesn't work as expected when there are (unstaged) files with changes:

function createEmptyCommit(repo, message, sig) {
    var files = []; // <--
    sig = sig || createSignature();
    var author = sig;
    var committer = sig;

    return unstageAll(repo) // make sure commit is in fact empty. (does a mixed reset)
        .then(function() {
            return repo.createCommitOnHead(
                files,
                author,
                committer,
                message
            );
        })
        .catch(function(err) {
            handleError(err);
        });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions