From 518597c50c2f52d1f871046d7ce377b1f0dd4f38 Mon Sep 17 00:00:00 2001 From: "szager@google.com" Date: Thu, 1 Nov 2012 05:03:08 +0000 Subject: [PATCH] A git extension for running post-sync hooks. TBR=cmp@chromium.org Review URL: https://codereview.chromium.org/11362025 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@165295 0039d316-1c4b-4281-b951-d872f2087c98 --- git-crup | 4 ++-- git-runhooks | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 git-runhooks diff --git a/git-crup b/git-crup index be56d30e3..fd81c893d 100755 --- a/git-crup +++ b/git-crup @@ -15,6 +15,7 @@ pull_args= hooks=yes j=10 crup_runner="crup-runner.sh" +runhooks="git-runhooks" kernel_name=$(uname -s) if [ "${kernel_name:0:5}" = "MINGW" -o "${kernel_name:0:6}" = "CYGWIN" ]; then @@ -134,8 +135,7 @@ fi status=$? if [ "$hooks" = "yes" -a "$status" -eq 0 ]; then - gclient_spec="solutions=[{'name':'src','url':None,'deps_file':'.DEPS.git'}]" - gclient runhooks --spec="$gclient_spec" + "$runhooks" status=$? fi diff --git a/git-runhooks b/git-runhooks new file mode 100644 index 000000000..49fe9462d --- /dev/null +++ b/git-runhooks @@ -0,0 +1,16 @@ +#!/bin/bash + +while test "$PWD" != "/"; do + if test -f "$PWD/src/.gitmodules"; then + break + fi + cd .. +done +if ! test -f "$PWD/src/.gitmodules"; then + echo "Could not find the root of your checkout; aborting." 1>&2 + exit 1 +fi + +gclient_spec="solutions=[{'name':'src','url':None,'deps_file':'.DEPS.git'}]" +gclient runhooks --spec="$gclient_spec" +exit $?