Accepting request 122015 from openSUSE:Tools
Allow git revision to refer to revs not available from default clone/fetch Previously, the "revision" parameter must be something reachable after doing a default "git clone". Remove this limitation. A primary use-case is to integrate OBS with the gerrit code review tool, which stores changes under review in "refs/changes/...". Without this change, such refs can't be retrieved by the tar_scm service. (forwarded request 122007 from rohanpm) OBS-URL: https://build.opensuse.org/request/show/122015 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/obs-service-tar_scm?expand=0&rev=7
This commit is contained in:
commit
cc3a5be2ed
@ -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
|
Mon Mar 19 13:39:28 GMT 2012 - aspiers@suse.com
|
||||||
|
|
||||||
|
17
tar_scm
17
tar_scm
@ -323,6 +323,23 @@ update_cache () {
|
|||||||
switch_to_revision () {
|
switch_to_revision () {
|
||||||
case "$MYSCM" in
|
case "$MYSCM" in
|
||||||
git)
|
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 <SHA1>
|
||||||
|
#
|
||||||
|
# - short branch name: "master", "devel" etc.
|
||||||
|
# - set by: git checkout <branch> && git pull
|
||||||
|
#
|
||||||
|
# - explicit ref: refs/heads/master, refs/tags/v1.2.3, refs/changes/49/11249/1
|
||||||
|
# - set by: git fetch <url> +<revision>:<revision> && git checkout <revision>
|
||||||
|
#
|
||||||
|
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"
|
safe_run git checkout "$MYREVISION"
|
||||||
if git branch | grep -q '^\* (no branch)$'; then
|
if git branch | grep -q '^\* (no branch)$'; then
|
||||||
echo "$MYREVISION does not refer to a branch, not attempting git pull"
|
echo "$MYREVISION does not refer to a branch, not attempting git pull"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user