init: support -b HEAD as a shortcut to "the default"

When people switch to non-default branches, they sometimes want to
switch back to the default, but don't know the exact name for that
branch.  Add a -b HEAD shortcut for that.

Change-Id: I090230da25f9f5a169608115d483f660f555624f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297843
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger
2021-02-23 15:43:07 -05:00
parent 92304bff00
commit 23882b33fe
2 changed files with 10 additions and 6 deletions

4
repo
View File

@ -289,8 +289,8 @@ def GetParser(gitc_init=False):
group = parser.add_option_group('Manifest options')
group.add_option('-u', '--manifest-url',
help='manifest repository location', metavar='URL')
group.add_option('-b', '--manifest-branch',
help='manifest branch or revision', metavar='REVISION')
group.add_option('-b', '--manifest-branch', metavar='REVISION',
help='manifest branch or revision (use HEAD for default)')
group.add_option('-m', '--manifest-name',
help='initial manifest file', metavar='NAME.xml')
cbr_opts = ['--current-branch']