Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

web: link to codehost when file is an LFS Pointer#43686

Merged
keegancsmith merged 16 commits into
mainfrom
k/lfs-schema-wip
Nov 10, 2022
Merged

web: link to codehost when file is an LFS Pointer#43686
keegancsmith merged 16 commits into
mainfrom
k/lfs-schema-wip

Conversation

@keegancsmith

@keegancsmith keegancsmith commented Oct 31, 2022

Copy link
Copy Markdown
Member

We extend the GraphQL schema to optionally have a field LFS. This field is non-null when the content of the git blob is a LFS pointer. When it is we show a page linking to the code host. This was a request from a customer.

The actual git lfs project uses similiar heuristics, except it does expect the full document to be this KV style. Other projects such as gitlab just use regexes and file size like we do.

image

Test Plan: manually visited in dev server LFS pointer files.

Co-authored-by: @limitedmage

This is a very minimal sketch of what we can add to our API to support
indicating a file is an LFS pointer. When a file is stored in LFS this
field will be non-nil.
@keegancsmith

Copy link
Copy Markdown
Member Author

@limitedmage I pushed a tiny update which makes the resolver pretend every file is in LFS. I didn't manage to do more than that today, but will try and make this end point functional tomorrow. If you have any feedback on the API, please go ahead. I can make any possible changes, this was designed very very quickly.

@sg-e2e-regression-test-bob

sg-e2e-regression-test-bob commented Nov 2, 2022

Copy link
Copy Markdown

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) 0.08% (+11.24 kb) 🔺 0.09% (+11.24 kb) 🔺 0.42% (+3) 🔺

Look at the Statoscope report for a full comparison between the commits dc50926 and 5c91557 or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@limitedmage

Copy link
Copy Markdown
Contributor

@keegancsmith I pushed a rudimentary-but-fully-featured UI for this. Let me know if you need anything else from the frontend!
image

@keegancsmith keegancsmith changed the title graphql: draft schema for LFS web: link to codehost when file is an LFS Pointer Nov 9, 2022
@keegancsmith keegancsmith marked this pull request as ready for review November 9, 2022 14:44
@sourcegraph-bot

sourcegraph-bot commented Nov 9, 2022

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff 5c91557...dc50926.

No notifications.

@limitedmage limitedmage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frontend and API look good to me. Please have someone else review the backend code :)

@keegancsmith

Copy link
Copy Markdown
Member Author

@stefanhengl or @ryanslade mind taking a look at the backend code? It's super simple, but luckily from reading the upstream implementations that is also simple :P

I'm gonna push a commit now with a changelog entry.

@keegancsmith keegancsmith mentioned this pull request Nov 10, 2022
3 tasks
Comment thread cmd/frontend/graphqlbackend/lfs.go Outdated
@keegancsmith keegancsmith enabled auto-merge (squash) November 10, 2022 14:41

@eseliger eseliger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice :)

Comment thread cmd/frontend/graphqlbackend/schema.graphql Outdated
@keegancsmith keegancsmith merged commit b71473c into main Nov 10, 2022
@keegancsmith keegancsmith deleted the k/lfs-schema-wip branch November 10, 2022 18:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants