Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Atom doesn't update file buffers correctly when switching branches. #4982

Closed

Description

@AustP

Steps to reproduce.

  1. git checkout master
  2. git checkout -b new_feature
  3. Open Atom with no files loaded.
  4. Open an existing file and modify it. Keep it open.
  5. git commit -am "Modifying file"
  6. git checkout master

At this point you'd expect to see that the edits which you made would be gone since you are now viewing a different branch. However, the edits show up and git diff even highlights them.

Also PR #1271 supposedly fixed #693 (Closing file buffers when a file gets removed via git i.e. switching branches, deleting, etc.) but that is not happening for me. When I switch branches and a file gets removed, it stays open in Atom with no indication that it's not supposed to be there.

Edit: Personally I think a file getting removed via git should automatically close the buffer, while a file getting removed in another way should prompt you. "This file no longer exists, do you want to keep it open?". This is how Notepad++ handles the situation and I think that is the best way.

Activity

  1. lee-dohm commented on Jan 10, 2015

    @lee-dohm
    Contributor

    Could you include the following information?

    • Which version of Atom are you using?
    • What OS and version are you running?
    • Can you reproduce the issue after completely exiting Atom and restarting using atom --safe?
  2. AustP commented on Jan 11, 2015

    @AustP
    Author

    @lee-dohm Using atom --safe fixed the issue temporarily. After step 6 I switched back and forth between new_feature and master a few more times and the issue occurred after switching for the 5th time. I'm running Windows 7 with Atom v 0.169.0

  3. AustP commented on Jan 14, 2015

    @AustP
    Author

    @benogle What more information do you need?

  4. benogle commented on Jan 14, 2015

    @benogle
    Contributor

    We need whatever information can help us reproduce it, at which point we could consider it a bug. I am sadly not able to reproduce this issue

    Personally I think a file getting removed via git should automatically close the buffer, while a file getting removed in another way should prompt you.

    This does happen for me. Steps for this: a file on master but not on your branch, and you switch from master to the branch, it should close.

  5. AustP commented on Jan 14, 2015

    @AustP
    Author

    @benogle Hmm are you trying this in Windows? I've updated to 0.172.0 and still seeing the issue.

  6. AustP commented on Jan 26, 2015

    @AustP
    Author

    @benogle Do you need any more information?

  7. AustP commented on Feb 3, 2015

    @AustP
    Author

    I don't know if this will help but I submitted a ticket on the git-utils repo.
    Specs failing on Windows

    The issue may be stemming back to libgit2 but I'm unsure.

  8. samtechie commented on Jul 10, 2015

    @samtechie

    I experienced a similar issue. Am using Atom 1.0 on OpenSuse 13.2 and when i switched to a different branch. The old files which I created on the other branch were still there. When I tried to close them . It asked if i should save the changes. I also think they should just disappear from the buffer.

  9. alexcreasy commented on Jul 16, 2015

    @alexcreasy

    I'm having the same problem on Fedora 20 using Atom 1.0. When switching branches I have to manually close windows and select don't save for each file that doesn't exist on the newly switched branch. I think the files should just disappear from the buffer also.

  10. lpommers commented on Aug 20, 2015

    @lpommers

    Just thought I would say that I've only ever experienced this when switching branches from a tool other than the command line i.e. sourceTree atom 1.0.7 OSX 10.10.5 git 2.3.2

    if I switch from terminal or iterm then everything works as expected

  11. 118 remaining items

  12. alecbz commented on Nov 16, 2017

    @alecbz

    Solution by @ungb is pretty good, but kind of unfortunate that there's not more direct git integration here. E.g.: it'd be nice if this happened when the git branch switches, but not for general deletions otherwise (this way atom would save the buffer if it was accidentally deleted by some other mechanism).

  13. philippgovernale commented on Jan 30, 2018

    @philippgovernale

    On 1.23.3 I am still having these issues even with the solution by @ungb. Files do not update after changing branch. Not even restarting has worked so I am forced to use another text editor.

  14. zbroniszewski commented on Feb 12, 2018

    @zbroniszewski

    I was not having this problem up until a couple days ago. I'm running Ubuntu 16.04.3 LTS, atom 1.2.3 downloaded by adding the repo to my system. If I completely wipe my disk, reinstall Ubuntu, install atom, and test switching branches, it will work. When I restart my computer, it stops working. In the bottom pane of atom where it tells you the branch you are on, that only changes the branch name once you give focus to atom after running for example "git checkout newBranch" in terminal. So to summarize, if I checkout a new branch, nothing will happen. When I click into atom, it will change the branch, the git diff package will highlight changed lines, BUT no lines or code will actually change. This used to work perfect. I've tried installing older versions of atom, same thing. This is extremely annoying. Any updates on this? It's clearly effecting a lot of users.

  15. zbroniszewski commented on Feb 12, 2018

    @zbroniszewski

    Well, I think I figured it out. At least on Ubuntu 16.04.3 LTS. An application I was installing (ULauncher) seems to have an effect on this issue. When I install it, this feature of atom breaks. When I remove it, and run sudo apt-get autoremove it works fine after a reboot.

    For anybody who uses ULauncher, you know you have to fix a broken install when you install it for the first time. Here's what appears after sudo apt-get install -f

    The following additional packages will be installed:
    gir1.2-keybinder-3.0 libkeybinder-3.0-0 python-backports.ssl-match-hostname python-dbus python-gi python-levenshtein python-pkg-resources python-pyinotify python-pysqlite2 python-six python-websocket python-xdg
    Suggested packages:
    python-dbus-doc python-dbus-dbg python-gi-cairo python-setuptools python-pyinotify-doc python-pysqlite2-doc python-pysqlite2-dbg
    The following NEW packages will be installed:
    gir1.2-keybinder-3.0 libkeybinder-3.0-0 python-backports.ssl-match-hostname python-dbus python-gi python-levenshtein python-pkg-resources python-pyinotify python-pysqlite2 python-six python-websocket python-xdg

    So perhaps its one of these python packages? No clue, just hope this helps give us a clue. Remember, this might not necessarily be a ULauncher thing but ANY application or program that requires one of these packages that are screwing this feature of atom up.

    If anybody can help me out who runs Ubuntu and has this issue (4982), please run a sudo dpkg -l {package-name} on the packages listed above under "The following NEW packages will be installed:"

    If we get enough people to do this and cross-reference, we can triangulate that pesky package.

  16. zbroniszewski commented on Feb 13, 2018

    @zbroniszewski

    I can confirm that it has to be a package required from ULauncher. To test my hypothesis, I tried a few things:
    1.) I set ULauncher to boot on login, rebooted, and atom was having this issue when trying to switch branches.
    2.) I removed ULauncher from Startup Applications, rebooted, launched atom BEFORE starting ULauncher, and everything was working perfect.
    3.) I kept ULauncher out of Startup Applications just as it was previously, rebooted, but this time I opened ULauncher BEFORE atom, and the issue of this thread occurred yet again.

    It's worthy to note that it appears that everything depends on which application is started first, if I start ULauncher before atom, this issue will always result during the current session. However, if I start atom first, everything will work perfect during the current session, even if I open ULauncher as many times as I want afterwards.

    I'm searching for all of atom's dependencies as Linux packages but I can't seem to find anything helpful online, does anybody know how I can view atom's dependencies?

  17. zbroniszewski commented on Feb 13, 2018

    @zbroniszewski

    @philippgovernale @AlecBenzer @jcmarchi @adamsimonini @goodlux please check my recent comments, maybe we can finally figure this out after two years!

  18. samablews commented on Feb 16, 2018

    @samablews

    Still having this issue in Atom 1.24.0 on MacOS 10.12.6. vi shows updated file contents but Atom keeps loading an old version. This is after doing a pull request.

  19. zbroniszewski commented on Feb 17, 2018

    @zbroniszewski

    @samablews please read my comments above yours. I know we are on different operating systems, but if there is a way to disable ALL startup applications on Mac, do that, then reboot. Open atom ONLY when you boot, then the console or whatever you use to switch branches. See if atom updates the files correctly.

  20. stanfieldr commented on Feb 20, 2018

    @stanfieldr
    Contributor

    I am not using git, but am doing something similar and my tab isn't updating. Figured out how to reproduce the issue if it helps.

    $ cd projectA
    $ touch diff.diff
    $ atom . # Close all tabs if you have any open, it doesn't seem reproducible if you do not
    $ cd ../projectB
    $ atom . # Only can reproduce if two editors open in different projects
    $ cd ../projectA
    $ printf 'test\n1' > diff.diff
    # Go to atom with projectA, hit ctrl+p, open diff.diff
    # Notice test then new line then 1
    $ printf 'test\n2' > diff.diff
    # Does not update tab to show test 2... only if you close tab and reopen.
    

    I'm running Fedora 27 with Atom 1.23.3

  21. DmitriWolf commented on Feb 23, 2018

    @DmitriWolf

    I also have this problem and find it very annoying. Closing and re-opening the tab is a fail because it is useful to be able to ctrl-z and ctrl-shift-z to compare the changes that happened when you switched a branch. When you close and re-open the file, those changes are lost.

    I'm surprised that this is marked as "closed". It looks like this is not going to get fixed. It surprises me that folks who maintain this project don't find it annoying as well.

    Looks like I'll be switching to another editor.

  22. izzydoescode commented on Mar 17, 2018

    @izzydoescode

    +1 to closing tabs that don't exist on destination branch when switching between branches. I know Atom doesn't assume workflow and that's why it leaves it open.

    How about a setting that can toggle this feature on and off so user can decide?

  23. ktravelet commented on Mar 17, 2018

    @ktravelet

    Sorry for the not so helpful comment but this issue has made me switch to VSCode and I haven't looked back since. I'd really like to develop with non-Corporate open source projects but VSCode is so much better than the alternatives. Please feel free to reach out to everyone once Atom catches back up and I'd be more than happy to come back.

  24. jcmarchi commented on Mar 17, 2018

    @jcmarchi
  25. locked as off topic and limited conversation to collaborators on Mar 20, 2018
  26. lee-dohm commented on Mar 20, 2018

    @lee-dohm
    Contributor

    Thanks everyone for the feedback on this. Unfortunately, the conversation has gotten way off the point here. I'm going to lock this issue for further comments. If people have a bug they would like to report, please open a new issue and fill out the required template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    atombuggitlinuxwindows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions