OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 update_toplevel () { | 3 update_toplevel () { |
4 # Don't "pull" if checkout is not on a named branch | 4 # Don't "pull" if checkout is not on a named branch |
5 if test "$2" = "pull" && ( ! git symbolic-ref HEAD >/dev/null 2>/dev/null ); t
hen | 5 if test "$2" = "pull" && ( ! git symbolic-ref HEAD >/dev/null 2>/dev/null ); t
hen |
6 first_args="$1 fetch" | 6 first_args="$1 fetch" |
7 else | 7 else |
8 first_args="$1 $2" | 8 first_args="$1 $2" |
9 fi | 9 fi |
10 shift 2 | 10 shift 2 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 if [ -n "$submod_os" -a \ | 58 if [ -n "$submod_os" -a \ |
59 "$submod_os" != "all" -a \ | 59 "$submod_os" != "all" -a \ |
60 "${submod_os/${target_os}/}" = "${submod_os}" ]; then | 60 "${submod_os/${target_os}/}" = "${submod_os}" ]; then |
61 update_policy=none | 61 update_policy=none |
62 else | 62 else |
63 git submodule --quiet init "$1" | 63 git submodule --quiet init "$1" |
64 update_policy=checkout | 64 update_policy=checkout |
65 fi | 65 fi |
66 git config "submodule.$1.update" $update_policy | 66 git config "submodule.$1.update" $update_policy |
67 fi | 67 fi |
| 68 ignore_policy=$(git config --get "submodule.$1.ignore") |
| 69 if [ -z "$ignore_policy" ]; then |
| 70 git config "submodule.$1.ignore" all |
| 71 fi |
68 if [ "$update_policy" != "none" ]; then | 72 if [ "$update_policy" != "none" ]; then |
69 update_submodule_url "$1" | 73 update_submodule_url "$1" |
70 echo "$solution/$1" | 74 echo "$solution/$1" |
71 fi | 75 fi |
72 } | 76 } |
73 | 77 |
74 if [ -z "$*" ]; then | 78 if [ -z "$*" ]; then |
75 exit 0 | 79 exit 0 |
76 fi | 80 fi |
77 set -o pipefail | 81 set -o pipefail |
78 dir="$1" | 82 dir="$1" |
79 solution="${1%%/*}" | 83 solution="${1%%/*}" |
80 cd "$solution" 1>/dev/null | 84 cd "$solution" 1>/dev/null |
81 | 85 |
82 if [ "$solution" = "$1" ]; then | 86 if [ "$solution" = "$1" ]; then |
83 # Skip git checkouts not managed by crup. | 87 # Skip git checkouts not managed by crup. |
84 if ! grep -q -s "The Chromium Authors" ".git/description"; then | 88 if ! grep -q -s "The Chromium Authors" ".git/description"; then |
85 echo "Skipping unmanaged git directory $1" 1>&2 | 89 echo "Skipping unmanaged git directory $1" 1>&2 |
86 exit 0 | 90 exit 0 |
87 fi | 91 fi |
88 | 92 |
| 93 # Set default behavior to ignore diffs in submodule checkouts |
| 94 diff_policy=$(git config --get "diff.ignoreSubmodules") |
| 95 if [ -z "$diff_policy" ]; then |
| 96 git config diff.ignoreSubmodules all |
| 97 fi |
| 98 |
| 99 # Don't "pull" if checkout is not on a named branch |
89 shift | 100 shift |
90 if test $# -ne 0; then | 101 if test $# -ne 0; then |
91 update_toplevel "$@" | 102 update_toplevel "$@" |
92 fi | 103 fi |
93 | 104 |
94 set_target_os | 105 set_target_os |
95 | 106 |
96 "$GIT_EXE" ls-files -s | grep ^160000 | awk '{print $4}' | | 107 "$GIT_EXE" ls-files -s | grep ^160000 | awk '{print $4}' | |
97 while read submod; do | 108 while read submod; do |
98 process_submodule "$submod" | 109 process_submodule "$submod" |
99 done | 110 done |
100 status=$? | 111 status=$? |
101 else | 112 else |
102 submodule="${1#*/}" | 113 submodule="${1#*/}" |
103 echo "[$solution] updating $submodule" | 114 echo "[$solution] updating $submodule" |
104 "$GIT_EXE" submodule update --quiet "$submodule" | | 115 "$GIT_EXE" submodule update --quiet "$submodule" | |
105 ( grep -v '^Skipping submodule' || true ) | sed "s|^|[$1] |g" | 116 ( grep -v '^Skipping submodule' || true ) | sed "s|^|[$1] |g" |
106 status=$? | 117 status=$? |
107 if [ "$status" -ne "0" ]; then | 118 if [ "$status" -ne "0" ]; then |
108 echo "[$solution] FAILED to update $submodule" | 119 echo "[$solution] FAILED to update $submodule" |
109 fi | 120 fi |
110 fi | 121 fi |
111 exit $status | 122 exit $status |
OLD | NEW |