Commit Graph

1276 Commits

Author SHA1 Message Date
Angel Petkov
dbfbcb14c1 project.py: Fix check for wild cards
The intention of the check is to verify whether the target
file name contains a wild card. The code, however, assumes
that if the file is non-existent - it contains a wild card.
This has the side effect that a target file that does not
exist at the moment of the check is considered to contain a
wild card, this leads itself to softlink not being created.

Change-Id: I4e4cd7b5e1b8ce2e4b2edc9abf5a1147cd86242f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/265736
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Angel Petkov <apetkov86@gmail.com>
2020-05-05 17:53:11 +00:00
Ulrik Laurén
d0ca0f6814 Parse included files when reading git config files
Git config files may have an include tag pointing to another file.
The included file is not parsed unless “git config --list” is
explicitly told to follow includes by adding the argument ”--includes”.

This change add the "--includes" when parsing the global gitconfig file.

Change-Id: I892c9a3a748754c1eb8c9e220578305ca5850dd5
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/264759
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Ulrik Laurén <ulrik.lauren@gmail.com>
2020-04-29 18:28:41 +00:00
Konrad Weihmann
433977e958 repo: exit on missing entry point
exit if no repo_main can be found right before executing the command.
This happens for instance when 'repo init' is run on root path
(for example in a container). Without this counter measure the tool
will crash at exec_command with
TypeError: sequence item 1: expected str instance, NoneType found

Change-Id: Ia8480cfe2151c3b35c9572789ad8cb619288cce1
Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263457
Reviewed-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@digital.ai>
2020-04-28 17:02:46 +00:00
Mike Frysinger
dd37fb2222 main: re-exec self with the current interp
The launcher already raised itself up to use Python 3 on the fly, and
the main.py script uses a plain `python` shebang.  So make sure we use
the active interpreter when re-execing ourselves to avoid falling back
down to Python 2 (which then triggers warnings).

Change-Id: Ic53c07dead3bc9233e4089a0a422f83bb5ac2f91
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263272
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@digital.ai>
2020-04-28 02:54:50 +00:00
Sean McAllister
af908cb543 When writing manifest, set the dest-branch attribute for projects
When generating a revision locked manifest, we need to know what
ref to push changes to when doing 'repo upload'.  This information
is lost when we lock the revision attribute to a particular commit
hash, so we need to expose it through the dest-branch attribute.

Bug: https://crbug.com/1005103
Test: manual execution
Change-Id: Ib31fd77ad8c9379759c4181dac1ea97de43eec35
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263572
Tested-by: Sean McAllister <smcallis@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
2020-04-20 16:35:02 +00:00
Sean McAllister
74e8ed4bde Expose upstream and dest-branch attributes through environment
Recent changes in ChromeOS Infra to ensure we're reading from
snapshot manifests properly have exposed several bugs in our
assumptions about manifest files.  Mainly that the revision field
for a project does _not_ have to refer to a ref, it can just be
a commit hash.

Several places assume that the revision field can be parsed as a
ref to get the branch the project is on, which isn't true.  To fix
this we need to be able to look at the upstream and dest-branch
attributes of the repo, so we expose them through the environment
variables set in `repo forall`.

Test: manual 'repo forall' run
Bug: https://crbug.com/1032441

Change-Id: I2c039e0f4b2e0f430602932e91b782edb6f9b1ed
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263132
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Sean McAllister <smcallis@google.com>
2020-04-16 18:42:53 +00:00
George Engelbrecht
2fe84e17b9 project.py: Remove extraneous ','
Bug: https://crbug.com/1061473
Change-Id: I0f02f122d6313679c1ae5ad6fb4e05f68b764186
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263112
Tested-by: George Engelbrecht <engeg@google.com>
Reviewed-by: George Engelbrecht <engeg@google.com>
Reviewed-by: SPA SARC <spanc.sarc@gmail.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
2020-04-15 19:55:44 +00:00
Mike Frysinger
1122353683 Revert "commit-msg: Insert Change-Id at start of trailers"
This reverts commit 653f8b711b.

Reason for revert: This requires git-2.15 which is much newer than
repo itself requires.  Lets pull it until we can figure out something
on the Gerrit side.

Bug: https://crbug.com/gerrit/12546
Change-Id: I5148f8a9cab5f0c305c020e31627b4af88cd5c95
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263012
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
2020-04-15 07:17:16 +00:00
George Engelbrecht
b6871899be project: have clone.bundle failures print better diagnostics
Bug: https://crbug.com/1061473

Change-Id: If066dc56ca575720bfb25c1a9892dbd6f4af15c6
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/261852
Tested-by: George Engelbrecht <engeg@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
2020-04-15 06:52:52 +00:00
Anders Björklund
8e0fe1920e Use hash for ControlPath instead of full variables
The generated socket path can be too long, if your FQDN is very long...

Typical error message from ssh client:
unix_listener: path "/tmp/ssh-fqduawon/master-USER@HOST:PORT.qfCZ51OAZgTzVLbg" too long for Unix domain socket

Use a hashed version instead, to keep within the socket file path limit.

This requires OpenSSH_6.7p1, or later.

Change-Id: Ia4bb9ae8aac6c4ee31d5a458f917f3753f40001b
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255632
Reviewed-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Anders Björklund <anders.bjorklund.2@volvocars.com>
2020-04-15 06:51:22 +00:00
Karsten Pfeiffer-Raddatz
d086467012 forall.py: Close file after removing the stream
In order to remove the stream fileno() will be called on the filedescriptor.
If the file is already closed fileno() will raise an error and forall
will fail.

Bug: https://crbug.com/gerrit/12563
Change-Id: Ib7b895fe881c844e3eb3672b011fdcdbdae63024
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/262838
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Karsten Pfeiffer-Raddatz <raddatz.karsten@gmail.com>
2020-04-14 06:49:31 +00:00
Marcos Marado
2735bfc5ff tests: fix SetupGnuPG test
The SetupGnuPG test tries to test the full setup, including the
creation of the directories. In order to do that, it create a
temporary directory, and redefines the home_dot_repo to point there.

When a home_dot_repo directory does not exist, it should be created.
The gpg_dir, which should exist inside home_dot_repo, also needs to be
created if it does not exist. However, since the gpg_dir path is
relative to home_dot_repo, once we redefine one, we need to redifine
the other.

The failure of this test might have gone unnoticed so far, since in
only fails if you do not have a ~/.repoconfig/gnupg/ on the
environment you are running the tests on.

Change-Id: Ic69d59e56137eea43349a61b5cf81f215c6a7f9a
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/262573
Reviewed-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Marcos Marado <mindboosternoori@gmail.com>
2020-04-12 17:12:14 +00:00
David Pursehouse
653f8b711b commit-msg: Insert Change-Id at start of trailers
In older versions of Gerrit the Change-Id field was inserted at the
start of the trailers. Commit 68296f71804feab2e0ae18ae33f834a8a41621e4
simplified the trailers code by using git trailers instead of custom
code but now inserts Change-Id at the end of the trailers section.

A consequence of this is that folks who sign-off their commits using
`git commit -s` now has the sign-off appear first followed by
Change-Id. If the user then runs `git commit -s --amend` to update
the change because the Sign-off-by line is not last, git inserts
a 2nd duplicate Signed-off-by line.

This patch simply restores the previous behaviour of the Gerrit
commit-msg hook where Change-Id would be inserted before the
Sign-off-by line to avoid this issue.

Backported from [1] by Thanh Ha.

[1] https://gerrit-review.googlesource.com/c/gerrit/+/262072

Bug: https://crbug.com/12546
Change-Id: I1406c763a3935761247f6771f55e02367f698e6e
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/262352
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: David Pursehouse <dpursehouse@collab.net>
2020-04-08 01:47:54 +00:00
George Engelbrecht
9bc283e49b sync: add retry to fetch operations
Add retries with exponential backoff and jitter to the fetch
operations. By default don't change behavior and enable
behind the new flag '--fetch-retries'.

Bug: https://crbug.com/1061473

Change-Id: I492710843985d00f81cbe3402dc56f2d21a45b35
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/261576
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: George Engelbrecht <engeg@google.com>
2020-04-02 21:17:54 +00:00
Mike Frysinger
b4a6f6d798 version: include tag commit date for easy reference
This is more for users trying to get a sense of how old/new their
current version of repo is when debugging issues.

Change-Id: Ifb413c679bb8c8dbf4f9334137adf086bb000a68
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/261192
Reviewed-by: Jonathan Nieder <jrn@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
2020-03-31 03:27:57 +00:00
Mike Frysinger
3e5b269fc6 launcher: bump version for accumulated fixes
Change-Id: I45da9facb525355c4963735e087d87024dea2017
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/260232
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Jonathan Nieder <jrn@google.com>
2020-03-25 05:54:26 +00:00
Mike Frysinger
cdb344c0e7 launcher: avoid crash when executing out of checkout
When developing repo itself, it helps to run repo directly out of it
and to run bisection tools.  The current _SetDefaultsTo logic fails
in that situation though as it wants a branch, but the source isn't
checked out to one.  Now that we support tracking commits via the
--repo-rev setting, fall back to using the current HEAD commit.

Change-Id: I37d79fd9f7bea87d212421ebed6c8267ec95145f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/260192
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Jonathan Nieder <jrn@google.com>
2020-03-25 04:56:16 +00:00
Mike Frysinger
e257d56665 version: fix running under Python 2
This gets the unittests passing again for now.

Change-Id: Ibed430a305bc26b907ad0ea424c7eec7de37e942
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259994
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Jonathan Nieder <jrn@google.com>
2020-03-25 04:56:07 +00:00
Mike Frysinger
3599cc3975 init: respect --repo-rev changes
We respect this option when running the first `repo init`, but then
silently ignore it once the initial sync is done.  Make sure users
are able to change things on the fly.

We refactor the wrapper API to allow reuse between the two init's.

Bug: https://crbug.com/gerrit/11045
Change-Id: Icb89a8cddca32f39a760a6283152457810b2392d
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/260032
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Jonathan Nieder <jrn@google.com>
2020-03-25 04:55:50 +00:00
Mike Frysinger
cfc8111f5e init: allow REPO_REV/--repo-rev to specify commits/tags
While the help/usage suggested that revisions would work, they never
actually did, and just throw confusing errors.  Now that we warn if
the checkout isn't tracking a branch, allow people to specify commits
or tags explicitly.  Hopefully our nags will be sufficient to keep
most people on the right path.

Bug: https://crbug.com/gerrit/11045
Change-Id: I6ea32c677912185f55ab20faaa23c6c0a4c483b3
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259492
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Jonathan Nieder <jrn@google.com>
2020-03-24 05:01:23 +00:00
Mike Frysinger
587f162033 tests: add more wrapper unittests
Change-Id: Ic6b4eb96b871793bc9463c9047674cf3cfbe4b5e
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259993
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Jonathan Nieder <jrn@google.com>
2020-03-24 03:08:25 +00:00
Mike Frysinger
78964472ad download: add a --branch option
This allows people to quickly create new branches when pulling down
changes rather than having to juggle the git calls themselves.

Bug: https://crbug.com/gerrit/11609
Change-Id: Ie6a4d05e9f4e9347fe7f7119c768e6446563ae65
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259855
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
2020-03-23 00:31:10 +00:00
Mike Frysinger
05097c6222 download: unify error handling with sub git calls
We gracefully handle cherry-pick errors, but none of the others
which means people get confusing Python tracebacks.  Move the
main logic in a single GitError try block so we can show pretty
error messages for all of them.

