#460 Ignore error when adding exclude patterns
Closed 4 years ago by onosek. Opened 4 years ago by lsedlar.
lsedlar/rpkg missing-exclude-file  into  master

file modified
+4 -1
@@ -1671,7 +1671,10 @@ 

          These changes are valid just for local git repository.

          """

          git_excludes_path = os.path.join(conf_dir, '.git/info/exclude')

-         git_excludes = GitIgnore(git_excludes_path)

+         try:

+             git_excludes = GitIgnore(git_excludes_path)

+         except (IOError, OSError):

+             return

          for item in self.git_excludes:

              git_excludes.add(item)

          git_excludes.write()

When I was investigating this for the first time, exclude file was missing. I have no idea why - during my testing was always created automatically after clone. Maybe it is some git_version related problem.
Why do you prefer using try/except approach more than creating an empty ignore file before?

I have no strong preference. If you think creating an empty file would be better, we could do that.

#463 brings "create new file" solution and replaces this PR. Thanks anyway.

Pull-Request has been closed by onosek

4 years ago