summaryrefslogtreecommitdiffstats
path: root/tools/git/post-checkout
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 19:03:30 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 19:03:30 +0000
commit8a3e68a604284f1b20fa9d18633f8f5eb4d573e0 (patch)
treebe31ee0bcedb161b728b1c6b1fbb160c17840ab4 /tools/git/post-checkout
parent47115104dc1a6a06b85dc23cc4d5993847ea0fa7 (diff)
downloadchromium_src-8a3e68a604284f1b20fa9d18633f8f5eb4d573e0.zip
chromium_src-8a3e68a604284f1b20fa9d18633f8f5eb4d573e0.tar.gz
chromium_src-8a3e68a604284f1b20fa9d18633f8f5eb4d573e0.tar.bz2
git: add some hooks under tools/git
These hooks will warn you if DEPS changes when you switch branches. Review URL: http://codereview.chromium.org/650030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39469 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/git/post-checkout')
-rwxr-xr-xtools/git/post-checkout22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/git/post-checkout b/tools/git/post-checkout
new file mode 100755
index 0000000..452eb48
--- /dev/null
+++ b/tools/git/post-checkout
@@ -0,0 +1,22 @@
+#!/bin/bash
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+script=$(readlink $0)
+source $(dirname ${script:-$0})/git-utils.sh
+
+old_ref=$1 # Previous HEAD.
+new_ref=$2 # Current HEAD.
+branch_switch=$3 # Whether we switched branches.
+
+if [ $old_ref == $new_ref ]; then
+ if ! git diff-index --quiet HEAD $(git rev-parse --show-cdup)DEPS; then
+ warn "DEPS has local modifications; do you need to re-run gclient sync?"
+ fi
+else
+ if git diff-tree $old_ref $new_ref | grep -qs $'\tDEPS$'; then
+ warn "DEPS has changed; you probably need to re-run gclient sync."
+ fi
+fi
+