Commit ac8c68d3 authored by Thibault Saunier's avatar Thibault Saunier 🌵
Browse files

Do not try to upload file that have been checked out in git

parent 1dcdf7d5
......@@ -47,6 +47,15 @@ def call(cmd, options, msg=None):
print('DRY: %s' % msg)
def in_git(fpath):
subprocess.check_output(['git', 'ls-files', '--error-unmatch', fpath],
return True
except subprocess.CalledProcessError as e:
return False
def is_binary(fpath):
with open(fpath, 'rb') as f:
......@@ -91,6 +100,11 @@ if __name__ == "__main__":
fname = os.path.join(root, f)
rpath = fname[len(fdir) + 1:]
if in_git(fname):
if options.verbose:
print("%s is in git." % fname)
if not is_binary(fname):
if options.verbose:
print("Warning: %s is a text file" % fname)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment