OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
| 3 update_toplevel () { |
| 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 |
| 6 first_args="$1 fetch" |
| 7 else |
| 8 first_args="$1 $2" |
| 9 fi |
| 10 shift 2 |
| 11 echo "[$solution] $first_args $@" 1>&2 |
| 12 $first_args $@ | sed "s/^/[$solution] /g" 1>&2 |
| 13 status=$? |
| 14 if [ "$status" -ne 0 ]; then |
| 15 exit $status |
| 16 fi |
| 17 } |
| 18 |
3 set_target_os () { | 19 set_target_os () { |
4 # Get the os we're building for. On first run, this will be unset. | 20 # Get the os we're building for. On first run, this will be unset. |
5 target_os=$(git config target.os 2>/dev/null) | 21 target_os=$(git config target.os 2>/dev/null) |
6 if [ -z "$target_os" ]; then | 22 if [ -z "$target_os" ]; then |
7 case $(uname -s) in | 23 case $(uname -s) in |
8 Linux) target_os=unix ;; | 24 Linux) target_os=unix ;; |
9 Darwin) target_os=mac ;; | 25 Darwin) target_os=mac ;; |
10 CYGWIN*|MINGW*) target_os=win ;; | 26 CYGWIN*|MINGW*) target_os=win ;; |
11 *) | 27 *) |
12 echo "[$solution] *** No target.os set in .git/config, and I can't" 1>&2 | 28 echo "[$solution] *** No target.os set in .git/config, and I can't" 1>&2 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 solution="${1%%/*}" | 79 solution="${1%%/*}" |
64 cd "$solution" | 80 cd "$solution" |
65 | 81 |
66 if [ "$solution" = "$1" ]; then | 82 if [ "$solution" = "$1" ]; then |
67 # Skip git checkouts not managed by crup. | 83 # Skip git checkouts not managed by crup. |
68 if ! grep -q -s "The Chromium Authors" ".git/description"; then | 84 if ! grep -q -s "The Chromium Authors" ".git/description"; then |
69 echo "Skipping unmanaged git directory $1" 1>&2 | 85 echo "Skipping unmanaged git directory $1" 1>&2 |
70 exit 0 | 86 exit 0 |
71 fi | 87 fi |
72 | 88 |
73 # Don't "pull" if checkout is not on a named branch | |
74 shift | 89 shift |
75 if test "$2" = "pull" && ( ! git symbolic-ref HEAD >/dev/null 2>/dev/null ); t
hen | 90 if test $# -ne 0; then |
76 first_args="$1 fetch" | 91 update_toplevel "$@" |
77 else | |
78 first_args="$1 $2" | |
79 fi | |
80 shift 2 | |
81 $first_args $@ | sed "s/^/[$solution] /g" 1>&2 | |
82 status=$? | |
83 if [ "$status" -ne 0 ]; then | |
84 exit $status | |
85 fi | 92 fi |
86 | 93 |
87 set_target_os | 94 set_target_os |
88 | 95 |
89 "$GIT_EXE" ls-files -s | grep ^160000 | awk '{print $4}' | | 96 "$GIT_EXE" ls-files -s | grep ^160000 | awk '{print $4}' | |
90 while read submod; do | 97 while read submod; do |
91 process_submodule "$submod" | 98 process_submodule "$submod" |
92 done | 99 done |
93 status=$? | 100 status=$? |
94 else | 101 else |
95 submodule="${1#*/}" | 102 submodule="${1#*/}" |
96 echo "[$solution] updating $submodule" | 103 echo "[$solution] updating $submodule" |
97 "$GIT_EXE" submodule update --quiet "$submodule" | | 104 "$GIT_EXE" submodule update --quiet "$submodule" | |
98 ( grep -v '^Skipping submodule' || true ) | sed "s|^|[$1] |g" | 105 ( grep -v '^Skipping submodule' || true ) | sed "s|^|[$1] |g" |
99 status=$? | 106 status=$? |
100 if [ "$status" -ne "0" ]; then | 107 if [ "$status" -ne "0" ]; then |
101 echo "[$solution] FAILED to update $submodule" | 108 echo "[$solution] FAILED to update $submodule" |
102 fi | 109 fi |
103 fi | 110 fi |
104 exit $status | 111 exit $status |
OLD | NEW |