GNOME Bugzilla – Bug 774977
Don't show TODO items from files outside version control
Last modified: 2017-10-13 23:10:35 UTC
Created attachment 340658 [details] screenshot of unhelpful TODOs Builder shows a bunch of TODO items from my configure script, written by the autoconf developers for future autoconf developers. That's not very useful! Screenshot attached. Since Builder knows which files are under version control and which aren't, it should probably ignore unversioned files. Or check .gitignore or something (I wonder if having .gitignore generated by git.mk is tripping up Builder here?)
I've finally noticed that the header bar says "unversioned." Why is that... it doesn't notice the .git directory...?
We try to discover the .git repository based on the project file that was opened. (configure.ac for example). We walk up the file-system tree looking for .git directories. Are you sure the git plugin was compiled? Are you running from git or Fedora packages or Flatpak?
I'm using the Fedora package gnome-builder-3.22.1-1.fc25. I'm not sure if I opened configure.ac as my project file. I probably didn't think to do that, I probably just selected the toplevel epiphany folder.
We also look for "configure.ac" as the highest priority I believe if you provide a directory. So we *should* have opened it as an autotools project. (If not, that too is a bug).
No, it's not being detected as an Autotools project for some reason. I deleted the project and tried to recreate it again, twice. The first time, I left the default build system "directory" selected in the bottom-right corner of the file chooser; the second time, I decided to be smarter, changed the combo to Autotools, and explicitly selected configure.ac. Even having clicked on configure.ac to create the project, the header bar still says "Epiphany / unversioned".
If you run gnome-builder -vvvv do you see any warnings? Any chance your source tree is on a non-ext4/xfs/etc file-system?
(In reply to Christian Hergert from comment #6) > If you run gnome-builder -vvvv do you see any warnings? Unbelievably, it's working fine today, using the same project I created yesterday that did not work yesterday. Deleting the project and recreating it from scratch following the same steps as yesterday, even when not bothering to select configure.ac or change the dropdown to Autotools, works just fine: it filters out all the unversioned files. Perhaps it only works correctly on weekends. ;) > Any chance your source tree is on a non-ext4/xfs/etc file-system? No.
(In reply to Michael Catanzaro from comment #7) > Unbelievably, it's working fine today, using the same project I created > yesterday that did not work yesterday. Ah, I got a Builder 3.22.1 -> 3.22.2 update. Surely that is what fixed it.
Created attachment 361425 [details] screenshot of builder 3.26 with unhelpful TODO items I have been bitten by this issue using Gnome Builder 3.26 (flatpak stable). It is a Python project using autotools (configure.ac) and git. I ran builder as follows: $ screenshot of unhelpful TODOs $ flatpak run org.gnome.Builder -vvvv 11:19:57.0561 builder[ 2]: MESSAGE: Initializing with Gtk+ version 3.22.20. [a bunch of messages about discovering/loading plugins, CSS] Once I open the project, the output is as follows: 11:20:07.0501 ide-git-vcs[ 12]: DEBUG: Discovered .git location at “file:///home/gpoo/code/prospects/2017/pybliographer/.git” 11:20:07.0501 ide-git-vcs[ 12]: DEBUG: Discovered .git location at “file:///home/gpoo/code/prospects/2017/pybliographer/.git” 11:20:07.0503 ide-unsaved-files[ 12]: DEBUG: Loading drafts manifest /home/gpoo/.var/app/org.gnome.Builder/data/gnome-builder/drafts/Pybliographer/manifest 11:20:07.0535 gb-file-search-index[ 12]: MESSAGE: File index built in 0.025020 seconds. 11:20:07.0542 gbp-flatpak-pipeline-addin[ 2]: MESSAGE: Configuration is not using flatpak, ignoring pipeline 11:20:07.0621 beautifier-config[ 2]: DEBUG: /home/gpoo/.var/app/org.gnome.Builder/config/gnome-builder/beautifier_plugin/global.ini doesn't exist 11:20:07.0622 beautifier-config[ 2]: DEBUG: "Error opening directory '/home/gpoo/.var/app/org.gnome.Builder/config/gnome-builder/beautifier_plugin': No such file or directory" 11:20:07.0622 beautifier-config[ 2]: DEBUG: /home/gpoo/code/prospects/2017/pybliographer/.beautifier/global.ini doesn't exist 11:20:07.0622 beautifier-config[ 2]: DEBUG: "Error opening directory '/home/gpoo/code/prospects/2017/pybliographer/.beautifier': No such file or directory" 11:20:07.0686 ide-subprocess-launcher[ 15]: DEBUG: Launching 'grep -A 5 -I -H -n -r -E --exclude=*.m4 --exclude=*.po --exclude-dir=.bzr --exclude-dir=.flatpak-builder --exclude-dir=.git --exclude-dir=.svn -e FIXME(:| ) -e XXX(:| ) -e TODO(:| ) -e HACK(:| ) /home/gpoo/code/prospects/2017/pybliographer' from directory '.' with environment PATH=/bin:/usr/bin HOME=/home/gpoo USER=gpoo LANG=en_CA.UTF-8 clearing parent environment 11:20:07.0727 gbp-todo-model[ 17]: DEBUG: Located 38 TODO items in 0.0408 seconds
FWIW, the first time I opened the project, I opened the directory. In the list of projects it appears as Python and Make. I tried opening the same project, but this time opening the configure.ac file. In the list of projects it appears as Python and Autotools. However, the ToDo list is the same either way.
Created attachment 361562 [details] [review] vcs: add ide_vcs_path_is_ignored() This function allows for checking if a file should be ignored similar to ide_vcs_is_ignored(). It's purpose is to save the caller from dealing with the burden of checking if a GFile creation needs to be relative to the project or absolute. It also is slightly faster in checking against known regexes for ignored globs.
Created attachment 361563 [details] [review] todo: check VCS if file is ignored Before adding the TODO item to the list, we want to check if it is ignored so the user doesn't get spammed with TODO items that are not related to their core project. One such example would be libtool and m4 macros in autotools- based projects.
Looks like we weren't checking with the VCS when building our model of TODO items. This adds some helper code to the VCS and checks to see if the file is ignored when building the model. Thanks for reporting! Attachment 361562 [details] pushed as 257db6a - vcs: add ide_vcs_path_is_ignored() Attachment 361563 [details] pushed as 678e315 - todo: check VCS if file is ignored