Uploaded image for project: 'Sourcetree For Mac'
  1. Sourcetree For Mac
  2. SRCTREE-4762

Refresh automatically doesn’t detect changes to global gitignore

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 2.5.2
    • None
    • Severity 3 - Minor

      Adding files to the global gitignore (usually) doesn’t trigger the automatic refresh, but it should.

      Setup

      1. In SourceTree, make sure “Refresh automatically when files change” is checked. Confirm this:
        1. ~/ $ mkdir demoIgnoreGlobal
          ~/ $ cd demoIgnoreGlobal/
          demoIgnoreGlobal/ $ git init
          Initialized empty Git repository in ~/demoIgnoreGlobal/.git/
        2. Open ~/demoIgnoreGlobal in SourceTree. SourceTree correctly displays it as an empty repository.
        3. demoIgnoreGlobal/ $ touch theBaz

          SourceTree will detect this file and automatically refresh (it may take a second or two), showing theBaz as unstaged.

        4. Confirm that command-line git sees the file:
          demoIgnoreGlobal/ $ git status
          On branch master
          
          Initial commit
          
          Untracked files:
            (use "git add <file>..." to include in what will be committed)
          
          	theBaz
          
          nothing added to commit but untracked files present (use "git add" to track)
        5. demoIgnoreGlobal/ $ echo theBaz > .gitignore

          SourceTree will detect this change, correctly showing .gitignore as unstaged and hiding theBaz.

        6. Now that we’ve confirmed that the auto-refresh does work, remove the local .gitignore.
          demoIgnoreGlobal/ $ rm .gitignore

          SourceTree correctly shows theBaz as unstaged once again.

      2. Confirm that the global .gitignore is set up correctly.
        1. demoIgnoreGlobal/ $ git config --get core.excludesFile
          /Users/<username redacted>/.gitignore_global
        2. Open the SourceTree preferences pane, switch to the Git tab, and confirm that the path in the dialog matches the result of that command.

      Test

      1. demoIgnoreGlobal/ $ echo theBaz >> ~/.gitignore_global

        Watch SourceTree for a while. Most of the time, theBaz will not disappear. (It happened to me once, but I think I must have clicked something that triggered a refresh.)

      2. Click the file listing for theBaz. Double-click theBaz to have SourceTree open the file. SourceTree doesn’t refresh.
      3. Confirm that command-line git no longer sees the file:
        demoIgnoreGlobal/ $ git status
        On branch master
        
        Initial commit
        
        nothing to commit (create/copy files and use "git add" to track)

      Environment

      SourceTree-Beta Version 2.5.2 (109) (per the About dialog)

              Unassigned Unassigned
              669dd68e54d0 Harold Tessmann III
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: