blob: 2d9ac30426d9b480ca1193dbc7d1db8b212f84de [file] [log] [blame]
[email protected]565db0e2009-06-05 18:08:541#!/bin/sh
[email protected]b7ec6aa2010-02-16 17:04:392# Copyright (c) 2010 The Chromium Authors. All rights reserved.
[email protected]565db0e2009-06-05 18:08:543# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6base_dir=$(dirname "$0")
[email protected]b48f2292010-10-06 19:48:397repo="$base_dir/git_cl_repo"
[email protected]dffe4942009-11-18 02:25:168url="http://src.chromium.org/git/git-cl.git"
[email protected]e08f4912010-02-17 22:11:379cur_url=$(git config -f "$repo/.git/config" remote.origin.url)
[email protected]dffe4942009-11-18 02:25:1610
[email protected]e08f4912010-02-17 22:11:3711if [ -e "$repo" -a "$cur_url" != "$url" ]; then
[email protected]b7ec6aa2010-02-16 17:04:3912 cat <<EOF
[email protected]e08f4912010-02-17 22:11:3713$repo
[email protected]b7ec6aa2010-02-16 17:04:3914is tracking a non-default remote repository:
15
16 default: $url
17 yours: $cur_url
18
19This is intended to be an automatically-updating, read-only repository.
20Please create a separate repository for making changes to git-cl, move your
21modifications there, and then run:
[email protected]e08f4912010-02-17 22:11:3722 rm -rf $repo
[email protected]b7ec6aa2010-02-16 17:04:3923EOF
24 exit 1
[email protected]dffe4942009-11-18 02:25:1625fi
[email protected]565db0e2009-06-05 18:08:5426
[email protected]e08f4912010-02-17 22:11:3727if [ ! -f "$repo/git-cl" ]; then
28 git clone $url $repo -q
[email protected]b48f2292010-10-06 19:48:3929elif [ ! -e "$repo/.git" ]; then
30 echo "$0: $repo does not appear to be a git repo"
[email protected]d065ecc2010-07-13 22:46:0631elif [ "X$DEPOT_TOOLS_UPDATE" != "X0" ]; then
[email protected]b48f2292010-10-06 19:48:3932 (cd "$repo"; git pull -q)
[email protected]565db0e2009-06-05 18:08:5433fi
34
[email protected]e08f4912010-02-17 22:11:3735$repo/git-cl "$@"