Update Gref_rbranch when connecting
This commit is contained in:
parent
007bfb29de
commit
2a65af1d20
1 changed files with 16 additions and 15 deletions
|
@ -19,7 +19,6 @@ Packkey_bytes=33 # 33 random bytes for passphrase, still compatible if changed
|
||||||
Hashtype=SHA256 # SHA512 SHA384 SHA256 SHA224 supported.
|
Hashtype=SHA256 # SHA512 SHA384 SHA256 SHA224 supported.
|
||||||
Packpat="pack :*:"
|
Packpat="pack :*:"
|
||||||
Manifestfile=91bd0c092128cf2e60e1a608c31e92caf1f9c1595f83f2890ef17c0e4881aa0a
|
Manifestfile=91bd0c092128cf2e60e1a608c31e92caf1f9c1595f83f2890ef17c0e4881aa0a
|
||||||
Urlfrag=
|
|
||||||
|
|
||||||
Branchlist=
|
Branchlist=
|
||||||
Packlist=
|
Packlist=
|
||||||
|
@ -78,7 +77,7 @@ gitception_get()
|
||||||
# Take care to preserve FETCH_HEAD
|
# Take care to preserve FETCH_HEAD
|
||||||
local ret_=: obj_id= f_head="$GIT_DIR/FETCH_HEAD"
|
local ret_=: obj_id= f_head="$GIT_DIR/FETCH_HEAD"
|
||||||
[ -e "$f_head" ] && command mv -f "$f_head" "$f_head.$$~" || :
|
[ -e "$f_head" ] && command mv -f "$f_head" "$f_head.$$~" || :
|
||||||
git fetch -q -f "$1" "refs/heads/${Urlfrag:-master}:$Gref" 2>/dev/tty >/dev/null &&
|
git fetch -q -f "$1" "$Gref_rbranch:$Gref" 2>/dev/tty >/dev/null &&
|
||||||
obj_id="$(git ls-tree "$Gref" | xgrep -E '\b'"$2"'$' | awk '{print $3}')" &&
|
obj_id="$(git ls-tree "$Gref" | xgrep -E '\b'"$2"'$' | awk '{print $3}')" &&
|
||||||
isnonnull "$obj_id" && git cat-file blob "$obj_id" && ret_=: ||
|
isnonnull "$obj_id" && git cat-file blob "$obj_id" && ret_=: ||
|
||||||
{ ret_=false && : ; }
|
{ ret_=false && : ; }
|
||||||
|
@ -181,8 +180,7 @@ PUT_FINAL()
|
||||||
then
|
then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
git push --quiet -f "${1#gitception://}" \
|
git push --quiet -f "${1#gitception://}" "$Gref:$Gref_rbranch"
|
||||||
"$Gref:refs/heads/${Urlfrag:-master}"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +373,7 @@ read_config()
|
||||||
|
|
||||||
ensure_connected()
|
ensure_connected()
|
||||||
{
|
{
|
||||||
local manifest_= rcv_repoid= r_name=
|
local manifest_= rcv_repoid= r_name= url_frag=
|
||||||
|
|
||||||
if isnonnull "$Did_find_repo"
|
if isnonnull "$Did_find_repo"
|
||||||
then
|
then
|
||||||
|
@ -400,29 +398,32 @@ ensure_connected()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Find the URL fragment
|
# Find the URL fragment
|
||||||
Urlfrag=${URL##*"#"}
|
url_frag=${URL##*"#"}
|
||||||
isnoteq "$Urlfrag" "$URL" || Urlfrag=
|
isnoteq "$url_frag" "$URL" || url_frag=
|
||||||
isnonnull "$Urlfrag" || {
|
isnonnull "$url_frag" || {
|
||||||
# find old style /G.XXXXXX fragment
|
# find old style /G.XXXXXX fragment
|
||||||
Urlfrag=${URL##*/G.}
|
url_frag=${URL##*/G.}
|
||||||
if isnoteq "$Urlfrag" "$URL"; then
|
if isnoteq "$url_frag" "$URL"; then
|
||||||
URL=${URL%/G."$Urlfrag"}
|
URL=${URL%/G."$url_frag"}
|
||||||
isnull "$r_name" || {
|
isnull "$r_name" || {
|
||||||
git config "remote.$r_name.url" \
|
git config "remote.$r_name.url" \
|
||||||
"gcrypt::$URL#$Urlfrag"
|
"gcrypt::$URL#$url_frag"
|
||||||
echo_info "Updated URL for $r_name, use #fragment"
|
echo_info "Updated URL for $r_name, use #fragment"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Urlfrag=
|
url_frag=
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
URL=${URL%"#$Urlfrag"}
|
URL=${URL%"#$url_frag"}
|
||||||
|
|
||||||
# manifestfile -- sha224 hash if we can, else the default location
|
# manifestfile -- sha224 hash if we can, else the default location
|
||||||
if isurl sftp "$URL" || islocalrepo "$URL" || isurl rsync "$URL"
|
if isurl sftp "$URL" || islocalrepo "$URL" || isurl rsync "$URL"
|
||||||
then
|
then
|
||||||
# not for gitception
|
# not for gitception
|
||||||
isnull "$Urlfrag" || Manifestfile=$(xecho_n "$Urlfrag" | gpg_hash SHA224)
|
isnull "$url_frag" ||
|
||||||
|
Manifestfile=$(xecho_n "$url_frag" | gpg_hash SHA224)
|
||||||
|
else
|
||||||
|
isnull "$url_frag" || Gref_rbranch="refs/heads/$url_frag"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Repoid=
|
Repoid=
|
||||||
|
|
Loading…
Reference in a new issue