diff options
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/builder.py | 1 | ||||
-rw-r--r-- | morphlib/git.py | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py index ed21f623..4bbf4464 100644 --- a/morphlib/builder.py +++ b/morphlib/builder.py @@ -115,6 +115,7 @@ class Factory(object): os.mkdir(destdir) morphlib.git.copy_repository(treeish, destdir, msg) morphlib.git.checkout_ref(destdir, treeish.ref, msg) + morphlib.git.reset_workdir(destdir, msg) return [(sub.treeish, os.path.join(destdir, sub.path)) for sub in treeish.submodules] diff --git a/morphlib/git.py b/morphlib/git.py index 950fba31..0ee07259 100644 --- a/morphlib/git.py +++ b/morphlib/git.py @@ -252,6 +252,13 @@ def checkout_ref(gitdir, ref, msg=logging.debug): ex = morphlib.execute.Execute(gitdir, msg=msg) ex.runv(['git', 'checkout', ref]) +def reset_workdir(gitdir, msg=logging.debug): + '''Removes any differences between the current commit ''' + '''and the status of the working directory''' + ex = morphlib.execute.Execute(gitdir, msg=msg) + ex.runv(['git', 'clean', '-fxd']) + ex.runv(['git', 'reset', '--hard', 'HEAD']) + def set_submodule_url(gitdir, name, url, msg=logging.debug): '''Changes the URL of a submodule to point to a specific location.''' ex = morphlib.execute.Execute(gitdir, msg=msg) |