Skip to content

Commit

Permalink
issue warning on requested update of pinned repo
Browse files Browse the repository at this point in the history
When pinning a repo to a specific commit (using the 'commit') config
item, this repo cannot be updated. This is different from using the
override: commit entry of the lockfiles, which is ignored on updates
(technically the lockfile is ignored).

As this behavior already confused users, file a warning when running an
update on pinned repos. When using the deprecated refspec, no warning is
issues, as we cannot distinguish commits, branches and tags.

Reported-by: Jan Kiszka <[email protected]>
Signed-off-by: Felix Moessbauer <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
fmoessbauer authored and jan-kiszka committed Feb 20, 2024
1 parent 4461c09 commit 8f60430
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kas/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ def factory(name, repo_config, repo_defaults, repo_fallback_path,
'for local repositories.')
if refspec is None:
commit = repo_overrides.get('commit', commit)
if commit and get_context().update:
logging.warning(f'Update of {name} requested, but repo is '
'pinned to a fixed commit. Not updating.')
else:
if name not in Repo.__legacy_refspec_warned__:
logging.warning('Using deprecated refspec for repository "%s".'
Expand Down

0 comments on commit 8f60430

Please sign in to comment.