X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=dgit;h=3137627d243a563013b0854a849a6575505a1755;hb=2657a606b44b642acf64bb29ae177e7adde5887b;hp=495a043e7e30f454b74fd4fac9d9e07e3831e852;hpb=11f333c91765e0852f28807463d9302bad75d262;p=dgit.git diff --git a/dgit b/dgit index 495a043e..3137627d 100755 --- a/dgit +++ b/dgit @@ -1134,13 +1134,26 @@ sub archive_query_dummycat ($$) { #---------- tag format handling ---------- +sub access_cfg_tagformats () { + split /\,/, access_cfg('dgit-tag-format'); +} + +sub need_tagformat ($$) { + my ($fmt, $why) = @_; + fail "need to use tag format $fmt ($why) but also need". + " to use tag format $tagformat_want->[0] ($tagformat_want->[1])". + " - no way to proceed" + if $tagformat_want && $tagformat_want->[0] ne $fmt; + $tagformat_want = [$fmt, $why, $tagformat_want->[2] // 0]; +} + sub select_tagformat () { # sets $tagformatfn return if $tagformatfn && !$tagformat_want; die 'bug' if $tagformatfn && $tagformat_want; # ... $tagformat_want assigned after previous select_tagformat - my (@supported) = split /\,/, access_cfg('dgit-tag-format'); + my (@supported) = access_cfg_tagformats(); printdebug "select_tagformat supported @supported\n"; $tagformat_want //= [ $supported[0], "distro access configuration", 0 ]; @@ -2394,11 +2407,7 @@ sub cmd_remote_push_responder { cmd_remote_push_build_host(); } sub rpush_handle_protovsn_bothends () { if ($protovsn < 4) { - fail "rpush negotiated protocol version $protovsn". - " which supports old tag format only". - " but trying to use new format (".$tagformat_want->[1].")" - if $tagformat_want && $tagformat_want->[0] ne 'old'; - $tagformat_want = ['old', "rpush negotiated protocol $protovsn", 0]; + need_tagformat 'old', "rpush negotiated protocol $protovsn"; } select_tagformat(); }