From 155576e33aba02462bc0275c5e5df9cadc628cca Mon Sep 17 00:00:00 2001 From: Thomas Lucas Date: Wed, 25 Jul 2018 12:07:24 +0100 Subject: [PATCH 1/2] files_changed() now looking for "working tree clean", as well as "working directory clean", since this is the message since git v2.9.1. https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.9.1.txt --- sharelatex-git.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sharelatex-git.py b/sharelatex-git.py index b761d38..050e21b 100755 --- a/sharelatex-git.py +++ b/sharelatex-git.py @@ -196,7 +196,9 @@ def commit_all_changes(message, title): #------------------------------------------------------------------------------ def files_changed(): out = run_cmd('git status .').decode('utf-8') - return 'nothing to commit, working directory clean' not in out.lower() + return ('nothing to commit, working directory clean' not in out.lower() + and + 'nothing to commit, working tree clean' not in out.lower()) #------------------------------------------------------------------------------ # Download the sharelatex project and extract it. Die out if there's any From a94a3d4394b5fcfb3737df0ba1b5bb4527220f81 Mon Sep 17 00:00:00 2001 From: Thomas Lucas Date: Wed, 25 Jul 2018 12:44:38 +0100 Subject: [PATCH 2/2] Allow importing as a module --- sharelatex-git | 2 +- sharelatex-git.py => sharelatex_git.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) rename sharelatex-git.py => sharelatex_git.py (99%) mode change 100755 => 100644 diff --git a/sharelatex-git b/sharelatex-git index 12c615b..9b4b2cc 120000 --- a/sharelatex-git +++ b/sharelatex-git @@ -1 +1 @@ -sharelatex-git.py \ No newline at end of file +sharelatex_git.py \ No newline at end of file diff --git a/sharelatex-git.py b/sharelatex_git.py old mode 100755 new mode 100644 similarity index 99% rename from sharelatex-git.py rename to sharelatex_git.py index 050e21b..d707360 --- a/sharelatex-git.py +++ b/sharelatex_git.py @@ -146,7 +146,7 @@ def write_if_not_there(s): if s not in lines: f.write(s + '\n') - write_if_not_there('sharelatex-git.py') + write_if_not_there('sharelatex_git.py') write_if_not_there('sharelatex-git') write_if_not_there('.sharelatex-git') except: @@ -437,4 +437,5 @@ def parse_input(): #------------------------------------------------------------------------------ # Go, go, go! #------------------------------------------------------------------------------ -go(*parse_input()) +if __name__ == '__main__': + go(*parse_input())