mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8355400: Better git detection in update_copyright_year.sh
Reviewed-by: erikj, chagedorn
This commit is contained in:
parent
84e9264e76
commit
290d24d16a
@ -1,7 +1,7 @@
|
||||
#!/bin/bash -f
|
||||
|
||||
#
|
||||
# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -41,10 +41,6 @@ set -e
|
||||
# To allow total changes counting
|
||||
shopt -s lastpipe
|
||||
|
||||
# Get an absolute path to this script, since that determines the top-level directory.
|
||||
this_script_dir=`dirname $0`
|
||||
this_script_dir=`cd $this_script_dir > /dev/null && pwd`
|
||||
|
||||
# Temp area
|
||||
tmp=/tmp/`basename $0`.${USER}.$$
|
||||
rm -f -r ${tmp}
|
||||
@ -98,10 +94,16 @@ while getopts "c:fhy:" option; do
|
||||
done
|
||||
|
||||
# VCS check
|
||||
git_installed=false
|
||||
which git > /dev/null && git_installed=true
|
||||
if [ "$git_installed" != "true" ]; then
|
||||
echo "Error: This script requires git. Please install it."
|
||||
exit 1
|
||||
fi
|
||||
git_found=false
|
||||
[ -d "${this_script_dir}/../../.git" ] && git_found=true
|
||||
git status &> /dev/null && git_found=true
|
||||
if [ "$git_found" != "true" ]; then
|
||||
echo "Error: Please execute script from within make/scripts."
|
||||
echo "Error: Please execute script from within a JDK git repository."
|
||||
exit 1
|
||||
else
|
||||
echo "Using Git version control system"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user