diff --git a/obs-service-tar_scm.changes b/obs-service-tar_scm.changes index 3132c49..a52aa83 100644 --- a/obs-service-tar_scm.changes +++ b/obs-service-tar_scm.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu May 24 00:57:28 GMT 2012 - rohan.mcgovern@nokia.com + +- Allow git revision to refer to revisions not available from a + default clone/fetch (i.e. refs other than refs/heads/* or + refs/tags/*) + ------------------------------------------------------------------- Mon Mar 19 13:39:28 GMT 2012 - aspiers@suse.com diff --git a/tar_scm b/tar_scm index b714fac..2da4a5e 100644 --- a/tar_scm +++ b/tar_scm @@ -323,6 +323,23 @@ update_cache () { switch_to_revision () { case "$MYSCM" in git) + # $MYREVISION may refer to any of the following: + # + # - explicit SHA1: a1b2c3d4.... + # - the SHA1 must be reachable from a default clone/fetch (generally, must be + # reachable from some branch or tag on the remote). + # - set by: git checkout + # + # - short branch name: "master", "devel" etc. + # - set by: git checkout && git pull + # + # - explicit ref: refs/heads/master, refs/tags/v1.2.3, refs/changes/49/11249/1 + # - set by: git fetch +: && git checkout + # + if ! git rev-parse --verify "$MYREVISION"; then + echo "$MYREVISION not accessible by default clone/fetch, attempting explicit fetch" + safe_run git fetch "$MYURL" "+$MYREVISION:$MYREVISION" + fi safe_run git checkout "$MYREVISION" if git branch | grep -q '^\* (no branch)$'; then echo "$MYREVISION does not refer to a branch, not attempting git pull"