mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
sb: Fix git to clean before updating.
This commit is contained in:
parent
b77019a91e
commit
8c19df26f6
@ -211,6 +211,7 @@ def _git_downloader(url, local, config, opts):
|
||||
if not opts.dry_run():
|
||||
repo.clone(us[0], local)
|
||||
else:
|
||||
repo.clean(['-f', '-d'])
|
||||
repo.reset('--hard')
|
||||
repo.checkout('master')
|
||||
for a in us[1:]:
|
||||
|
@ -97,6 +97,11 @@ class repo:
|
||||
def submodule(self, module):
|
||||
ec, output = self._run(['submodule', 'update', '--init', module], check = True)
|
||||
|
||||
def clean(self, args):
|
||||
if type(args) == str:
|
||||
args = [args]
|
||||
ec, output = self._run(['clean'] + args, check = True)
|
||||
|
||||
def status(self):
|
||||
_status = {}
|
||||
if path.exists(self.path):
|
||||
@ -124,7 +129,7 @@ class repo:
|
||||
_status[state] += [l.strip()]
|
||||
return _status
|
||||
|
||||
def clean(self):
|
||||
def dirty(self):
|
||||
_status = self.status()
|
||||
return len(_status) == 1 and 'branch' in _status
|
||||
|
||||
|
@ -302,7 +302,7 @@ class command_line:
|
||||
if repo.valid():
|
||||
repo_valid = '1'
|
||||
repo_head = repo.head()
|
||||
repo_clean = repo.clean()
|
||||
repo_clean = not repo.dirty()
|
||||
repo_id = repo_head
|
||||
if not repo_clean:
|
||||
repo_id += '-modified'
|
||||
|
Loading…
x
Reference in New Issue
Block a user