From 77f67b965cae26300d15b27a2f33a256dce2375e Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Wed, 21 Jul 2021 11:12:24 +0000 Subject: [PATCH 1/1] feat(unitproc/bktemp-initGitrepo):Only fast-forward pulls --- unitproc/bktemp-initGitRepo | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unitproc/bktemp-initGitRepo b/unitproc/bktemp-initGitRepo index 4575daf..3e4b566 100644 --- a/unitproc/bktemp-initGitRepo +++ b/unitproc/bktemp-initGitRepo @@ -31,11 +31,15 @@ initGitRepo() { # arg2: repoDir # arg3: remoteName # arg4: branchName - # Version: 0.0.6 + # Version: 0.0.7 # Depends: checkURL() 0.0.2, yell(), Bash 5.0.3 # Ref/Attrib: [1]: Test for space-less alphanuemric string. https://unix.stackexchange.com/a/416120 # [2]: Test for argument count. https://stackoverflow.com/q/18568706 # [3]: Test if dir is (in) git repository. https://stackoverflow.com/a/39518382 + # Note: Pulls use '--ff-only' option which requires an upstream branch be set. + # This can be done by using: + # $ git branch --set-upstream-to origin/master master + # #==BEGIN Validate input arguments== arg1="$1"; arg2="$2"; @@ -72,7 +76,7 @@ initGitRepo() { yell "STATUS:Adding $repoURL as remote $remoteName"; git remote add "$remoteName" "$repoURL"; yell "STATUS:Pulling branch $branchName from remote $remoteName"; - git pull "$remoteName" "$branchName"; + git pull --ff-only "$remoteName" "$branchName"; unset repoURL repoDir remoteName branchName; popd || exit 1; #==END create and populate git repository== -- 2.30.2