X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/15ecb7923af303497eec1e7918f7c70aafd33cde..7f8e742833e058fa41c273ff35351b02b6e8d42b:/autogen.sh diff --git a/autogen.sh b/autogen.sh index ac728ccd52..b1bd86b461 100755 --- a/autogen.sh +++ b/autogen.sh @@ -112,7 +112,8 @@ for arg; do --help) exec echo "$0: usage: $0 [all|autoconf|git]";; all) - do_autoconf=true do_git=true;; + do_autoconf=true + test -e .git && do_git=true;; autoconf) do_autoconf=true;; git) @@ -260,7 +261,8 @@ git_config () echo 'Configuring local git repository...' case $cp_options in --backup=*) - cp $cp_options --force .git/config .git/config || exit;; + config=$git_common_dir/config + cp $cp_options --force -- "$config" "$config" || exit;; esac fi echo "git config $name '$value'" @@ -272,6 +274,15 @@ git_config () ## Configure Git, if requested. +# Get location of Git's common configuration directory. For older Git +# versions this is just '.git'. Newer Git versions support worktrees. + +{ test -e .git && + git_common_dir=`git rev-parse --no-flags --git-common-dir 2>/dev/null` && + test -n "$git_common_dir" +} || git_common_dir=.git +hooks=$git_common_dir/hooks + # Check hashes when transferring objects among repositories. git_config transfer.fsckObjects true @@ -281,6 +292,11 @@ git_config transfer.fsckObjects true git_config diff.elisp.xfuncname \ '^\(def[^[:space:]]+[[:space:]]+([^()[:space:]]+)' +git_config 'diff.m4.xfuncname' '^((m4_)?define|A._DEFUN(_ONCE)?)\([^),]*' +git_config 'diff.make.xfuncname' \ + '^([$.[:alnum:]_].*:|[[:alnum:]_]+[[:space:]]*([*:+]?[:?]?|!?)=|define .*)' +git_config 'diff.shell.xfuncname' \ + '^([[:space:]]*[[:alpha:]_][[:alnum:]_]*[[:space:]]*\(\)|[[:alpha:]_][[:alnum:]_]*=)' git_config diff.texinfo.xfuncname \ '^@node[[:space:]]+([^,[:space:]][^,]+)' @@ -291,12 +307,11 @@ tailored_hooks= sample_hooks= for hook in commit-msg pre-commit; do - cmp build-aux/git-hooks/$hook .git/hooks/$hook >/dev/null 2>&1 || + cmp -- build-aux/git-hooks/$hook "$hooks/$hook" >/dev/null 2>&1 || tailored_hooks="$tailored_hooks $hook" done for hook in applypatch-msg pre-applypatch; do - src=.git/hooks/$hook.sample - cmp "$src" .git/hooks/$hook >/dev/null 2>&1 || + cmp -- "$hooks/$hook.sample" "$hooks/$hook" >/dev/null 2>&1 || sample_hooks="$sample_hooks $hook" done @@ -306,16 +321,17 @@ if test -n "$tailored_hooks$sample_hooks"; then if test -n "$tailored_hooks"; then for hook in $tailored_hooks; do - dst=.git/hooks/$hook - cp $cp_options build-aux/git-hooks/$hook "$dst" || exit - chmod a-w "$dst" || exit + dst=$hooks/$hook + cp $cp_options -- build-aux/git-hooks/$hook "$dst" || exit + chmod -- a-w "$dst" || exit done fi if test -n "$sample_hooks"; then for hook in $sample_hooks; do - cp $cp_options .git/hooks/$hook.sample .git/hooks/$hook || exit - chmod a-w .git/hooks/$hook || exit + dst=$hooks/$hook + cp $cp_options -- "$dst.sample" "$dst" || exit + chmod -- a-w "$dst" || exit done fi else @@ -325,7 +341,7 @@ fi if test ! -f configure; then echo "You can now run '$0 autoconf'." -elif test -d .git && test $git_was_ok = false && test $do_git = false; then +elif test -e .git && test $git_was_ok = false && test $do_git = false; then echo "You can now run '$0 git'." elif test ! -f config.status || test -n "`find src/stamp-h.in -newer config.status`"; then