Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gilt does not recognize tags added after the cache was cloned #142

Closed
0xDEC0DE opened this issue Feb 3, 2024 · 3 comments
Closed

Gilt does not recognize tags added after the cache was cloned #142

0xDEC0DE opened this issue Feb 3, 2024 · 3 comments

Comments

@0xDEC0DE
Copy link
Contributor

0xDEC0DE commented Feb 3, 2024

Spotted when trying to vendor in a fresh change; reproduction is a bit weird:

Steps to reproduce

Setup

mkdir repo cache target
cd repo
git init .
touch monkey
git add monkey
git commit -m 'i has a repo'
git tag -am v1 v1
cd ..
cat << EOF > target/Giltfile.yaml
giltDir: $(pwd)/cache
debug: true
repositories:
  - git: file:https://$(pwd)/repo
    version: v1
    sources:
    - src: monkey
      dstFile: monkey
EOF

Verify setup

cd target
gilt overlay

Finish setup

cd ../repo
touch banana
git add banana
git commit -m 'my hands are typing words'
git tag -am v2 v2
cd ..
cat << EOF > target/Giltfile.yaml
giltDir: $(pwd)/cache
debug: true
repositories:
  - git: file:https://$(pwd)/repo
    version: v2
    sources:
    - src: monkey
      dstFile: monkey
    - src: banana
      dstFile: banana
EOF

Test

cd target
gilt overlay

Expected result

target directory contains monkey and banana

Actual behavior

DBG result output="fatal: invalid reference: v2\n"
[...]
ERR error overlaying repositories err="exit status 128"

Workaround

cd ../cache/cache/*
git fetch --tags

...will update the cache with current data, and the overlay will succeed.

@0xDEC0DE 0xDEC0DE changed the title Gilt does not recognize tree-ish values added after the cache was cloned Gilt does not recognize tags added after the cache was cloned Feb 3, 2024
@0xDEC0DE
Copy link
Contributor Author

0xDEC0DE commented Feb 3, 2024

Update

  • Popping the cache also (obviously) works around the issue
  • Using a SHA instead of a tag appears to be unaffected; git worktree will fetch the required objects from the remote if a SHA is used for the version:

0xDEC0DE pushed a commit to 0xDEC0DE/gilt that referenced this issue Feb 3, 2024
Special care and handling is needed to keep tags up-to-date with
the remote; all other assets seem to be fetched/updated as needed.

Fixes: Issue retr0h#142
0xDEC0DE pushed a commit to 0xDEC0DE/gilt that referenced this issue Feb 3, 2024
Special care and handling is needed to keep tags up-to-date with
the remote; all other assets seem to be fetched/updated as needed.

Fixes: Issue retr0h#142
retr0h pushed a commit that referenced this issue Feb 3, 2024
Special care and handling is needed to keep tags up-to-date with
the remote; all other assets seem to be fetched/updated as needed.

Fixes: Issue #142
@retr0h
Copy link
Owner

retr0h commented Feb 3, 2024

Ahh good catch, py-gilt had the update functionality to facilitate branch support. Let me know if you want me to turn around and release a bug fix release sooner than later.

@0xDEC0DE
Copy link
Contributor Author

0xDEC0DE commented Feb 4, 2024

It's easy enough to work around, and our typical use case is in CI pipelines, which pop cache as part of cleanup; we're in no hurry.

@0xDEC0DE 0xDEC0DE closed this as completed Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants