ViperIDE icon indicating copy to clipboard operation
ViperIDE copied to clipboard

GitHub Repo Contents API

Open brainstorm opened this issue 1 year ago β€’ 5 comments

Following up from https://github.com/vshymanskyy/ViperIDE/issues/17#issuecomment-226719210

brainstorm avatar Aug 04 '24 00:08 brainstorm

The idea is cool 😎 But, i'm wondering how the sync could work. In instance, i have a GitHub repo with some files. Now, i'm connecting a device that may have a slightly (or completely) different file system. Which one is correct? Is this device even associated with the repository? Same applies to regular host filesystem access, if/when it gets implemented.

Agree that it's tricky to implement without either loading complexity on either configuration or opinionated default conventions.

As a first draft on this idea I'd probably limit it to making sure that the board is blank and then assume that the GH repo is the authoritative source of truth (SSOT). Then provide "escape hatches" for those users that already have files on the board but want to use that feature at their own risk... although moving those files to a repo first and wiping the device is not too onerous anyway?

For conflict resolution, I'd also assume that the repo changes come first and the device changes are something to resolve on the editor (via a diff/change merge view).... not trivial in any case, I agree.

brainstorm avatar Aug 04 '24 00:08 brainstorm

Yes, it gets even more complicated if you have multiple boards running the same firmware. It could easily lead to multiple boards running different (but clean) revisions of the same repo.

πŸ˜΅β€πŸ’«

vshymanskyy avatar Aug 04 '24 00:08 vshymanskyy

Yes, it gets even more complicated if you have multiple boards running the same firmware. It could easily lead to multiple boards running different (but clean) revisions of the same repo.

πŸ˜΅β€πŸ’«

In this case, wouldn't it be enough to save the HEAD git hash to disambiguate state? Or worst case, keeping the .git folder around that can later be removed when shipping to production?

brainstorm avatar Aug 04 '24 00:08 brainstorm

No, keeping .git on the device is not gonna work

vshymanskyy avatar Aug 04 '24 04:08 vshymanskyy

Git allows you to store the .git folder containing the repo in a different location git init --separate-git-dir mcu_repo/repo.git mcu

not sure if wasm-git allows for that, but if so, that would allow a structure where the src files are stored on the mcu , and the checked out repo / branch on browser / local store

β”œβ”€β”€β”€mcu ( physical device) 
└───mcu_repo
    └───repo.git
        β”œβ”€β”€β”€hooks
        β”œβ”€β”€β”€info
        β”œβ”€β”€β”€logs
        β”‚   └───refs
        β”‚       └───heads
        β”œβ”€β”€β”€objects
        β”‚   β”œβ”€β”€β”€01
        β”‚   └───pack
        └───refs

Josverl avatar Mar 26 '25 15:03 Josverl