Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Ignores _sgbak folders by default #31

wants to merge 2 commits into from

2 participants


_sgbak folders hold the old versions in SourceGear's Vault directory. Ignoring it is the default behavior in ack. This is a pretty quick and dirty patch, and it seems like this will eventually go in the "huge-ass list of files we want to ignore by default". I dunno if you really want this, but I needed it and figured I'd throw it out there.


Whoops, left in a printf. One sec.


First, thanks for submitting this pull request. I like it when people err on the side of contributing code rather than hoarding it.

That said, I don't want to merge it, for several reasons. I do need to make some better defaults for ignoring files, but I don't think hard-coded strcmp()s are the way to go. Also, your patch will ignore _sgbak even if ag is run with -u for unrestricted searches.

I don't know if you already know this, but if you want to ignore files you can put patterns in a .agignore file. It works just like git's .gitignore and Mercurial's .hgignore.

@ggreer ggreer closed this

No problem. Thanks for the feedback :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 20, 2012
  1. @epmatsw
  2. @epmatsw

    changed printf to debug log

    epmatsw authored
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/ignore.c
8 src/ignore.c 100644 → 100755
@@ -122,9 +122,13 @@ int filename_filter(struct dirent *dir) {
char *pattern = NULL;
int rc = 0;
int i;
+ if(strcmp(filename, "_sgbak")==0)
+ {
+ log_debug("File %s ignored because it's an _sgbak file", dir->d_name);
+ return(0);
+ }
if (!opts.follow_symlinks && dir->d_type == DT_LNK) {
- log_debug("File %s ignored becaused it's a symlink", dir->d_name);
+ log_debug("File %s ignored because it's a symlink", dir->d_name);
Something went wrong with that request. Please try again.