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

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

Issue 225583008: Silence git-hooks/pre-commit in the absence of .gitmodules (take 2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« 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 submodule_diff() { 3 submodule_diff() {
4 if test -n "$2"; then 4 if test -n "$2"; then
5 git diff-tree -r --ignore-submodules=dirty "$1" "$2" | grep -e '^:160000' -e '^:...... 160000' | xargs 5 git diff-tree -r --ignore-submodules=dirty "$1" "$2" | grep -e '^:160000' -e '^:...... 160000' | xargs
6 else 6 else
7 git diff-index --cached --ignore-submodules=dirty "$1" | grep -e '^:160000' -e '^:...... 160000' | xargs 7 git diff-index --cached --ignore-submodules=dirty "$1" | grep -e '^:160000' -e '^:...... 160000' | xargs
8 fi 8 fi
9 } 9 }
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 If you're really and truly trying to roll the version of a submodule, you should 42 If you're really and truly trying to roll the version of a submodule, you should
43 commit the new version to DEPS, instead. 43 commit the new version to DEPS, instead.
44 EOF 44 EOF
45 exit 1 45 exit 1
46 fi 46 fi
47 47
48 gitmodules_diff() { 48 gitmodules_diff() {
49 git diff-index --cached "$1" .gitmodules 49 git diff-index --cached "$1" .gitmodules
50 } 50 }
51 51
52 if test "$(git ls-files .gitmodules)" -a "$(gitmodules_diff $head_ref)"; then 52 if [ "$(git ls-files .gitmodules)" ] && [ "$(gitmodules_diff $head_ref)" ]; then
53 cat <<EOF 1>&2 53 cat <<EOF 1>&2
54 You are trying to commit a change to .gitmodules. That is not allowed. 54 You are trying to commit a change to .gitmodules. That is not allowed.
55 To make changes to submodule names/paths, edit DEPS. 55 To make changes to submodule names/paths, edit DEPS.
56 EOF 56 EOF
57 exit 1 57 exit 1
58 fi 58 fi
59 59
60 exit 0 60 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