This repository was archived by the owner on Mar 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ac-git.m4
More file actions
85 lines (63 loc) · 1.74 KB
/
configure.ac-git.m4
File metadata and controls
85 lines (63 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
test -z "$GITOPS_GIT_URL" && {
AC_MSG_ERROR([
The environment variable 'GITOPS_GIT_URL' is not set. This is a
programming error of the program, contact the program's maintainer.
])
}
AC_ARG_WITH(
[git],
[AS_HELP_STRING(
[--with-git],
[initialize Git repository @<:@default=no@:>@]
)],
[ARG_GIT='yes'],
[ARG_GIT='no']
)
AC_PATH_PROG([PROG_GIT], [git])
AC_MSG_CHECKING([for .git directory or file])
test -d .git || test -f .git
case $? in
1)
AC_MSG_RESULT([not found])
;;
0)
AC_MSG_RESULT([found])
pwd_is_git_repo='yes'
;;
esac
test "$pwd_is_git_repo" '=' 'yes' && {
pwd_is_git_repo=
AC_MSG_CHECKING([if initializing git])
test "$ARG_GIT" '=' 'yes'
case $? in
1)
AC_MSG_RESULT([not requested])
;;
0)
AC_MSG_RESULT([requested])
init_git_repo='yes'
AC_MSG_NOTICE([initializing git repository...])
set -e
git init 2>/dev/null
AC_MSG_NOTICE([updating git submodules...])
git submodule update --remote --recursive
set +e
;;
esac
}
AC_MSG_CHECKING([for git config remote.origin.url])
GIT_REMOTE_URL=$(git config --get remote.origin.url 2>/dev/null)
test "$GIT_REMOTE_URL" '=' "$GITOPS_GIT_URL"
case $? in
0)
AC_MSG_ERROR([
The remote.origin.url is set to '$GITOPS_GIT_URL'
which is not allowed and probably means that your working directory is set
to the root of the GitOps './configure' script. `cd` into the root of your
Git repository instead.
])
;;
1)
AC_MSG_RESULT([allowed])
;;
esac