[yocto] [PATCH V4 09/10] update.py: add -p to git fetch

Robert Yang liezhi.yang at windriver.com
Mon Jun 12 19:36:50 PDT 2017

-p, --prune
    Before fetching, remove any remote-tracking references that no longer exist on the remote.

$ git push origin :test_branch
$ ./update.py

The test_branch was still in fetched local repo which was incorrect, it should
be gone since it has been removed by upstream.

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
 layerindex/update.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/layerindex/update.py b/layerindex/update.py
index 0046f38..1512743 100755
--- a/layerindex/update.py
+++ b/layerindex/update.py
@@ -262,7 +262,7 @@ def main():
                             if not os.path.exists(repodir):
                                 out = utils.runcmd("git clone %s %s" % (layer.vcs_url, urldir), fetchdir, logger=logger, printerr=False)
-                                out = utils.runcmd("git fetch", repodir, logger=logger, printerr=False)
+                                out = utils.runcmd("git fetch -p", repodir, logger=logger, printerr=False)
                         except subprocess.CalledProcessError as e:
                             logger.error("Fetch of layer %s failed: %s" % (layer.name, e.output))
                             failedrepos[layer.vcs_url] = e.output
@@ -277,7 +277,7 @@ def main():
                 if not os.path.exists(bitbakepath):
                     out = utils.runcmd("git clone %s %s" % (settings.BITBAKE_REPO_URL, 'bitbake'), fetchdir, logger=logger)
-                    out = utils.runcmd("git fetch", bitbakepath, logger=logger)
+                    out = utils.runcmd("git fetch -p", bitbakepath, logger=logger)
             if options.actual_branch:
                 update_actual_branch(layerquery, fetchdir, branches[0], options, update_bitbake, bitbakepath)

More information about the yocto mailing list