OLD | NEW |
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 Loading... |
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 |
OLD | NEW |