mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-08 07:18:27 +01:00
No commit history issue
This commit is contained in:
+8
-1
@@ -427,13 +427,20 @@ class GitWrapper(GitWrapperI):
|
||||
@staticmethod
|
||||
def git_prev_commit():
|
||||
cmd = 'git check-ref-format --branch @{-1}'
|
||||
return Executor.exec_cmd_only_success(cmd.split()).strip()
|
||||
code, out, err = Executor.exec_cmd(cmd.split())
|
||||
if code != 0:
|
||||
return ''
|
||||
return out
|
||||
|
||||
@staticmethod
|
||||
def state_files_for_previous_commit():
|
||||
commit = GitWrapper.git_prev_commit()
|
||||
Logger.debug(u'[dvc-git] Previous commit "{}"'.format(commit))
|
||||
|
||||
if not commit:
|
||||
Logger.debug(u'[dvc-git] Previous commit does not exist')
|
||||
return []
|
||||
|
||||
git_cmd = u'git ls-tree --name-only -r {}'.format(commit)
|
||||
lines = Executor.exec_cmd_only_success(git_cmd.split()).split('\n')
|
||||
return filter(lambda s: s.startswith(ConfigI.STATE_DIR), lines)
|
||||
|
||||
Reference in New Issue
Block a user