Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,359,975
Community Members
 
Community Events
168
Community Groups

Unable to stage hunks or lines of code in JS files

When I try to stage individual hunks or lines of code from a file, they appear to be staged correctly and the rest of the file remains unstaged. However, after I submit my commit, the entire file is committed.

I've noticed this happening a little prior to March 18th. I suspect it might only be happening in JS files, but I haven't 100% confirmed this to be the case yet.

Has anyone else encountered this issue?

1 answer

0 votes
Daniel Eads Atlassian Team Apr 19, 2021

Hey @jordangehman , welcome to the Community!

I haven't seen other mentions of this issue yet but would love to try and reproduce it. What OS and version of Sourcetree are you on? It also sounds odd that it would be restricted to a particular filetype (it's all text to git/sourcetree), but what other languages or filetypes besides javascript do you typically work with?

Thanks,
Daniel

Thanks Daniel! I agree this seems like an odd issue I've encountered.

I'm on MacOS Big Sur 11.2.3 using Sourcetree version 4.1.0.

I also work in a lot of PHP and SCSS files. I will try to reproduce it soon and get back to you.

@Daniel Eads I have confirmed I can only reproduce this in one specific React project, and it only happens when making commits from `.js` files. What information would be helpful for me to share to help identify the issue?

@Daniel Eads I got some more information from a coworker. This particular React project has a pre-commit hook installed via Husky. As part of committing, it runs lint and prettier. From the `package.json` file:

"husky": {
    "hooks": {
        "pre-commit": "lint-staged"
    }
},
"lint-staged": {
    "*.{js,json,jsx,css,md}": [
        "prettier --write",
        "git add"
    ]
},

It seems likely that this is the culprit; there is probably a conflict with this and SourceTree that causes the app to commit the entire file.

Daniel Eads Atlassian Team Apr 26, 2021

Great, thanks for the additional context! I've tapped the Sourcetree development team for their insights here and hope to have something for you shortly.

Like jordangehman likes this
Alan Francis Atlassian Team May 10, 2021

Hi @jordangehman ,
We are currently looking into this issue and we hope we can come up with a fix soon.
We will update here once we figure out that.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Bug Fix: Sourcetree for Windows authentication error when updating to app password

Hello Sourcetree users!!! With the recent removal of Bitbucket Cloud account passwords for app passwords (please see our Bitbucket Cloud community post for details on why we made this change for se...

78,687 views 134 29
Read article

Atlassian Community Events