[email protected] | 565db0e | 2009-06-05 18:08:54 | [diff] [blame] | 1 | #!/bin/sh |
[email protected] | b7ec6aa | 2010-02-16 17:04:39 | [diff] [blame] | 2 | # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
[email protected] | 565db0e | 2009-06-05 18:08:54 | [diff] [blame] | 3 | # Use of this source code is governed by a BSD-style license that can be |
4 | # found in the LICENSE file. | ||||
5 | |||||
6 | base_dir=$(dirname "$0") | ||||
[email protected] | b48f229 | 2010-10-06 19:48:39 | [diff] [blame] | 7 | repo="$base_dir/git_cl_repo" |
[email protected] | dffe494 | 2009-11-18 02:25:16 | [diff] [blame] | 8 | url="http://src.chromium.org/git/git-cl.git" |
[email protected] | e08f491 | 2010-02-17 22:11:37 | [diff] [blame] | 9 | cur_url=$(git config -f "$repo/.git/config" remote.origin.url) |
[email protected] | dffe494 | 2009-11-18 02:25:16 | [diff] [blame] | 10 | |
[email protected] | e08f491 | 2010-02-17 22:11:37 | [diff] [blame] | 11 | if [ -e "$repo" -a "$cur_url" != "$url" ]; then |
[email protected] | b7ec6aa | 2010-02-16 17:04:39 | [diff] [blame] | 12 | cat <<EOF |
[email protected] | e08f491 | 2010-02-17 22:11:37 | [diff] [blame] | 13 | $repo |
[email protected] | b7ec6aa | 2010-02-16 17:04:39 | [diff] [blame] | 14 | is tracking a non-default remote repository: |
15 | |||||
16 | default: $url | ||||
17 | yours: $cur_url | ||||
18 | |||||
19 | This is intended to be an automatically-updating, read-only repository. | ||||
20 | Please create a separate repository for making changes to git-cl, move your | ||||
21 | modifications there, and then run: | ||||
[email protected] | e08f491 | 2010-02-17 22:11:37 | [diff] [blame] | 22 | rm -rf $repo |
[email protected] | b7ec6aa | 2010-02-16 17:04:39 | [diff] [blame] | 23 | EOF |
24 | exit 1 | ||||
[email protected] | dffe494 | 2009-11-18 02:25:16 | [diff] [blame] | 25 | fi |
[email protected] | 565db0e | 2009-06-05 18:08:54 | [diff] [blame] | 26 | |
[email protected] | e08f491 | 2010-02-17 22:11:37 | [diff] [blame] | 27 | if [ ! -f "$repo/git-cl" ]; then |
28 | git clone $url $repo -q | ||||
[email protected] | b48f229 | 2010-10-06 19:48:39 | [diff] [blame] | 29 | elif [ ! -e "$repo/.git" ]; then |
30 | echo "$0: $repo does not appear to be a git repo" | ||||
[email protected] | d065ecc | 2010-07-13 22:46:06 | [diff] [blame] | 31 | elif [ "X$DEPOT_TOOLS_UPDATE" != "X0" ]; then |
[email protected] | b48f229 | 2010-10-06 19:48:39 | [diff] [blame] | 32 | (cd "$repo"; git pull -q) |
[email protected] | 565db0e | 2009-06-05 18:08:54 | [diff] [blame] | 33 | fi |
34 | |||||
[email protected] | e08f491 | 2010-02-17 22:11:37 | [diff] [blame] | 35 | $repo/git-cl "$@" |