summaryrefslogtreecommitdiffstats
path: root/git_taskrepo
diff options
context:
space:
mode:
authorBill Peck <bpeck@redhat.com>2015-05-08 09:46:49 -0400
committerBill Peck <bpeck@redhat.com>2015-05-08 09:46:49 -0400
commitb05f20ffe45fe2bea2f955bb4d318b86f7bc2f9b (patch)
tree95b7779bd1e3eafc05846fc094dcce20f0307547 /git_taskrepo
parent8c8a36a4471727f71f0f4ef8d35a2cfb06e548c6 (diff)
downloadtaskrepo-b05f20ffe45fe2bea2f955bb4d318b86f7bc2f9b.tar.gz
taskrepo-b05f20ffe45fe2bea2f955bb4d318b86f7bc2f9b.tar.xz
taskrepo-b05f20ffe45fe2bea2f955bb4d318b86f7bc2f9b.zip
Keep track of dirty repo on our own. If repo has no HEAD is_dirty will throw a traceback.
Diffstat (limited to 'git_taskrepo')
-rw-r--r--git_taskrepo/sub_commands/cmd_init.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/git_taskrepo/sub_commands/cmd_init.py b/git_taskrepo/sub_commands/cmd_init.py
index 2a2ea27..f866a7f 100644
--- a/git_taskrepo/sub_commands/cmd_init.py
+++ b/git_taskrepo/sub_commands/cmd_init.py
@@ -71,21 +71,24 @@ class Init(Command):
cur.execute("INSERT INTO config(origin) VALUES (?)", (remote,))
index = self.repo.index
+ is_dirty = False
# Add taskrepo.db to .gitignore
gitignore = "%s/.gitignore" % self.repo.working_tree_dir
if update_file(gitignore, "taskrepo.db"):
print(" - Added taskrepo.db to .gitignore")
index.add([gitignore])
+ is_dirty = True
# Add testinfo.desc to .gitignore
gitignore = "%s/.gitignore" % self.repo.working_tree_dir
if update_file(gitignore, "testinfo.desc"):
print(" - Added testinfo.desc to .gitignore")
index.add([gitignore])
+ is_dirty = True
# if we updated the repo then commit it
- if self.repo.is_dirty(working_tree=False):
+ if is_dirty:
assert index.commit("Initialized to use git taskrepo.").type == 'commit'
print(" - committed to git")