From 339ad9687661705cc0e68a5c7b3b3fe84278faf4 Mon Sep 17 00:00:00 2001 From: mjonker-embed Date: Wed, 15 Apr 2015 12:10:53 +0200 Subject: [PATCH 1/3] Skip unitialized repo's These gave me errors which caused mails from crontab. --- bin/github-backup | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/github-backup b/bin/github-backup index aa16823..7fa3fa3 100755 --- a/bin/github-backup +++ b/bin/github-backup @@ -357,6 +357,11 @@ def fetch_repository(name, remote_url, local_dir, skip_existing=False): if clone_exists and skip_existing: return + initalized = subprocess.call('git ls-remote ' + remote_url, stdout=FNULL, stderr=FNULL, shell=True) + if initalized == 128: + log_info("Skipping {} since it's not initalized".format(name)) + return + if clone_exists: log_info('Updating {} in {}'.format(name, local_dir)) git_command = ['git', 'fetch', '--all', '--tags', '--prune'] From 3e82d829e4283d39f19b5c1eefb60009ab939658 Mon Sep 17 00:00:00 2001 From: mjonker-embed Date: Wed, 15 Apr 2015 12:14:55 +0200 Subject: [PATCH 2/3] Update github-backup --- bin/github-backup | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/github-backup b/bin/github-backup index 7fa3fa3..f593aa0 100755 --- a/bin/github-backup +++ b/bin/github-backup @@ -19,6 +19,7 @@ import urllib2 from github_backup import __version__ +FNULL = open(os.devnull, 'w') def log_error(message): if type(message) == str: From 7ce61202e5cdecca29438d105600494415b5be3b Mon Sep 17 00:00:00 2001 From: Mathijs Jonker Date: Wed, 15 Apr 2015 12:21:58 +0200 Subject: [PATCH 3/3] Fixed indent --- bin/github-backup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/github-backup b/bin/github-backup index f593aa0..72bdcfd 100755 --- a/bin/github-backup +++ b/bin/github-backup @@ -359,9 +359,9 @@ def fetch_repository(name, remote_url, local_dir, skip_existing=False): return initalized = subprocess.call('git ls-remote ' + remote_url, stdout=FNULL, stderr=FNULL, shell=True) - if initalized == 128: - log_info("Skipping {} since it's not initalized".format(name)) - return + if initalized == 128: + log_info("Skipping {} since it's not initalized".format(name)) + return if clone_exists: log_info('Updating {} in {}'.format(name, local_dir))