Change-Id: I52cdf6468d21a98de7f65b86d5267b3caabd5af8
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259854
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
2020-03-23 00:28:54 +00:00
Mike Frysinger
915fda130e download: support -x when cherry-picking
This is a pretty common option for people to want too use, so include
it as a pass-thru option when cherry-picking.

Bug: https://crbug.com/gerrit/9418
Change-Id: I2a24c1ed7544541719caa4d3c0574347a151a1b0
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259853
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
2020-03-23 00:27:52 +00:00
Mike Frysinger
ea43176de0 download: support --ff when cherry-picking
The git cherry-pick already supports this, so plumb the existing repo
option down.  Otherwise it's confusing when people use -c --ff and it
doesn't use that behavior.

Change-Id: Id68932ffa09204bb30b92a21aff185c00394a520
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259852
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
2020-03-23 00:26:26 +00:00
Mike Frysinger
58ac1678e8 init: rename --repo-branch to --repo-rev
We refer to this as "revision" in help text, and in REPO_REV envvar,
so rename to --repo-rev to be consistent.  We keep --repo-branch for
backwards compatibility, but as a hidden option.

Bug: https://crbug.com/gerrit/11045
Change-Id: I1ecc282fba32917ed78a63850360c08469db849a
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259352
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-03-18 00:24:43 +00:00
Mike Frysinger
e1111f5710 launcher: init: stop passing --repo-url/--repo-branch down
When the launcher handles the init subcommand, it takes care of
setting the repo url & branch itself when cloning.  So we don't
need to pass them down to the checked out init subcommand.

Further, the init subcommand has never actually done anything
with those options, so there's no point in passing them.

We'll be changing the latter behavior so that init will reset
the url/branch when specified with an existing repo checkout
which means passing them through adds overhead: the launcher
will checkout to the right value, then chain to the sub-init
which will then reset the checkout to the same value.

Bug: https://crbug.com/gerrit/11045
Change-Id: Ia2a4ab9d86febc470aea4abd73d75bb10e848b56
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259312
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-03-17 09:24:04 +00:00
Mike Frysinger
7936ce8677 init: respect --repo-url changes
We respect this option when running the first `repo init`, but then
silently ignore it once the initial sync is done.  Make sure users
are able to change things on the fly.

Bug: https://crbug.com/gerrit/11045
Change-Id: I129ec5fec43a85067d555bb60c0d1ae02465f139
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/258893
Tested-by: David Pursehouse <dpursehouse@collab.net>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-03-17 05:39:17 +00:00
Mike Frysinger
23c900f105 sync: warn if not tracking a branch
Since tracking a branch prevents repo from updating, make sure we
warn people about the situation when using `repo sync`.

Bug: https://crbug.com/gerrit/11045
Change-Id: I966513f510827cc93194f8df176c6745946bd739
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/258892
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-03-17 05:38:19 +00:00
Mike Frysinger
bb930461ce subcmds: stop instantiating at import time
The current subcmds design has singletons in all_commands.  This isn't
exactly unusual, but the fact that our main & help subcommand will then
attach members to the classes before invoking them is.  This makes it
hard to keep track of what members a command has access to, and the two
code paths (main & help) attach different members depending on what APIs
they then invoke.

Lets pull this back a step by storing classes in all_commands and leave
the instantiation step to when they're used.  This doesn't fully clean
up the confusion, but gets us closer.

Change-Id: I6a768ff97fe541e6f3228358dba04ed66c4b070a
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259154
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-03-17 00:08:52 +00:00
Mike Frysinger
d3639c53d5 subcmds: centralize all_commands logic
The branch->branches alias is setup in the main module when that
really belongs in the existing all_commands setup.

For help, rather than monkey patching all_commands to the class,
switch it to use the state directly from the module.  This makes
it a bit more obvious where it's coming from rather than this one
subcommand having a |commands| member added externally to it.

