saket / press

Cross-platform markdown editor written in Kotlin Multiplatform (work in progress)
1.87k stars 113 forks source link

Sync failed but created multiple branches on the repo #57

Closed msasikanth closed 4 years ago

msasikanth commented 4 years ago

I have created an empty repository without any master branch and then tried to sync notes. The app shows sync failed with an error but I see multiple branches being created on the repo. Is it necessary to create a repository with default master branch?

Here is the error log:

Syncing for the first time. Backing up notes to 'notes-backup-1603526100612' branch.
Unknown error. Will retry later. org.eclipse.jgit.api.errors.RefNotAdvertisedException: Remote origin did not advertise Ref for branch main. This Ref may not exist in the remote or may be hidden by permission settings.
    at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:291)
    at me.saket.kgit.RealGitRepository.pull(RealGitRepository.kt:178)
    at me.saket.press.shared.sync.git.GitSyncer.pull(GitSyncer.kt:256)
    at me.saket.press.shared.sync.git.GitSyncer.sync$shared_release(GitSyncer.kt:111)
    at me.saket.press.shared.sync.RealSyncCoordinator$syncWithResult$1.invoke(SyncCoordinator.kt:44)
    at me.saket.press.shared.sync.RealSyncCoordinator$syncWithResult$1.invoke(SyncCoordinator.kt:27)
    at com.badoo.reaktive.completable.VariousKt$completableFromFunction$$inlined$completable$1.subscribe(Various.kt:61)
    at com.badoo.reaktive.completable.VariousKt$completableFromFunction$$inlined$completable$1.subscribe(Various.kt:7)
    at com.badoo.reaktive.completable.AsObservableKt$asObservable$$inlined$observable$1.subscribe(Various.kt:110)
    at com.badoo.reaktive.completable.AsObservableKt$asObservable$$inlined$observable$1.subscribe(Various.kt:7)
    at com.badoo.reaktive.observable.TakeUntilObservableKt$takeUntil$$inlined$observable$1.subscribe(Various.kt:129)
    at com.badoo.reaktive.observable.TakeUntilObservableKt$takeUntil$$inlined$observable$1.subscribe(Various.kt:7)
    at com.badoo.reaktive.observable.AsCompletableKt$asCompletable$$inlined$completable$1.subscribe(Various.kt:61)
    at com.badoo.reaktive.observable.AsCompletableKt$asCompletable$$inlined$completable$1.subscribe(Various.kt:7)
    at com.badoo.reaktive.completable.OnErrorCompleteKt$onErrorComplete$$inlined$completable$1.subscribe(Various.kt:61)
    at com.badoo.reaktive.completable.OnErrorCompleteKt$onErrorComplete$$inlined$completable$1.subscribe(Various.kt:7)
    at com.badoo.reaktive.observable.FlatMapCompletableObserver.onNext(FlatMapCompletable.kt:36)
    at com.badoo.reaktive.observable.SwitchMapKt$switchMap$$inlined$observable$1$1.onNext(ObservableByEmitter.kt:17)
    at com.badoo.reaktive.observable.SerializedObservableCallbacks.onNext(SerializedObservableCallbacks.kt:34)
    at com.badoo.reaktive.observable.SwitchMapKt$switchMap$$inlined$observable$1$lambda$1$2.onNext(Unknown Source:2)
    at com.badoo.reaktive.observable.IntervalKt$observableInterval$$inlined$observable$1$1.onNext(ObservableByEmitter.kt:17)
    at com.badoo.reaktive.observable.IntervalKt$observableInterval$$inlined$observable$1$lambda$1.invoke(Interval.kt:13)
    at com.badoo.reaktive.observable.IntervalKt$observableInterval$$inlined$observable$1$lambda$1.invoke(Unknown Source:0)
    at com.badoo.reaktive.scheduler.ExecutorServiceScheduler$ExecutorImpl$Companion$wrapSchedulerTaskSafe$1.run(ExecutorServiceScheduler.kt:102)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:307)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:302)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:923)
ChanSek commented 4 years ago

I got the same problem:

Screenshot 2020-10-24 at 10 19 15 PM

The exception, I got is here:

