Replies: 1 comment
-
To add some context, I would like to have the ability to update existing repos instead of replacing them, because a persistent repo ID number would greatly simplify the handling of files and directories related to a repository, e.g. the local workdir for a Git repo. (This is relevant for #21.) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to understand why, when a repo is changed, the repo is not updated, but deleted and then a new one is created. There is a comment which supposedly explains why:
orgzly-android-revived/app/src/main/java/com/orgzly/android/data/DataRepository.kt
Lines 2003 to 2012 in 4e4a661
The repo_url DB column only allows unique keys, and has always done so. So, it should be impossible to change the repo URL to one already in use. And it's not like the old repo item is kept around -- it is deleted from the database.
(The URL column is not the primary key in the table -- the repo ID is.)
The logic was present in the very first commit, with a similar comment:
orgzly-android-revived/app/src/main/java/com/orgzly/android/provider/clients/ReposClient.java
Lines 105 to 119 in 6fd88fd
I assume that @nevenz considered the comment important, since he kept it around and re-phrased it throughout several changes and refactorings (e.g. 728fc6d).
On the other hand, since we don't have more history, I suppose it is possible that the comment was written at a time when the repo_url column did not have the UNIQUE property. But then it seems unlikely that he would have kept the comment around.
I will probably try to see what happens if we were to change this behaviour. But I would love to hear if someone understands the comment and the code better than me. What am I missing?
Beta Was this translation helpful? Give feedback.
All reactions