Change-Id: I0200def09bf4774cad8012af0f4ae60ea3089dc0
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259153
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-03-17 00:08:52 +00:00
Mike Frysinger
f725e548db upload: add config setting for upload notifications
This allows people to set default e-mail notifications via gitconfig.

Bug: https://crbug.com/gerrit/12451
Change-Id: Ic04ea3b7df0c5603c491961112c5be8cabb9dddd
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259014
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-03-15 08:31:35 +00:00
Mike Frysinger
4847e05743 repo/init/sync: rework default git download output
When we download git sources, we get a progress bar (good) and we get
a dump of all the refs we downloaded (bad) as it can easily be 100+ if
not 1000+ depending on the project (for each git repo!).  Lets rework
the output behavior so that:
* quiet: Only errors.
* default: Progress bars (if on a tty).
* verbose: Full output (progress bars & downloaded refs).

Bug: https://crbug.com/gerrit/11293
Change-Id: I87a380075e79de6805f91095876dd1b37d32873a
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256456
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Michael Mortensen <mmortensen@google.com>
2020-03-14 04:02:42 +00:00
Mike Frysinger
bb8ee7f54a manifest_xml: unify bool & int parsing
We've been overly lenient with boolean parsing by ignoring invalid
values as "false" even if the user didn't intend that.  Turn all
unknown values into warnings to avoid breaking existing manifests,
and unify the parsing logic in a helper to simplify.

We've been stricter about numbers, but still copying & pasting
inconsistent code.  Add a helper for this too.  For out of range
sync-j numbers (i.e. less than 1), throw a warning for now, but
mark it for future hard failures.

Change-Id: I924162b8036e6a5f1e31b6ebb24b6a26ed63712d
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256457
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
2020-03-13 18:48:52 +00:00
Theodore Dubois
23d7dafd10 Reland "Port _FileDescriptorStreamsNonBlocking to use poll()"
Now that repo 2 requires Python 3, we can reland this.

This reverts commit 91d9587e45.

Change-Id: Id5b178ebb53bdba04bfa79cbb5c698ae5080c957
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/258672
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Theodore Dubois <tbodt@google.com>
2020-03-13 17:45:36 +00:00
Connor Newton
8b40c00eab diffmanifests: honour --pretty-format when printing --raw
Enable using --pretty-format to build a custom subject line
even when using the --raw option.

Change-Id: I0c1e682d984e56698fe65939aa6de12a653cd0f1
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/258565
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Connor Newton <connor@ifthenelse.io>
2020-03-13 09:50:46 +00:00
Mike Frysinger
e20da3eeed sync: fix os.environ logic errors
This is a dict to index, not a function to call.

Change-Id: I0117eeaaa8b2ef4762ab6f0d22f9ffdaee961f52
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/258132
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-03-07 13:10:14 +00:00
Mike Frysinger
910dfe8497 launcher: warn when verification is disabled
Make it clear(er) to the user that this option is dangerous.

Bug: https://crbug.com/gerrit/11045
Change-Id: I5580996c26653a7c823b69008de3626abf1b0068
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/257333
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-03-01 03:44:03 +00:00
Mike Frysinger
21b7fbe14d project: fix m/ pseudo ref handling with git worktrees
Since most ref namespaces are shared among all worktrees, trying to
set the pseudo m/<branch> in the common git repo ends up clobbering
each other when using shared checkouts.  For example, in CrOS:
  <project path="src/third_party/kernel/v3.8"
           name="chromiumos/third_party/kernel"
           revision="refs/heads/chromeos-3.8" />
  <project path="src/third_party/kernel/v3.10"
           name="chromiumos/third_party/kernel"
           revision="refs/heads/chromeos-3.10" />

Trying to set m/master in chromiumos/third_party/kernel.git/ will
keep clobbering the other.

Instead, when using git worktrees, lets set the m/ pseudo ref to
point into the refs/worktree/ namespace which is unique to each
git worktree.  So we have in the common dir:
  chromiumos/third_party/kernel.git/:
    refs/remotes/m/master:
      ref: refs/worktree/m/master
