opengist icon indicating copy to clipboard operation
opengist copied to clipboard

a qn about synchronize features

Open phanirithvij opened this issue 1 year ago • 2 comments

func syncReposFromFS () {
  gists, err := db.GetAllGistsRows()
  for range gists {
    // if repository does not exist, delete gist from database
    if _, err := os.Stat(git.RepositoryPath(gist.User.Username, gist.Uuid)); err != nil && !os.IsExist(err) {
      if err2 := gist.Delete(); {}
    }
  }

I read this as cleanup unknown gists in db

But synchronize gists from filesystem means the following ideally.

I clone a github gist for eg. in opengist-home/repos/{user}/{gistid} as a bare repo, then synchronize should add it to db. (i.e. the index and import feature on the backend as supposted to from the UI https://github.com/thomiceli/opengist/issues/208)

similarly sync from db is actually cleanup unknown gists in filesystem

phanirithvij avatar Nov 12 '24 10:11 phanirithvij

You're right, it's not really a good semantic atm. We should change something like cleanup unknown gists in filesystem

thomiceli avatar Nov 17 '24 17:11 thomiceli

I also was tricked into thinking I could clone a bare repository into $opengist-home/repo/user/ and have it "synced" into Opengist.

FWIW, the reason I was trying this: I'd like to synchronize the repository directory across to a laptop which can use the same repo with a distinct Openbist SQLite3 database for taking along.

jpmens avatar Jul 25 '25 14:07 jpmens