From 188b20533b91b376391f33114a5a44b0883cff84 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 3 Aug 2019 14:48:01 +0200 Subject: [PATCH] Only pull when on a branch --- nix/build-all.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nix/build-all.py b/nix/build-all.py index 8241e173f3..d2805d247a 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -334,11 +334,15 @@ def git_clone_or_pull_repository(clone_url, target_dir, revision=None): run([git, "clone", clone_url, target_dir]) else: logger.info("directory '%s' already cloned. Pulling latest changes." % (target_dir,)) - run([git, "pull", clone_url], cwd=target_dir) - + + # detect whether we are on a branch and pull + if run([git, "rev-parse", "--abbrev-ref", "HEAD"], cwd=target_dir) != "HEAD": + run([git, "pull", clone_url], cwd=target_dir) + if revision != None: run([git, "checkout", revision], cwd=target_dir) + def build_dependency(name, mode, build_tool_args, download_url, download_name, download_tool=download_tool_default, revision=None, patch=None, additional_files={}, no_append_name=False): """Handles building of dependencies with different tools (which are distinguished with the `mode` argument. `build_tool_args` is expected to be