And then in each worktree we point refs/worktree/m/master to the
respective manifest revision expression.  Now people can use the
m/master in each git worktree and have it resolve to the right
commit for that worktree.

Bug: https://crbug.com/gerrit/12404
Change-Id: I78814bdd5dd67bb13218c4c6ccd64f8a15dd0a52
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256952
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-02-29 07:22:08 +00:00
Mike Frysinger
b967f5c17a release: add tips for when to push prod changes
Change-Id: Iabfdd322acbc60ee16e5222ecdb261cd3a3c2cf9
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/257332
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-02-29 07:20:24 +00:00
Mike Frysinger
dc15532bee README: use new bug template
This will prefill all the settings so users can report things better.

Change-Id: I1ccfd3a2c6835489db1fd2ba71aee39058ffe597
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256872
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-02-26 23:20:43 +00:00
Mike Frysinger
eea23b44a9 main: improve launcher update messaging wrt system installs
Some users get repo from their distro (e.g. /usr/bin/repo), so the
suggestion to copy over top of it makes people uneasy, if it's even
possible in the first place.

Bug: https://crbug.com/gerrit/12335
Change-Id: I9a0c83d6ba0f466fa8e6d61f674ee13396f9a968
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256893
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-02-26 23:20:10 +00:00
Mike Frysinger
5f11eac147 launcher/version: include OS/CPU info in output
We often ask users what OS/version they're running when debugging.
Include that in the version output to simplify the process.

Change-Id: Ie480b6d1c874e6f4c6f4996a03795077b844f858
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256732
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
2020-02-25 23:31:47 +00:00
Mike Frysinger
b0fbc7fb58 upload: drop support for drafts
Draft CLs were replaced by private/wip CLs in Gerrit instead years ago.

Change-Id: If4f3d6606aad40a6f1617a49681dfd45c64d3d37
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256673
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
2020-02-25 20:58:09 +00:00
Mike Frysinger
4c418bf423 README: link to mailing list & add Contact section
Change-Id: I65834e74c1c74f257d17b9da84b00e855ad42599
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256464
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-02-24 23:36:21 +00:00
Mike Frysinger
fc1b18ae9e upload: allow users to set labels when uploading
Bug: https://crbug.com/gerrit/11801
Change-Id: I060465105b4e68ddfc815e572f62bf5dac2c1ffd
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256614
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
2020-02-24 23:35:47 +00:00
Mike Frysinger
d957ec6a83 manifest_xml: skip config lookup during first init
Trying to use the config state when the git tree hasn't yet been
created hits bad side effects.  Add a check to avoid probing the
config logic during the first run.  It's not clear what's going
wrong at the lower layers, but this gets us back to the behavior
before we added worktree support, so lets settle the status quo.

Bug: https://crbug.com/gerrit/12387
Change-Id: I85b56797455f3c2e249d02c18496e060be05501d
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256592
Reviewed-by: Xin Li <delphij@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
2020-02-24 21:17:08 +00:00
Mike Frysinger
9f91c4395a project: replace GetHeadPath with new git helper
Change-Id: I79931cb484508c78f6a8b8413d05b85ed8bc6d98
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256533
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
2020-02-24 17:41:40 +00:00
Mike Frysinger
4b0eb5a441 project: fix rebase check with worktrees
Add a helper to our git wrapper to find the .git subdir,
and then use that to detect internal rebase state.

Change-Id: I3b3b6ed4c1f45cc8c3c98dc19c7ca3aabdc46905
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256532
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
2020-02-24 17:41:36 +00:00
Sean McAllister
d38300c756 manifest: support optional --manifest-name
Still use the repo manifest by default as before, but gives us
the option of overriding it to support e.g.: using a subset of
the full manifest.

Change-Id: Ia42cd1cb3a0a58929d31bb01c9724e9d31f68730
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256372
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Sean McAllister <smcallis@google.com>
2020-02-22 19:17:40 +00:00