From 6a8b18a2fdac42b9dde828b6722f7dc7d2fac6e98b3388922c05ccf1d2e2e3f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Thu, 25 Aug 2011 13:52:49 +0000 Subject: [PATCH] add checkout depth parameter, based on work of Markus Lehtonen OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-tar_scm?expand=0&rev=20 --- obs-service-tar_scm.changes | 6 ++++++ tar_scm | 13 +++++++++++-- tar_scm.service | 3 +++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/obs-service-tar_scm.changes b/obs-service-tar_scm.changes index e050b5f..73417b1 100644 --- a/obs-service-tar_scm.changes +++ b/obs-service-tar_scm.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Aug 25 13:52:06 UTC 2011 - adrian@suse.de + +- add support for (git) checkout depth, original patch by + Markus Lehtonen + ------------------------------------------------------------------- Wed Aug 17 07:54:29 UTC 2011 - adrian@suse.de diff --git a/tar_scm b/tar_scm index 90b82da..bbe283b 100644 --- a/tar_scm +++ b/tar_scm @@ -18,6 +18,7 @@ MYPREFIX="" MYFILENAME="" MYREVISION="" MYPACKAGEMETA="" +MYGITARGS="--depth 1" while test $# -gt 0; do case $1 in @@ -61,6 +62,14 @@ while test $# -gt 0; do MYOUTDIR="$2" shift ;; + *-history-depth) + if [ "$2" == "full" ]; then + MYGITARGS="" + else + MYGITARGS="--depth $2" + fi + shift + ;; *) echo Unknown parameter $1. echo 'Usage: tar_scm --scm $SCM --url $URL --outdir $OUT' @@ -166,7 +175,7 @@ elif [ "$MYSCM" == "git" ]; then # update existing content for speed/bandwidth reasons cd "$TAR_DIRECTORY" OLDVERSION=`git show --pretty=%at | head -n 1` - git pull || exit 1 + git pull $MYGITARGS || exit 1 if [ -n "$MYREVISION" ]; then git checkout "$MYREVISION" || exit 1 fi @@ -180,7 +189,7 @@ elif [ "$MYSCM" == "git" ]; then mv "$TAR_DIRECTORY" "${FILE}" || exit 1 else # new checkout - git clone --depth 1 "$MYURL" "${FILE}" || exit 1 + git clone "$MYGITARGS" "$MYURL" "${FILE}" || exit 1 if [ -n "$MYREVISION" ]; then cd "$FILE" git checkout "$MYREVISION" || exit 1 diff --git a/tar_scm.service b/tar_scm.service index 19abc80..e260a38 100644 --- a/tar_scm.service +++ b/tar_scm.service @@ -35,5 +35,8 @@ Package the meta data of SCM to allow the user or OBS to update after un-tar yes + + Stored history depth. Special value "full" clones/pulls full history. Only valid if SCM git is used. +