Permalink
Browse files

git state should report "changed" on first clone

Was trying to write a state that recompiled when the repo changed,
without something like this it wouldn't compile the first time it was
cloned
  • Loading branch information...
1 parent f57034a commit 0e237f8caa1afd673a8afa0a41386b258e1c0367 @blast-hardcheese committed Jul 7, 2012
Showing with 10 additions and 5 deletions.
  1. +10 −5 salt/states/git.py
View
@@ -100,13 +100,18 @@ def latest(name,
result = __salt__['git.clone'](target, name, user=runas)
if not os.path.isdir(target):
return _fail(ret, result)
+
if rev:
__salt__['git.checkout'](target, rev, user=runas)
- else:
- message = 'Repository {0} cloned to {1}'.format(name, target)
- log.info(message)
- ret['comment'] = message
- ret['changes']['new'] = name
+
+ new_rev = __salt__['git.revision'](cwd=target, user=runas)
+
+ message = 'Repository {0} cloned to {1}'.format(name, target)
+ log.info(message)
+ ret['comment'] = message
+
+ ret['changes']['new'] = name
+ ret['changes']['revision'] = new_rev
return ret

0 comments on commit 0e237f8

Please sign in to comment.