diff options
Diffstat (limited to 'scripts/combo-layer')
-rwxr-xr-x | scripts/combo-layer | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer index 7380f5b959..7435a176be 100755 --- a/scripts/combo-layer +++ b/scripts/combo-layer | |||
@@ -586,13 +586,25 @@ def action_pull(conf, args): | |||
586 | ldir = repo['local_repo_dir'] | 586 | ldir = repo['local_repo_dir'] |
587 | branch = repo.get('branch', "master") | 587 | branch = repo.get('branch', "master") |
588 | logger.info("update branch %s of component repo %s in %s ..." % (branch, name, ldir)) | 588 | logger.info("update branch %s of component repo %s in %s ..." % (branch, name, ldir)) |
589 | runcmd("git checkout %s" % branch, ldir) | ||
590 | if not conf.hard_reset: | 589 | if not conf.hard_reset: |
591 | output=runcmd("git pull --ff-only", ldir) | 590 | # Try to pull only the configured branch. Beware that this may fail |
592 | logger.info(output) | 591 | # when the branch is currently unknown (for example, after reconfiguring |
592 | # combo-layer). In that case we need to fetch everything and try the check out | ||
593 | # and pull again. | ||
594 | try: | ||
595 | runcmd("git checkout %s" % branch, ldir, printerr=False) | ||
596 | except subprocess.CalledProcessError: | ||
597 | output=runcmd("git fetch", ldir) | ||
598 | logger.info(output) | ||
599 | runcmd("git checkout %s" % branch, ldir) | ||
600 | runcmd("git pull --ff-only", ldir) | ||
601 | else: | ||
602 | output=runcmd("git pull --ff-only", ldir) | ||
603 | logger.info(output) | ||
593 | else: | 604 | else: |
594 | output=runcmd("git fetch", ldir) | 605 | output=runcmd("git fetch", ldir) |
595 | logger.info(output) | 606 | logger.info(output) |
607 | runcmd("git checkout %s" % branch, ldir) | ||
596 | runcmd("git reset --hard FETCH_HEAD", ldir) | 608 | runcmd("git reset --hard FETCH_HEAD", ldir) |
597 | 609 | ||
598 | def action_update(conf, args): | 610 | def action_update(conf, args): |