@@ -420,141 +420,6 @@ needs_upload_permissions () {
420420 die " Missing GitHub entries in ~/_netrc\n"
421421}
422422
423- # <coverity-token>
424- init_or_update_coverity_tool () {
425- # check once per week whether there is a new version
426- coverity_tool=.git/coverity-tool
427- test ! -d $coverity_tool ||
428- test $(( $(date +% s)- $(stat - c % Y $coverity_tool )) ) \
429- -gt $(( 7 * 24 * 60 * 60 )) || return 0
430- echo " Downloading current Coverity Scan Self-Build tool" >&2
431- if test -f .git/coverity_tool.zip
432- then
433- timecond=.git/coverity_tool.zip
434- else
435- timecond=" 19700101 +0000"
436- fi
437- curl --form " token=$1 " \
438- --form " project=git-for-windows" \
439- --time-cond " $timecond " \
440- -o .git/coverity_tool.zip.new \
441- https://scan.coverity.com/download/win64 &&
442- test -f .git/coverity_tool.zip.new || {
443- echo " Nothing downloaded; will try again in another week" >&2
444- test -d " $coverity_tool " || mkdir $coverity_tool
445- touch $coverity_tool
446- return
447- }
448- mv -f .git/coverity_tool.zip.new .git/coverity_tool.zip ||
449- die " Could not overwrite coverity_tool.zip"
450-
451- mkdir $coverity_tool .new &&
452- (cd $coverity_tool .new &&
453- unzip ../coverity_tool.zip) ||
454- die " Could not unpack coverity_tool.zip"
455- rm -rf $coverity_tool &&
456- mv $coverity_tool .new $coverity_tool ||
457- die " Could not switch to new Coverity tool version"
458- }
459-
460- submit_build_to_coverity () { # [--worktree=<dir>] <upstream-branch-or-tag>
461- git_src_dir=" $sdk64 /usr/src/MINGW-packages/mingw-w64-git/src/git"
462- while case " $1 " in
463- --worktree=* )
464- git_src_dir=${1#* =}
465- test -d " $git_src_dir " ||
466- die " Worktree does not exist: %s\n" " $git_src_dir "
467- test -f " $git_src_dir /GIT-VERSION-GEN" ||
468- die " Does not appear to contain Git's source code: %s\n" " $git_src_dir "
469- ;;
470- -* ) die " Unknown option: %s\n" " $1 " ;;
471- * ) break ;;
472- esac ; do shift ; done
473- test $# = 1 ||
474- die " Expected 1 argument, got $# : %s\n" " $* "
475- branch=" $1 "
476-
477- coverity_username=" $( git config coverity.username) "
478- test -n " $coverity_username " ||
479- die " Need a username to access Coverity's services\n"
480-
481- coverity_token=" $( git config coverity.token) "
482- test -n " $coverity_token " ||
483- die " Need a token to access Coverity's services\n"
484-
485- ensure_valid_login_shell 64 ||
486- die " Could not ensure valid login shell\n"
487-
488- sdk=" $sdk64 "
489-
490- build_extra_dir=" $sdk64 /usr/src/build-extra"
491- (cd " $build_extra_dir " &&
492- sdk= pkgpath=$PWD ff_main_branch) ||
493- die " Could not update build-extra\n"
494-
495- require_git_src_dir
496-
497- (cd " $git_src_dir " &&
498- case " $branch " in
499- git-for-windows/* |v[1-9]* .windows.[1-9]* )
500- require_remote git-for-windows \
501- https://github.com/git-for-windows/git
502- case " $branch " in git-for-windows/refs/pull/[0-9]* )
503- git fetch git-for-windows \
504- " ${branch# git-for-windows/ } :refs/remotes/$branch " ||
505- die " Could not fetch %s from git-for-windows\n" \
506- " ${branch# git-for-windows/ } "
507- ;;
508- esac
509- ;;
510- upstream/* |v[1-9]* )
511- require_remote upstream https://github.com/git/git
512- case " $branch " in upstream/refs/pull/[0-9]* )
513- git fetch upstream " ${branch# upstream/ } :refs/remotes/$branch " ||
514- die " Could not fetch %s from upstream\n" \
515- " ${branch# upstream/ } "
516- ;;
517- esac
518- ;;
519- esac &&
520- git checkout -f " $branch " &&
521- git reset --hard &&
522- sed -i -e ' s/^\(char strbuf_slopbuf\[\)1\]/\165536]/' strbuf.c &&
523- init_or_update_coverity_tool " $coverity_token " &&
524- coverity_bin_dir=$( echo $PWD /$coverity_tool /* /bin) &&
525- if ! test -x " $coverity_bin_dir /cov-build.exe"
526- then
527- die " Unusable Coverity bin/ directory: '%s'\n" \
528- " $coverity_bin_dir "
529- fi &&
530- PATH=" $coverity_bin_dir :$PATH " &&
531- cov-configure --gcc &&
532- # Coverity has a long-standing bug where it fails to parse two-digit
533- # major versions of GCC incorrectly Since Synopsys seems to
534- # be hardly in a rush to fix this (there's no response at
535- # https://community.synopsys.com/s/question/0D52H000058Z6KvSAK/
536- # since May 2020), we meddle with Coverity's config files
537- gcc10_workaround=" $( test -d cov-int || gcc -v 2>&1 |
538- sed -n ' s/^gcc version \([1-9]\)\([0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/s|\\<\\(\1\\)\\?\\(\2\\.\3\\.\4\\)\\>|\1\\2|g/p' ) " &&
539- if test -n " $gcc10_workaround "
540- then
541- rm -f version.o &&
542- cov-build --dir cov-int make DEVELOPER=1 version.o &&
543- find cov-int/emit/* -name \* .xml -exec sed -i " $gcc10_workaround " {} \; &&
544- rm -f version.o
545- fi &&
546- cov-build --dir cov-int \
547- make -j15 DEVELOPER=1 CPPFLAGS=" -DFLEX_ARRAY=65536 -DSUPPRESS_ANNOTATED_LEAKS" &&
548- tar caf git-for-windows.lzma cov-int &&
549- curl --form token=" $coverity_token " \
550- --form email=" $coverity_username " \
551- --form file=@git-for-windows.lzma \
552- --form version=" $( git rev-parse HEAD) " \
553- --form version=" $( date +%Y-%m-%s-%H-%M-%S) " \
554- https://scan.coverity.com/builds? project=git-for-windows) ||
555- die " Could not submit build to Coverity\n"
556- }
557-
558423tag_git () { # [--force]
559424 force=
560425 branch_to_use=
0 commit comments