gclient config : how to specify specific git branch in the URL

3,073 views
Skip to first unread message

andypy...@gmail.com

unread,
Dec 2, 2013, 3:23:43 PM12/2/13
to chromium...@chromium.org
How do I specify gclient to use a specific GIT branch?  For instance I can run:

gclient config  "https://path/to/repository.git" -- WORKS
gclient config  "https://path/to/repository.git -b some_branch" -- does not work. 

Error:

________ running 'git -c core.deltaBaseCacheLimit=2g clone --no-checkout --progress --template=/depot_tools/git-templates https://my-url.org/path/to/repository.git -b somebranch 
/path/to/tmp/_gclient_repository.git -b somebranch_PAZXAX' in '/path/to/tmp'
Cloning into '/path/to/tmp/_repository.git -b somebranch_PAZXAX'..
fatal: https://my-url.org/path/to/repository.git -b somebranch/info/refs not valid: is this a git repository?

Do I have the syntax wrong?

Thanks,
Andy

Mike Pontillo

unread,
May 13, 2014, 7:17:58 PM5/13/14
to chromium...@chromium.org, andypy...@gmail.com
   I'm currently facing the same issue. Did you find a solution to this?

   I tried the following:

gclient config --unmanaged http://path/to/project@branch
gclient config --unmanaged --name project http://path/to/project@branch


   The first way complained saying "Please fix your script, having invalid --revision flags will soon considered an erro" (on 'gclient sync') but seemed to wor except that the checkout directory was "project@branch" instead of just "project" as I would expect.

   The second way caused me to check out a detached HEAD in the wrong branch, and none of the DEPS were synchronized.

My next step is to try creating a custom spec file to pass into the command line, but I need to figure out the correct format to use.

Thanks,
Mike

Mike Pontillo

unread,
May 14, 2014, 4:23:21 PM5/14/14
to chromium...@chromium.org, andypy...@gmail.com
   After recently having the same problem, the following worked for me:

gclient config --unmanaged --spec 'solutions=[{"name":"project","url":"ssh://source-control-server/git/project.git@origin/branch"}]'

Regards,
Mike

On Monday, December 2, 2013 12:23:43 PM UTC-8, andypy...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages