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

Splitter character in the log result #985

Closed
adamsol opened this issue Mar 24, 2024 · 2 comments · Fixed by #1024
Closed

Splitter character in the log result #985

adamsol opened this issue Mar 24, 2024 · 2 comments · Fixed by #1024

Comments

@adamsol
Copy link

adamsol commented Mar 24, 2024

When I run the following git log command with a custom format:

simpleGit().log({
    format: {
        subject: '%s',
        body: '%b',
    },
});

I'm getting the splitter character at the end of the subject, like this:

{
    "subject": "Initial commit ò",
    "body": "",
}

It happens only when the body is empty. When I swap the order of attributes in the format dictionary, the character is displayed at the beginning instead. Everything seems to work fine if there's at least one attribute in the format dictionary both before and after body.

Git version: 2.37.2.windows.2

@adamsol
Copy link
Author

adamsol commented Mar 24, 2024

Another use case -- I wanted to get the commit hash and parent hash:

simpleGit().log({
    format: {
        hash: '%H',
        parents: '%P',
    },
});

Seemed to work fine, but not for the initial commit, which also got the additional ò character at the end, as parents is empty in this case.

steveukx added a commit that referenced this issue Sep 15, 2024
…ave part of the field separator in the preceding field.

The default splitter ` ò ` surrounds the character with spaces that were being trimmed through a needless use of `String#trim` in the parser.

Closes #985
@steveukx
Copy link
Owner

Thank you for reporting this issue - the next version will include a fix to work as expected.

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

Successfully merging a pull request may close this issue.

2 participants