Syncing notes with 'a776ba61' on Sat, 24 Oct 2020 10:50:04 UTC
Resetting to sha1: db2bd3c (Backup notes on 'a776ba61').
Syncing for the first time. Backing up notes to 'notes-backup-1603536604184' branch.
Unknown error. Will retry later. org.eclipse.jgit.api.errors.RefNotAdvertisedException: Remote origin did not advertise Ref for branch main. This Ref may not exist in the remote or may be hidden by permission settings.
at http://org.eclipse.jgit.api.PullCommand.call(https://t.co/KhC4zuh9vT)
at me.saket.kgit.RealGitRepository.pull(RealGitRepository.kt:178)
at http://me.saket.press.shared.sync.git.GitSyncer.pull(GitSyncer.kt:256)
at http://me.saket.press.shared.sync.git.GitSyncer.sync$shared_release(GitSyncer.kt:111)
at http://me.saket.press.shared.sync.RealSyncCoordinator$syncWithResult$1.invoke(SyncCoordinator.kt:44)
at http://me.saket.press.shared.sync.RealSyncCoordinator$syncWithResult$1.invoke(SyncCoordinator.kt:27)
at com.badoo.reaktive.completable.VariousKt$completableFromFunction$$inlined$completable$1.subscribe(Various.kt:61)
at com.badoo.reaktive.completable.VariousKt$completableFromFunction$$inlined$completable$1.subscribe(Various.kt:7)
at com.badoo.reaktive.completable.AsObservableKt$asObservable$$inlined$observable$1.subscribe(Various.kt:110)
at com.badoo.reaktive.completable.AsObservableKt$asObservable$$inlined$observable$1.subscribe(Various.kt:7)
at com.badoo.reaktive.observable.TakeUntilObservableKt$takeUntil$$inlined$observable$1.subscribe(Various.kt:129)
at com.badoo.reaktive.observable.TakeUntilObservableKt$takeUntil$$inlined$observable$1.subscribe(Various.kt:7)
at com.badoo.reaktive.observable.AsCompletableKt$asCompletable$$inlined$completable$1.subscribe(Various.kt:61)
at com.badoo.reaktive.observable.AsCompletableKt$asCompletable$$inlined$completable$1.subscribe(Various.kt:7)
at com.badoo.reaktive.completable.OnErrorCompleteKt$onErrorComplete$$inlined$completable$1.subscribe(Various.kt:61)
at com.badoo.reaktive.completable.OnErrorCompleteKt$onErrorComplete$$inlined$completable$1.subscribe(Various.kt:7)
at com.badoo.reaktive.observable.FlatMapCompletableObserver.onNext(FlatMapCompletable.kt:36)
at com.badoo.reaktive.observable.SwitchMapKt$switchMap$$inlined$observable$1$1.onNext(ObservableByEmitter.kt:17)
at com.badoo.reaktive.observable.SerializedObservableCallbacks.onNext(SerializedObservableCallbacks.kt:34)
at com.badoo.reaktive.observable.SwitchMapKt$switchMap$$inlined$observable$1$lambda$1$2.onNext(Unknown Source:2)
at com.badoo.reaktive.observable.IntervalKt$observableInterval$$inlined$observable$1$1.onNext(ObservableByEmitter.kt:17)
at com.badoo.reaktive.observable.IntervalKt$observableInterval$$inlined$observable$1$lambda$1.invoke(Interval.kt:13)
at com.badoo.reaktive.observable.IntervalKt$observableInterval$$inlined$observable$1$lambda$1.invoke(Unknown Source:0)
at com.badoo.reaktive.scheduler.ExecutorServiceScheduler$ExecutorImpl$Companion$wrapSchedulerTaskSafe$1.run(ExecutorServiceScheduler.kt:102)
at java.util.concurrent.Executors$RunnableAdapter.call(http://Executors.java:462)
at java.util.concurrent.FutureTask.runAndReset(http://FutureTask.java:307)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(http://ScheduledThreadPoolExecutor.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(http://ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(http://ThreadPoolExecutor.java:641)
at http://java.lang.Thread.run(https://t.co/0AnxwymJzH)

Wrapping up sync (before push) on Sat, 24 Oct 2020 10:50:13 UTC
ChanSek commented 4 years ago

I think, it can be reproducible if we try to sync with any repo if both the repo of GitHub and local notes in Press app are empty.

saket commented 4 years ago

without any master branch and then tried to sync notes.

Was there any other branch present?

Is it necessary to create a repository with default master branch?

No, Press will use any branch that's set as default on your repository.

FWIW someone else ran into the same issue but was able to workaround it by resetting sync.

saket commented 4 years ago

I realize I never tested sync with branch-less repository. I always had a branch present. Will fix this.

saket commented 4 years ago

@ChanSek is your device's bluetooth name a776ba61?

msasikanth commented 4 years ago

without any master branch and then tried to sync notes.

Was there any other branch present?

No, I have created an empty private repository that's all. It would also be really helpful to include this in description of the sync page. Initially I was assuming Press will create the repo and handle this automatically.

saket commented 4 years ago

Gotcha. Yeah creating a new repo within Press is something I gotta do.