Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: build/git-hooks/pre-commit

Issue 203463010: Remove "bashism" from plain shell script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 2
3 submods=$(git diff-index --cached --ignore-submodules=dirty HEAD | grep -e '^:16 0000' -e '^:...... 160000' | xargs) 3 submods=$(git diff-index --cached --ignore-submodules=dirty HEAD | grep -e '^:16 0000' -e '^:...... 160000' | xargs)
4 if test "$submods"; then 4 if test "$submods"; then
5 echo "You are trying to commit changes to the following submodules:" 1>&2 5 echo "You are trying to commit changes to the following submodules:" 1>&2
6 echo 1>&2 6 echo 1>&2
7 echo $submods | cut -d ' ' -f 6 | sed 's/^/ /g' 1>&2 7 echo $submods | cut -d ' ' -f 6 | sed 's/^/ /g' 1>&2
8 cat <<EOF 1>&2 8 cat <<EOF 1>&2
9 9
10 Submodule commits are not allowed. Please run: 10 Submodule commits are not allowed. Please run:
11 11
12 git status --ignore-submodules=dirty 12 git status --ignore-submodules=dirty
13 13
14 and/or: 14 and/or:
15 15
16 git diff-index --cached --ignore-submodules=dirty HEAD 16 git diff-index --cached --ignore-submodules=dirty HEAD
17 17
18 ... to see what's in your index. 18 ... to see what's in your index.
19 19
20 If you're really and truly trying to roll the version of a submodule, you should 20 If you're really and truly trying to roll the version of a submodule, you should
21 commit the new version to DEPS, instead. 21 commit the new version to DEPS, instead.
22 EOF 22 EOF
23 exit 1 23 exit 1
24 fi 24 fi
25 25
26 if [[ -n "$(git ls-files .gitmodules)" && 26 if [ -n "$(git ls-files .gitmodules)" ] &&
27 -n "$(git diff-index --cached HEAD .gitmodules)" ]]; then 27 [ -n "$(git diff-index --cached HEAD .gitmodules)" ]; then
28 cat <<EOF 1>&2 28 cat <<EOF 1>&2
29 You are trying to commit a change to .gitmodules. That is not allowed. 29 You are trying to commit a change to .gitmodules. That is not allowed.
30 To make changes to submodule names/paths, edit DEPS. 30 To make changes to submodule names/paths, edit DEPS.
31 EOF 31 EOF
32 exit 1 32 exit 1
33 fi 33 fi
34 34
35 exit 0 35 exit 0
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698