From ca12db51773bfcc3247842fb68a7a896bd0b04d1 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Oct 2017 20:02:11 +0200 Subject: git: fetch only if commit is not in history --- lib/populate.jq | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/populate.jq b/lib/populate.jq index e269d05..d7cf964 100644 --- a/lib/populate.jq +++ b/lib/populate.jq @@ -65,7 +65,9 @@ def git_script: @sh " hash=$src_ref", @sh " if ! test \"$(git log --format=%H -1)\" = \"$hash\"; then", - @sh " git fetch origin", + @sh " if ! git log -1 \"$hash\" >/dev/null 2>&1; then", + @sh " git fetch origin", + @sh " fi", @sh " git checkout \"$hash\" -- \"$dst_dir\"", @sh " git checkout -f \"$hash\"", @sh " fi", -- cgit v1.2.3