Commit 5ab870e0ab
Verified · cmc
Changed files (11)
- Sources/OrgApp/DocumentSession.swift +19 −1
- Sources/OrgPrograms/Git.swift added +146
- Sources/OrgPrograms/GitAutoCommit.swift added +220
- Sources/Orgstar/GitSettings.swift added +54
- Sources/Orgstar/OrgstarApp.swift +21 −1
- Tests/OrgProgramsTests/GitAutoCommitTests.swift added +250
- docs/manual/guide/01-files-and-folders.org +25 −1
- docs/manual/guide/13-configuration.org +11 −1
- docs/manual/install.org +1
- l10n/DeveloperID.xcstrings +731 −17
- scripts/sync-strings.sh +1 −1
Sources/OrgApp/DocumentSession.swift +19 −1 · view
| @@ -92,6 +92,8 @@ public final class DocumentSession { | ||
| 92 | 92 | public var options: EditingOptions = .org |
| 93 | 93 | /// Called with a file's path after its text changed through the session, typed or not. |
| 94 | 94 | @ObservationIgnored public var textChanged: ((String) -> Void)? |
| 95 | /// Called with a file's path each time a save wrote it to disk. | |
| 96 | @ObservationIgnored public var fileWritten: ((String) -> Void)? | |
| 95 | 97 | /// TODO keywords and priorities for files without their own settings. |
| 96 | 98 | public var defaults: OrgSettings = .default |
| 97 | 99 | |
| @@ -418,7 +420,9 @@ public final class DocumentSession { | ||
| 418 | 420 | |
| 419 | 421 | // MARK: - Saving |
| 420 | 422 | |
| 421 | private var saver: Saver { Saver(fileSystem: fileSystem, recovery: recovery) } | |
| 423 | private var saver: Saver { | |
| 424 | Saver(fileSystem: WriteReporting(base: fileSystem) { [weak self] url in MainActor.assumeIsolated { self?.fileWritten?(url.path) } }, recovery: recovery) | |
| 425 | } | |
| 422 | 426 | |
| 423 | 427 | private func scheduleAutosave(_ entry: Entry) { |
| 424 | 428 | entry.autosave?.cancel() |
| @@ -1136,3 +1140,17 @@ public final class DocumentSession { | ||
| 1136 | 1140 | refresh(entry) |
| 1137 | 1141 | } |
| 1138 | 1142 | } |
| 1143 | ||
| 1144 | /// `base`, telling `written` about each file it replaced. | |
| 1145 | private struct WriteReporting: FileSystem { | |
| 1146 | let base: FileSystem | |
| 1147 | let written: @Sendable (URL) -> Void | |
| 1148 | ||
| 1149 | func read(_ url: URL) throws -> [UInt8]? { try base.read(url) } | |
| 1150 | ||
| 1151 | func replace(_ url: URL, with bytes: [UInt8]) throws -> [UInt8]? { | |
| 1152 | let replaced = try base.replace(url, with: bytes) | |
| 1153 | written(url) | |
| 1154 | return replaced | |
| 1155 | } | |
| 1156 | } | |
Sources/OrgPrograms/Git.swift added +146 · view
| @@ -0,0 +1,146 @@ | ||
| 1 | #if os(macOS) | |
| 2 | import Foundation | |
| 3 | ||
| 4 | /// The system git, run as a process that can't prompt for anything and is stopped after a time | |
| 5 | /// limit. | |
| 6 | public struct Git: Sendable { | |
| 7 | public let executable: URL | |
| 8 | ||
| 9 | public struct Output: Sendable { | |
| 10 | public let status: Int32 | |
| 11 | public let stdout: String | |
| 12 | public let stderr: String | |
| 13 | public var succeeded: Bool { status == 0 } | |
| 14 | /// The first line of what git said went wrong. | |
| 15 | public var problem: String { | |
| 16 | let lines = (stderr + "\n" + stdout).split(separator: "\n").map { $0.trimmingCharacters(in: .whitespaces) }.filter { !$0.isEmpty } | |
| 17 | return lines.first { $0.hasPrefix("fatal:") || $0.hasPrefix("error:") } ?? lines.first ?? "git exited with status \(status)" | |
| 18 | } | |
| 19 | } | |
| 20 | ||
| 21 | public struct Failure: Error, CustomStringConvertible { | |
| 22 | public let description: String | |
| 23 | } | |
| 24 | ||
| 25 | public init(executable: URL) { | |
| 26 | self.executable = executable | |
| 27 | } | |
| 28 | ||
| 29 | /// `ORGSTAR_GIT`, the usual install locations, then the `PATH` Babel uses. `/usr/bin/git` only | |
| 30 | /// when the developer tools are installed: without them it asks to install them. | |
| 31 | public static func find(environment: [String: String] = ProcessInfo.processInfo.environment) -> Git? { | |
| 32 | let path = (BabelRunner.environment["PATH"] ?? "").split(separator: ":").map { "\($0)/git" } | |
| 33 | let candidates = [environment["ORGSTAR_GIT"]].compactMap { $0 } + [ | |
| 34 | "/opt/homebrew/bin/git", "/usr/local/bin/git", "/run/current-system/sw/bin/git", | |
| 35 | ] + path | |
| 36 | for candidate in candidates where FileManager.default.isExecutableFile(atPath: candidate) { | |
| 37 | if candidate == "/usr/bin/git", !developerToolsInstalled { continue } | |
| 38 | return Git(executable: URL(fileURLWithPath: candidate)) | |
| 39 | } | |
| 40 | return nil | |
| 41 | } | |
| 42 | ||
| 43 | static let developerToolsInstalled: Bool = { | |
| 44 | let process = Process() | |
| 45 | process.executableURL = URL(fileURLWithPath: "/usr/bin/xcode-select") | |
| 46 | process.arguments = ["-p"] | |
| 47 | let out = Pipe() | |
| 48 | process.standardOutput = out | |
| 49 | process.standardError = FileHandle.nullDevice | |
| 50 | guard (try? process.run()) != nil else { return false } | |
| 51 | let folder = String(decoding: out.fileHandleForReading.readDataToEndOfFile(), as: UTF8.self).trimmingCharacters(in: .whitespacesAndNewlines) | |
| 52 | process.waitUntilExit() | |
| 53 | return process.terminationStatus == 0 && FileManager.default.isExecutableFile(atPath: folder + "/usr/bin/git") | |
| 54 | }() | |
| 55 | ||
| 56 | /// Babel's environment with every way git or ssh could ask for a password or a host key | |
| 57 | /// turned into a failure, English messages, and no optional index locks. | |
| 58 | static var environment: [String: String] { | |
| 59 | var environment = BabelRunner.environment | |
| 60 | environment["GIT_TERMINAL_PROMPT"] = "0" | |
| 61 | environment["GIT_ASKPASS"] = "/usr/bin/false" | |
| 62 | environment["SSH_ASKPASS"] = "/usr/bin/false" | |
| 63 | environment["SSH_ASKPASS_REQUIRE"] = "force" | |
| 64 | environment["GIT_OPTIONAL_LOCKS"] = "0" | |
| 65 | environment["GIT_EDITOR"] = "/usr/bin/false" | |
| 66 | environment["LC_ALL"] = "C" | |
| 67 | environment["LANG"] = "C" | |
| 68 | return environment | |
| 69 | } | |
| 70 | ||
| 71 | /// Runs git with `arguments` in `directory`. Output goes through files, so a child that | |
| 72 | /// keeps a descriptor open can't hold up the result. Throws when the time limit passes. | |
| 73 | public func run(_ arguments: [String], in directory: URL, timeout: Duration = .seconds(30)) async throws -> Output { | |
| 74 | let folder = FileManager.default.temporaryDirectory.appendingPathComponent("orgstar-git-\(UUID().uuidString)") | |
| 75 | try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) | |
| 76 | defer { try? FileManager.default.removeItem(at: folder) } | |
| 77 | let outURL = folder.appendingPathComponent("out"), errURL = folder.appendingPathComponent("err") | |
| 78 | FileManager.default.createFile(atPath: outURL.path, contents: nil) | |
| 79 | FileManager.default.createFile(atPath: errURL.path, contents: nil) | |
| 80 | let out = try FileHandle(forWritingTo: outURL), err = try FileHandle(forWritingTo: errURL) | |
| 81 | defer { | |
| 82 | try? out.close() | |
| 83 | try? err.close() | |
| 84 | } | |
| 85 | let process = Process() | |
| 86 | process.executableURL = executable | |
| 87 | process.arguments = ["-c", "core.quotePath=false"] + arguments | |
| 88 | process.currentDirectoryURL = directory | |
| 89 | process.environment = Self.environment | |
| 90 | process.standardInput = FileHandle.nullDevice | |
| 91 | process.standardOutput = out | |
| 92 | process.standardError = err | |
| 93 | try process.run() | |
| 94 | let deadline = ContinuousClock.now + timeout | |
| 95 | while process.isRunning { | |
| 96 | if ContinuousClock.now > deadline { | |
| 97 | process.terminate() | |
| 98 | throw Failure(description: "git \(arguments.first ?? "") took longer than \(timeout.components.seconds) seconds and was stopped") | |
| 99 | } | |
| 100 | try? await Task.sleep(for: .milliseconds(20)) | |
| 101 | } | |
| 102 | return Output( | |
| 103 | status: process.terminationStatus, | |
| 104 | stdout: String(decoding: (try? Data(contentsOf: outURL)) ?? Data(), as: UTF8.self), | |
| 105 | stderr: String(decoding: (try? Data(contentsOf: errURL)) ?? Data(), as: UTF8.self) | |
| 106 | ) | |
| 107 | } | |
| 108 | ||
| 109 | /// The work tree and git folder holding `directory`, with symbolic links resolved; nil | |
| 110 | /// outside a repository. | |
| 111 | public func repository(containing directory: URL) async -> (top: URL, gitDir: URL)? { | |
| 112 | guard let output = try? await run(["rev-parse", "--show-toplevel", "--absolute-git-dir"], in: directory), output.succeeded else { return nil } | |
| 113 | let lines = output.stdout.split(separator: "\n").map(String.init) | |
| 114 | guard lines.count >= 2 else { return nil } | |
| 115 | return (URL(fileURLWithPath: lines[0]).resolvingSymlinksInPath(), URL(fileURLWithPath: lines[1]).resolvingSymlinksInPath()) | |
| 116 | } | |
| 117 | ||
| 118 | /// `file` relative to the work tree `top`, after resolving symbolic links. | |
| 119 | public static func relativePath(_ file: URL, in top: URL) -> String? { | |
| 120 | let path = file.resolvingSymlinksInPath().path, base = top.resolvingSymlinksInPath().path | |
| 121 | guard path.hasPrefix(base + "/") else { return nil } | |
| 122 | return String(path.dropFirst(base.count + 1)) | |
| 123 | } | |
| 124 | ||
| 125 | /// The operation git is in the middle of in `gitDir`, which a commit or pull would disturb: | |
| 126 | /// `rebase`, `merge`, `cherry-pick`, `revert`, `bisect`, or `index.lock` while another git | |
| 127 | /// command holds the index. Nil when there is none. | |
| 128 | public static func operationInProgress(_ gitDir: URL) -> String? { | |
| 129 | let marks: [(String, String)] = [ | |
| 130 | ("rebase-merge", "rebase"), ("rebase-apply", "rebase"), ("MERGE_HEAD", "merge"), | |
| 131 | ("CHERRY_PICK_HEAD", "cherry-pick"), ("REVERT_HEAD", "revert"), ("BISECT_LOG", "bisect"), | |
| 132 | ("index.lock", "index.lock"), | |
| 133 | ] | |
| 134 | return marks.first { FileManager.default.fileExists(atPath: gitDir.appendingPathComponent($0.0).path) }?.1 | |
| 135 | } | |
| 136 | ||
| 137 | /// Whether git's message says the remote refused or couldn't ask for credentials. | |
| 138 | public static func isAuthenticationFailure(_ message: String) -> Bool { | |
| 139 | let signs = [ | |
| 140 | "Authentication failed", "could not read Username", "could not read Password", "terminal prompts disabled", | |
| 141 | "Permission denied (publickey", "Host key verification failed", "returned error: 403", "returned error: 401", | |
| 142 | ] | |
| 143 | return signs.contains { message.localizedCaseInsensitiveContains($0) } | |
| 144 | } | |
| 145 | } | |
| 146 | #endif | |
Sources/OrgPrograms/GitAutoCommit.swift added +220 · view
| @@ -0,0 +1,220 @@ | ||
| 1 | #if os(macOS) | |
| 2 | import Foundation | |
| 3 | import Observation | |
| 4 | ||
| 5 | /// Whether orgstar commits in each sidebar folder that is a git repository, by root path, in the | |
| 6 | /// user defaults under `gitAutoCommit`. Off for a folder that isn't listed. | |
| 7 | @MainActor | |
| 8 | @Observable | |
| 9 | public final class GitFolderSettings { | |
| 10 | public enum Mode: String, CaseIterable, Sendable { | |
| 11 | case off | |
| 12 | /// Commit the files orgstar wrote. | |
| 13 | case commit | |
| 14 | /// Pull with `--ff-only`, commit, then push. | |
| 15 | case sync | |
| 16 | } | |
| 17 | ||
| 18 | public static let shared = GitFolderSettings() | |
| 19 | static let key = "gitAutoCommit" | |
| 20 | @ObservationIgnored private let defaults: UserDefaults | |
| 21 | public private(set) var modes: [String: Mode] | |
| 22 | ||
| 23 | public init(defaults: UserDefaults = .standard) { | |
| 24 | self.defaults = defaults | |
| 25 | let saved = defaults.dictionary(forKey: Self.key) as? [String: String] ?? [:] | |
| 26 | modes = saved.compactMapValues(Mode.init(rawValue:)).filter { $0.value != .off } | |
| 27 | } | |
| 28 | ||
| 29 | public func mode(for root: String) -> Mode { modes[root] ?? .off } | |
| 30 | ||
| 31 | public func set(_ mode: Mode, for root: String) { | |
| 32 | modes[root] = mode == .off ? nil : mode | |
| 33 | defaults.set(modes.mapValues(\.rawValue), forKey: Self.key) | |
| 34 | } | |
| 35 | } | |
| 36 | ||
| 37 | /// Commits the files orgstar writes in folders where `GitFolderSettings` turns it on: a minute | |
| 38 | /// after the last write in the folder, and on quit. Only those files are committed, so other | |
| 39 | /// work in progress in the repository stays as it is. With pulling on, it pulls with | |
| 40 | /// `--ff-only` first and pushes after a commit, and only when the pull succeeded. | |
| 41 | @MainActor | |
| 42 | public final class GitAutoCommit { | |
| 43 | public static let shared = GitAutoCommit() | |
| 44 | ||
| 45 | public let settings: GitFolderSettings | |
| 46 | /// How long after the last write in a folder its files are committed. | |
| 47 | public var delay: Duration = .seconds(60) | |
| 48 | /// The sidebar's folders. | |
| 49 | public var roots: () -> [String] = { [] } | |
| 50 | /// Shows a message in the echo area. | |
| 51 | public var report: (String) -> Void = { _ in } | |
| 52 | /// The git to run; looked up once. | |
| 53 | public lazy var git: Git? = Git.find() | |
| 54 | ||
| 55 | /// Files written since their folder's last commit, by root. | |
| 56 | private var pending: [String: Set<String>] = [:] | |
| 57 | private var timers: [String: Task<Void, Never>] = [:] | |
| 58 | private var running: [String: Task<Void, Never>] = [:] | |
| 59 | ||
| 60 | public init(settings: GitFolderSettings = .shared) { | |
| 61 | self.settings = settings | |
| 62 | } | |
| 63 | ||
| 64 | /// Whether files are waiting to be committed. | |
| 65 | public var hasPending: Bool { pending.values.contains { !$0.isEmpty } } | |
| 66 | ||
| 67 | /// The root of the sidebar folder holding `path`, the innermost when folders nest; compared | |
| 68 | /// as written and with symbolic links resolved (`/tmp` and `/private/tmp`). | |
| 69 | func root(containing path: String) -> String? { | |
| 70 | func resolved(_ path: String) -> String { URL(fileURLWithPath: path).resolvingSymlinksInPath().path } | |
| 71 | func inside(_ path: String, _ root: String) -> Bool { path.hasPrefix(root.hasSuffix("/") ? root : root + "/") } | |
| 72 | let real = resolved(path) | |
| 73 | return roots().filter { inside(path, $0) || inside(real, resolved($0)) }.max { $0.count < $1.count } | |
| 74 | } | |
| 75 | ||
| 76 | /// Notes that orgstar wrote `path`; its folder commits after `delay` with no further writes. | |
| 77 | public func fileWritten(_ path: String) { | |
| 78 | guard let root = root(containing: path), settings.mode(for: root) != .off else { return } | |
| 79 | pending[root, default: []].insert(path) | |
| 80 | timers[root]?.cancel() | |
| 81 | timers[root] = Task { [weak self, delay] in | |
| 82 | try? await Task.sleep(for: delay) | |
| 83 | guard !Task.isCancelled, let self else { return } | |
| 84 | self.timers[root] = nil | |
| 85 | await self.commit(root) | |
| 86 | } | |
| 87 | } | |
| 88 | ||
| 89 | /// Commits every folder's waiting files now, as on quit. | |
| 90 | public func flush(networkTimeout: Duration = .seconds(15)) async { | |
| 91 | for timer in timers.values { timer.cancel() } | |
| 92 | timers = [:] | |
| 93 | for root in pending.keys.sorted() { await commit(root, networkTimeout: networkTimeout) } | |
| 94 | for task in running.values { await task.value } | |
| 95 | } | |
| 96 | ||
| 97 | /// Commits `root`'s waiting files, after a commit already running there. | |
| 98 | func commit(_ root: String, networkTimeout: Duration = .seconds(60)) async { | |
| 99 | while let task = running[root] { await task.value } | |
| 100 | guard let files = pending.removeValue(forKey: root), !files.isEmpty else { return } | |
| 101 | let mode = settings.mode(for: root) | |
| 102 | guard mode != .off else { return } | |
| 103 | guard let git else { return report(String(localized: "Can't commit automatically: git isn't installed.", table: "DeveloperID")) } | |
| 104 | let task = Task { [weak self] in | |
| 105 | let outcome = await Self.run(files: files.sorted(), pullAndPush: mode == .sync, git: git, networkTimeout: networkTimeout) | |
| 106 | guard let self else { return } | |
| 107 | for path in outcome.retry { self.pending[root, default: []].insert(path) } | |
| 108 | for message in outcome.messages { self.report(message) } | |
| 109 | self.running[root] = nil | |
| 110 | } | |
| 111 | running[root] = task | |
| 112 | await task.value | |
| 113 | } | |
| 114 | ||
| 115 | public struct Outcome: Sendable, Equatable { | |
| 116 | /// Paths committed, relative to their work tree. | |
| 117 | public var committed: [String] = [] | |
| 118 | public var pushed = false | |
| 119 | /// What to show, one message per repository. | |
| 120 | public var messages: [String] = [] | |
| 121 | /// Files to try again with the next commit. | |
| 122 | public var retry: [String] = [] | |
| 123 | } | |
| 124 | ||
| 125 | /// Pulls (with `pullAndPush`), commits the changes to `files` and nothing else, then pushes | |
| 126 | /// (with `pullAndPush`, after a pull that succeeded and a commit), in each repository the | |
| 127 | /// files are in. Leaves a repository alone while git is in the middle of an operation there. | |
| 128 | public nonisolated static func run( | |
| 129 | files: [String], pullAndPush: Bool, git: Git, localTimeout: Duration = .seconds(30), networkTimeout: Duration = .seconds(60) | |
| 130 | ) async -> Outcome { | |
| 131 | var outcome = Outcome() | |
| 132 | var repositories: [(top: URL, gitDir: URL, files: [String])] = [] | |
| 133 | for file in files { | |
| 134 | guard let repository = await git.repository(containing: URL(fileURLWithPath: file).deletingLastPathComponent()) else { continue } | |
| 135 | if let index = repositories.firstIndex(where: { $0.top == repository.top }) { | |
| 136 | repositories[index].files.append(file) | |
| 137 | } else { | |
| 138 | repositories.append((repository.top, repository.gitDir, [file])) | |
| 139 | } | |
| 140 | } | |
| 141 | for repository in repositories { | |
| 142 | let name = repository.top.lastPathComponent | |
| 143 | if let operation = Git.operationInProgress(repository.gitDir) { | |
| 144 | outcome.retry += repository.files | |
| 145 | outcome.messages.append(operation == "index.lock" | |
| 146 | ? String(localized: "Didn't commit in \(name): another git command is running there. orgstar tries again after the next save.", table: "DeveloperID") | |
| 147 | : String(localized: "Didn't commit in \(name): a git \(operation) is in progress. Finish or abort it; orgstar commits after the next save.", table: "DeveloperID")) | |
| 148 | continue | |
| 149 | } | |
| 150 | var problems: [String] = [] | |
| 151 | var pulled = true | |
| 152 | if pullAndPush { | |
| 153 | do { | |
| 154 | let pull = try await git.run(["pull", "--no-rebase", "--ff-only"], in: repository.top, timeout: networkTimeout) | |
| 155 | if !pull.succeeded { | |
| 156 | pulled = false | |
| 157 | problems.append(describe(pull, verb: String(localized: "Couldn't pull in \(name)", table: "DeveloperID")) | |
| 158 | + " " + String(localized: "Nothing was merged; pull and resolve it in a terminal. Not pushed.", table: "DeveloperID")) | |
| 159 | } | |
| 160 | } catch { | |
| 161 | pulled = false | |
| 162 | problems.append(String(localized: "Couldn't pull in \(name): \(String(describing: error)). Not pushed.", table: "DeveloperID")) | |
| 163 | } | |
| 164 | } | |
| 165 | var committed: [String] = [] | |
| 166 | do { | |
| 167 | let paths = repository.files.compactMap { Git.relativePath(URL(fileURLWithPath: $0), in: repository.top) } | |
| 168 | let status = try await git.run(["status", "--porcelain=v1", "-z", "--untracked-files=all", "--no-renames", "--"] + paths, in: repository.top, timeout: localTimeout) | |
| 169 | guard status.succeeded else { throw Git.Failure(description: status.problem) } | |
| 170 | // `XY path` entries; porcelain paths are relative to the work tree. | |
| 171 | let changed = status.stdout.split(separator: "\0").filter { $0.count > 3 }.map { String($0.dropFirst(3)) } | |
| 172 | if !changed.isEmpty { | |
| 173 | let add = try await git.run(["add", "--"] + changed, in: repository.top, timeout: localTimeout) | |
| 174 | guard add.succeeded else { throw Git.Failure(description: add.problem) } | |
| 175 | let commit = try await git.run(["commit", "--only", "-m", message(changed), "--"] + changed, in: repository.top, timeout: localTimeout) | |
| 176 | guard commit.succeeded else { throw Git.Failure(description: commit.problem) } | |
| 177 | committed = changed | |
| 178 | } | |
| 179 | } catch { | |
| 180 | outcome.retry += repository.files | |
| 181 | problems.append(String(localized: "Couldn't commit in \(name): \(String(describing: error))", table: "DeveloperID")) | |
| 182 | } | |
| 183 | var pushed = false | |
| 184 | if pullAndPush, pulled, !committed.isEmpty { | |
| 185 | do { | |
| 186 | let push = try await git.run(["push"], in: repository.top, timeout: networkTimeout) | |
| 187 | if push.succeeded { pushed = true } else { problems.append(describe(push, verb: String(localized: "Couldn't push \(name)", table: "DeveloperID"))) } | |
| 188 | } catch { | |
| 189 | problems.append(String(localized: "Couldn't push \(name): \(String(describing: error))", table: "DeveloperID")) | |
| 190 | } | |
| 191 | } | |
| 192 | outcome.committed += committed | |
| 193 | outcome.pushed = outcome.pushed || pushed | |
| 194 | let names = committed.map { ($0 as NSString).lastPathComponent }.joined(separator: ", ") | |
| 195 | var parts: [String] = [] | |
| 196 | if !committed.isEmpty { | |
| 197 | parts.append(pushed | |
| 198 | ? String(localized: "Committed and pushed \(names) in \(name).", table: "DeveloperID") | |
| 199 | : String(localized: "Committed \(names) in \(name).", table: "DeveloperID")) | |
| 200 | } | |
| 201 | parts += problems | |
| 202 | if !parts.isEmpty { outcome.messages.append(parts.joined(separator: " ")) } | |
| 203 | } | |
| 204 | return outcome | |
| 205 | } | |
| 206 | ||
| 207 | /// git's complaint after `verb`, saying so when it is about signing in. | |
| 208 | nonisolated static func describe(_ output: Git.Output, verb: String) -> String { | |
| 209 | guard Git.isAuthenticationFailure(output.stderr) else { return "\(verb): \(output.problem)." } | |
| 210 | return String(localized: "\(verb): git couldn't sign in to the remote (\(output.problem)). orgstar can't answer prompts; use an SSH key in the agent or a credential helper.", table: "DeveloperID") | |
| 211 | } | |
| 212 | ||
| 213 | /// `Update a.org, b.org`, or `Update N files` with the paths in the body. | |
| 214 | nonisolated static func message(_ paths: [String]) -> String { | |
| 215 | let names = paths.map { ($0 as NSString).lastPathComponent } | |
| 216 | if paths.count <= 3 { return "Update " + names.joined(separator: ", ") } | |
| 217 | return "Update \(paths.count) files\n\n" + paths.joined(separator: "\n") | |
| 218 | } | |
| 219 | } | |
| 220 | #endif | |
Sources/Orgstar/GitSettings.swift added +54 · view
| @@ -0,0 +1,54 @@ | ||
| 1 | #if !APPSTORE | |
| 2 | import OrgApp | |
| 3 | import OrgPrograms | |
| 4 | import SwiftUI | |
| 5 | ||
| 6 | /// Settings ▸ Git: automatic commits for each sidebar folder that is a git repository. | |
| 7 | struct GitSettingsForm: View { | |
| 8 | let workspace: WorkspaceModel? | |
| 9 | @State private var settings = GitFolderSettings.shared | |
| 10 | @State private var gitInstalled = true | |
| 11 | ||
| 12 | var body: some View { | |
| 13 | Form { | |
| 14 | Section { | |
| 15 | let roots = workspace?.rootPaths ?? [] | |
| 16 | if roots.isEmpty { | |
| 17 | Text("Add a folder to the sidebar to commit its changes automatically.", tableName: "DeveloperID").foregroundStyle(.secondary) | |
| 18 | } | |
| 19 | ForEach(roots, id: \.self) { root in | |
| 20 | let name = (root as NSString).lastPathComponent | |
| 21 | if GitBranch.current(for: (root as NSString).appendingPathComponent("x")) == nil { | |
| 22 | LabeledContent { | |
| 23 | Text("Not a git repository", tableName: "DeveloperID").foregroundStyle(.secondary) | |
| 24 | } label: { | |
| 25 | Text(verbatim: name).help(root) | |
| 26 | } | |
| 27 | } else { | |
| 28 | Picker(selection: Binding(get: { settings.mode(for: root) }, set: { settings.set($0, for: root) })) { | |
| 29 | Text("Off", tableName: "DeveloperID").tag(GitFolderSettings.Mode.off) | |
| 30 | Text("Commit", tableName: "DeveloperID").tag(GitFolderSettings.Mode.commit) | |
| 31 | Text("Commit, Pull and Push", tableName: "DeveloperID").tag(GitFolderSettings.Mode.sync) | |
| 32 | } label: { | |
| 33 | Text(verbatim: name).help(root) | |
| 34 | } | |
| 35 | .disabled(!gitInstalled) | |
| 36 | } | |
| 37 | } | |
| 38 | } header: { | |
| 39 | Text("Commit changes automatically", tableName: "DeveloperID") | |
| 40 | } footer: { | |
| 41 | VStack(alignment: .leading, spacing: 4) { | |
| 42 | if !gitInstalled { | |
| 43 | Text("git isn't installed. Install the Xcode command line tools or git from Homebrew.", tableName: "DeveloperID").settingsFooter() | |
| 44 | } | |
| 45 | Text("A minute after the last save in a folder, and when orgstar quits, orgstar commits the files it saved there, and only those. Commit, Pull and Push pulls with --ff-only first and pushes after the commit. orgstar never merges or resolves a conflict, and doesn't commit while a merge, rebase or cherry-pick is in progress.", tableName: "DeveloperID").settingsFooter() | |
| 46 | } | |
| 47 | } | |
| 48 | } | |
| 49 | .formStyle(.grouped) | |
| 50 | .frame(height: 330) | |
| 51 | .task { gitInstalled = Git.find() != nil } | |
| 52 | } | |
| 53 | } | |
| 54 | #endif | |
Sources/Orgstar/OrgstarApp.swift +21 −1 · view
| @@ -279,7 +279,18 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent | ||
| 279 | 279 | #else |
| 280 | 280 | BufferRestore.save(session) |
| 281 | 281 | #endif |
| 282 | return UnsavedChanges.resolve(session, paths: session.openPaths) ? .terminateNow : .terminateCancel | |
| 282 | guard UnsavedChanges.resolve(session, paths: session.openPaths) else { return .terminateCancel } | |
| 283 | #if !APPSTORE | |
| 284 | // Files saved since their folder's last automatic commit are committed before quitting. | |
| 285 | if GitAutoCommit.shared.hasPending { | |
| 286 | Task { | |
| 287 | await GitAutoCommit.shared.flush() | |
| 288 | sender.reply(toApplicationShouldTerminate: true) | |
| 289 | } | |
| 290 | return .terminateLater | |
| 291 | } | |
| 292 | #endif | |
| 293 | return .terminateNow | |
| 283 | 294 | } |
| 284 | 295 | } |
| 285 | 296 | |
| @@ -429,6 +440,10 @@ struct OrgstarApp: App { | ||
| 429 | 440 | delegate.commands = commands |
| 430 | 441 | #if APPSTORE |
| 431 | 442 | delegate.workspace = model |
| 443 | #else | |
| 444 | GitAutoCommit.shared.roots = { model.rootPaths } | |
| 445 | GitAutoCommit.shared.report = { commands.show($0) } | |
| 446 | session.fileWritten = { GitAutoCommit.shared.fileWritten($0) } | |
| 432 | 447 | #endif |
| 433 | 448 | CaptureIntent.environment = (model, session, clock, commands) |
| 434 | 449 | } |
| @@ -863,6 +878,11 @@ struct SettingsView: View { | ||
| 863 | 878 | Tab("Appearance", systemImage: "paintpalette", value: "appearance") { appearance } |
| 864 | 879 | Tab("Agenda", systemImage: "calendar", value: "agenda") { agenda } |
| 865 | 880 | Tab("Capture", systemImage: "tray.and.arrow.down", value: "capture") { capture } |
| 881 | #if !APPSTORE | |
| 882 | Tab(value: "git") { GitSettingsForm(workspace: workspace) } label: { | |
| 883 | Label { Text("Git", tableName: "DeveloperID") } icon: { Image(systemName: "arrow.triangle.branch") } | |
| 884 | } | |
| 885 | #endif | |
| 866 | 886 | #if APPSTORE |
| 867 | 887 | Tab("orgstar+", systemImage: "star", value: "pro") { StoreForm() } |
| 868 | 888 | #else |
Tests/OrgProgramsTests/GitAutoCommitTests.swift added +250 · view
| @@ -0,0 +1,250 @@ | ||
| 1 | import Foundation | |
| 2 | import OrgCore | |
| 3 | import OrgDocument | |
| 4 | import Testing | |
| 5 | @testable import OrgApp | |
| 6 | @testable import OrgPrograms | |
| 7 | ||
| 8 | let git = Git.find() | |
| 9 | ||
| 10 | /// A repository in a temporary folder, with its own identity and no signing, hooks or | |
| 11 | /// credential helper from the user's configuration. | |
| 12 | struct Repository { | |
| 13 | let folder: Folder | |
| 14 | var url: URL { folder.url } | |
| 15 | ||
| 16 | init(_ folder: Folder = try! Folder(), clone remote: URL? = nil) async throws { | |
| 17 | self.folder = folder | |
| 18 | if let remote { | |
| 19 | try await run("clone", "-q", remote.path, ".") | |
| 20 | } else { | |
| 21 | try await run("init", "-q", "-b", "main") | |
| 22 | } | |
| 23 | for (key, value) in [("user.name", "Test"), ("user.email", "test@example.com"), ("commit.gpgsign", "false"), ("core.hooksPath", "/dev/null"), ("credential.helper", "")] { | |
| 24 | try await run("config", key, value) | |
| 25 | } | |
| 26 | } | |
| 27 | ||
| 28 | @discardableResult | |
| 29 | func run(_ arguments: String...) async throws -> String { | |
| 30 | let output = try await git!.run(arguments, in: url) | |
| 31 | guard output.succeeded else { throw Git.Failure(description: "git \(arguments.joined(separator: " ")): \(output.problem)") } | |
| 32 | return output.stdout | |
| 33 | } | |
| 34 | ||
| 35 | func commitAll(_ message: String) async throws { | |
| 36 | try await run("add", "-A") | |
| 37 | try await run("commit", "-q", "-m", message) | |
| 38 | } | |
| 39 | ||
| 40 | func head() async throws -> String { try await run("rev-parse", "HEAD").trimmingCharacters(in: .whitespacesAndNewlines) } | |
| 41 | func path(_ name: String) -> String { url.appendingPathComponent(name).path } | |
| 42 | } | |
| 43 | ||
| 44 | /// A bare repository and two clones of it, the first with `a.org` and `b.org` pushed. | |
| 45 | private func remoteAndClones() async throws -> (remote: Folder, mine: Repository, theirs: Repository) { | |
| 46 | let remote = try Folder() | |
| 47 | _ = try await git!.run(["init", "-q", "--bare", "-b", "main"], in: remote.url) | |
| 48 | let mine = try await Repository(clone: remote.url) | |
| 49 | try mine.folder.write("a.org", "* A\n") | |
| 50 | try mine.folder.write("b.org", "* B\n") | |
| 51 | try await mine.commitAll("Start") | |
| 52 | try await mine.run("push", "-q", "-u", "origin", "main") | |
| 53 | let theirs = try await Repository(clone: remote.url) | |
| 54 | return (remote, mine, theirs) | |
| 55 | } | |
| 56 | ||
| 57 | @Suite(.enabled(if: git != nil, "git isn't installed")) | |
| 58 | struct GitAutoCommitTests { | |
| 59 | @Test func commitsOnlyTheFilesOrgstarWrote() async throws { | |
| 60 | let repo = try await Repository() | |
| 61 | try repo.folder.write("a.org", "* A\n") | |
| 62 | try repo.folder.write("b.org", "* B\n") | |
| 63 | try await repo.commitAll("Start") | |
| 64 | try repo.folder.write("a.org", "* A\nsaved by orgstar\n") | |
| 65 | try repo.folder.write("b.org", "* B\nsomeone's work in progress\n") | |
| 66 | try repo.folder.write("c.txt", "staged by hand\n") | |
| 67 | try await repo.run("add", "c.txt") | |
| 68 | try repo.folder.write("sub/new.org", "* New\n") | |
| 69 | ||
| 70 | let outcome = await GitAutoCommit.run(files: [repo.path("a.org"), repo.path("sub/new.org")], pullAndPush: false, git: git!) | |
| 71 | #expect(outcome.committed.sorted() == ["a.org", "sub/new.org"]) | |
| 72 | #expect(outcome.messages == ["Committed a.org, new.org in \(repo.url.resolvingSymlinksInPath().lastPathComponent)."]) | |
| 73 | #expect(try await repo.run("show", "--name-only", "--format=%s", "HEAD") == "Update a.org, new.org\n\na.org\nsub/new.org\n") | |
| 74 | // The other changes are where they were: b.org modified, c.txt staged. | |
| 75 | #expect(try await repo.run("status", "--porcelain") == " M b.org\nA c.txt\n") | |
| 76 | } | |
| 77 | ||
| 78 | @Test func nothingChangedIsNotCommitted() async throws { | |
| 79 | let repo = try await Repository() | |
| 80 | try repo.folder.write("a.org", "* A\n") | |
| 81 | try await repo.commitAll("Start") | |
| 82 | let head = try await repo.head() | |
| 83 | let outcome = await GitAutoCommit.run(files: [repo.path("a.org")], pullAndPush: false, git: git!) | |
| 84 | #expect(outcome == GitAutoCommit.Outcome()) | |
| 85 | #expect(try await repo.head() == head) | |
| 86 | } | |
| 87 | ||
| 88 | @Test func noCommitWhileARebaseIsInProgress() async throws { | |
| 89 | let repo = try await Repository() | |
| 90 | try repo.folder.write("a.org", "* A\n") | |
| 91 | try await repo.commitAll("Start") | |
| 92 | let head = try await repo.head() | |
| 93 | try FileManager.default.createDirectory(at: repo.url.appendingPathComponent(".git/rebase-merge"), withIntermediateDirectories: true) | |
| 94 | try repo.folder.write("a.org", "* A\nchanged\n") | |
| 95 | ||
| 96 | let outcome = await GitAutoCommit.run(files: [repo.path("a.org")], pullAndPush: true, git: git!) | |
| 97 | #expect(outcome.committed.isEmpty) | |
| 98 | #expect(outcome.retry == [repo.path("a.org")]) | |
| 99 | #expect(outcome.messages.count == 1 && outcome.messages[0].contains("a git rebase is in progress")) | |
| 100 | #expect(try await repo.head() == head) | |
| 101 | #expect(Git.operationInProgress(repo.url.appendingPathComponent(".git")) == "rebase") | |
| 102 | } | |
| 103 | ||
| 104 | @Test func pullsCommitsAndPushes() async throws { | |
| 105 | let (remote, mine, theirs) = try await remoteAndClones() | |
| 106 | try theirs.folder.write("b.org", "* B\nfrom the other Mac\n") | |
| 107 | try await theirs.commitAll("Theirs") | |
| 108 | try await theirs.run("push", "-q") | |
| 109 | try mine.folder.write("a.org", "* A\nmine\n") | |
| 110 | ||
| 111 | let outcome = await GitAutoCommit.run(files: [mine.path("a.org")], pullAndPush: true, git: git!) | |
| 112 | #expect(outcome.committed == ["a.org"] && outcome.pushed) | |
| 113 | #expect(outcome.messages.first?.hasPrefix("Committed and pushed a.org") == true) | |
| 114 | // A fast-forward pull, then our commit on top: no merge commit. | |
| 115 | #expect(try await mine.run("log", "--format=%s", "-3") == "Update a.org\nTheirs\nStart\n") | |
| 116 | let remoteHead = try await git!.run(["rev-parse", "main"], in: remote.url).stdout | |
| 117 | #expect(remoteHead == (try await mine.run("rev-parse", "HEAD"))) | |
| 118 | } | |
| 119 | ||
| 120 | @Test func refusedFastForwardIsReportedAndNothingIsPushed() async throws { | |
| 121 | let (remote, mine, theirs) = try await remoteAndClones() | |
| 122 | try theirs.folder.write("b.org", "* B\ntheirs\n") | |
| 123 | try await theirs.commitAll("Theirs") | |
| 124 | try await theirs.run("push", "-q") | |
| 125 | let remoteHead = try await git!.run(["rev-parse", "main"], in: remote.url).stdout | |
| 126 | // A commit of mine the remote doesn't have: the histories have diverged. | |
| 127 | try mine.folder.write("b.org", "* B\nmine, by hand\n") | |
| 128 | try await mine.commitAll("Mine") | |
| 129 | try mine.folder.write("a.org", "* A\nsaved\n") | |
| 130 | ||
| 131 | let outcome = await GitAutoCommit.run(files: [mine.path("a.org")], pullAndPush: true, git: git!) | |
| 132 | #expect(!outcome.pushed) | |
| 133 | // Committed here; the pull left the repository as it was, with no merge. | |
| 134 | #expect(outcome.committed == ["a.org"]) | |
| 135 | let message = try #require(outcome.messages.first) | |
| 136 | #expect(message.contains("Couldn't pull in") && message.contains("Not possible to fast-forward") && message.contains("Not pushed")) | |
| 137 | #expect(try await mine.run("log", "--format=%s", "-3") == "Update a.org\nMine\nStart\n") | |
| 138 | #expect(Git.operationInProgress(mine.url.appendingPathComponent(".git")) == nil) | |
| 139 | #expect(try await git!.run(["rev-parse", "main"], in: remote.url).stdout == remoteHead) | |
| 140 | } | |
| 141 | ||
| 142 | @Test(.enabled(if: FileManager.default.isExecutableFile(atPath: "/usr/bin/python3"))) | |
| 143 | func credentialsAreNeverPromptedFor() async throws { | |
| 144 | // A server that wants a password for everything. | |
| 145 | let server = Process() | |
| 146 | server.executableURL = URL(fileURLWithPath: "/usr/bin/python3") | |
| 147 | server.arguments = ["-c", """ | |
| 148 | import http.server | |
| 149 | class H(http.server.BaseHTTPRequestHandler): | |
| 150 | def do_GET(self): | |
| 151 | self.send_response(401) | |
| 152 | self.send_header('WWW-Authenticate', 'Basic realm="x"') | |
| 153 | self.send_header('Content-Length', '0') | |
| 154 | self.end_headers() | |
| 155 | def log_message(self, *a): pass | |
| 156 | s = http.server.HTTPServer(('127.0.0.1', 0), H) | |
| 157 | print(s.server_port, flush=True) | |
| 158 | s.serve_forever() | |
| 159 | """] | |
| 160 | let out = Pipe() | |
| 161 | server.standardOutput = out | |
| 162 | try server.run() | |
| 163 | defer { server.terminate() } | |
| 164 | let port = try #require(String(decoding: out.fileHandleForReading.availableData, as: UTF8.self).split(separator: "\n").first) | |
| 165 | let repo = try await Repository() | |
| 166 | try repo.folder.write("a.org", "* A\n") | |
| 167 | try await repo.commitAll("Start") | |
| 168 | try await repo.run("remote", "add", "origin", "http://127.0.0.1:\(port)/notes.git") | |
| 169 | try await repo.run("config", "branch.main.remote", "origin") | |
| 170 | try await repo.run("config", "branch.main.merge", "refs/heads/main") | |
| 171 | try repo.folder.write("a.org", "* A\nchanged\n") | |
| 172 | ||
| 173 | let start = ContinuousClock.now | |
| 174 | let outcome = await GitAutoCommit.run(files: [repo.path("a.org")], pullAndPush: true, git: git!, networkTimeout: .seconds(20)) | |
| 175 | #expect(ContinuousClock.now - start < .seconds(15)) | |
| 176 | #expect(!outcome.pushed) | |
| 177 | let message = try #require(outcome.messages.first) | |
| 178 | #expect(message.contains("couldn't sign in"), "\(message)") | |
| 179 | } | |
| 180 | ||
| 181 | @MainActor | |
| 182 | @Test func commitsAMinuteAfterTheLastWriteAndOnQuit() async throws { | |
| 183 | let repo = try await Repository() | |
| 184 | try repo.folder.write("a.org", "* A\n") | |
| 185 | try repo.folder.write("b.org", "* B\n") | |
| 186 | try await repo.commitAll("Start") | |
| 187 | let start = try await repo.head() | |
| 188 | let defaults = try #require(UserDefaults(suiteName: "orgstar-git-\(UUID().uuidString)")) | |
| 189 | let settings = GitFolderSettings(defaults: defaults) | |
| 190 | settings.set(.commit, for: repo.url.path) | |
| 191 | let elsewhere = try Folder() | |
| 192 | settings.set(.commit, for: elsewhere.url.path) | |
| 193 | let autoCommit = GitAutoCommit(settings: settings) | |
| 194 | autoCommit.git = git | |
| 195 | autoCommit.delay = .milliseconds(600) | |
| 196 | autoCommit.roots = { [repo.url.path] } | |
| 197 | var reports: [String] = [] | |
| 198 | autoCommit.report = { reports.append($0) } | |
| 199 | ||
| 200 | try repo.folder.write("a.org", "* A\none\n") | |
| 201 | autoCommit.fileWritten(repo.path("a.org")) | |
| 202 | // Outside every sidebar folder: not tracked. | |
| 203 | try elsewhere.write("x.org", "x\n") | |
| 204 | autoCommit.fileWritten(elsewhere.url.appendingPathComponent("x.org").path) | |
| 205 | try await Task.sleep(for: .milliseconds(300)) | |
| 206 | try repo.folder.write("a.org", "* A\none\ntwo\n") | |
| 207 | autoCommit.fileWritten(repo.path("a.org")) | |
| 208 | try await Task.sleep(for: .milliseconds(300)) | |
| 209 | // The second write pushed the commit back. | |
| 210 | #expect(try await repo.head() == start) | |
| 211 | var tries = 0 | |
| 212 | while try await repo.head() == start, tries < 100 { | |
| 213 | try await Task.sleep(for: .milliseconds(100)) | |
| 214 | tries += 1 | |
| 215 | } | |
| 216 | #expect(try await repo.run("log", "--format=%s", "-2") == "Update a.org\nStart\n") | |
| 217 | #expect(reports.count == 1 && reports[0].hasPrefix("Committed a.org")) | |
| 218 | #expect(!autoCommit.hasPending) | |
| 219 | ||
| 220 | // Quitting commits what is waiting without the delay. | |
| 221 | autoCommit.delay = .seconds(600) | |
| 222 | try repo.folder.write("b.org", "* B\nbefore quitting\n") | |
| 223 | autoCommit.fileWritten(repo.path("b.org")) | |
| 224 | #expect(autoCommit.hasPending) | |
| 225 | await autoCommit.flush() | |
| 226 | #expect(try await repo.run("log", "--format=%s", "-1") == "Update b.org\n") | |
| 227 | ||
| 228 | // Off: nothing is tracked. | |
| 229 | settings.set(.off, for: repo.url.path) | |
| 230 | autoCommit.fileWritten(repo.path("b.org")) | |
| 231 | #expect(!autoCommit.hasPending) | |
| 232 | } | |
| 233 | ||
| 234 | @MainActor | |
| 235 | @Test func sessionReportsEachWrite() throws { | |
| 236 | let notes = try Folder() | |
| 237 | let file = try notes.write("a.org", "* A\n") | |
| 238 | let session = DocumentSession(recovery: FileRecoveryStore(directory: notes.url.appendingPathComponent(".r"))) | |
| 239 | var written: [String] = [] | |
| 240 | session.fileWritten = { written.append($0) } | |
| 241 | session.open(file.path) | |
| 242 | #expect(session.save()) | |
| 243 | #expect(written.isEmpty) | |
| 244 | let text = session.document!.text | |
| 245 | _ = session.perform(PrecomputedEdit(EditResult(baseRevision: session.document!.revision, edits: lineEdits(from: text, to: text + "more\n"))), | |
| 246 | path: file.path, at: 0, expect: nil) | |
| 247 | #expect(session.save()) | |
| 248 | #expect(written == [file.path]) | |
| 249 | } | |
| 250 | } | |
docs/manual/guide/01-files-and-folders.org +25 −1 · view
| @@ -301,6 +301,30 @@ Choose File ▸ Recovery Versions… to see the open file's versions, newest fir | ||
| 301 | 301 | |
| 302 | 302 | Select a version to see how it differs from the buffer (=-= in the buffer, =+= in the kept version). =Restore= puts the kept version's text in the buffer as one edit, which undo reverses; the buffer as it was goes to recovery first. =Show in Finder= reveals the kept file. For a file with no kept versions the sheet says so. |
| 303 | 303 | |
| 304 | ** Committing to git | |
| 305 | ||
| 306 | The download version can commit your changes in a folder that is a git repository. It is off for every folder. In Settings ▸ Git, choose for each folder in the sidebar: | |
| 307 | ||
| 308 | | Choice | What happens | | |
| 309 | |-----------------------+--------------------------------------------------------------------------------------------------| | |
| 310 | | Off | Nothing. The default. | | |
| 311 | | Commit | A minute after the last save in the folder, and when orgstar quits, orgstar commits the files it saved. | | |
| 312 | | Commit, Pull and Push | Before committing, =git pull --ff-only=; after the commit, =git push=. | | |
| 313 | ||
| 314 | Only the files orgstar wrote since the last commit are committed: files saved from a buffer, and files changed by refiling, archiving, capture and agenda commands. Other changes in the repository, staged or not, stay as they are, so your own work in progress is never committed. orgstar remembers these files until they are committed; files written before a crash are not committed. An encrypted =.org.gpg= file is committed as it is on disk, like any other file. A file that is ignored by =.gitignore=, or that is the same as in the last commit, is left out. | |
| 315 | ||
| 316 | The commit uses your git identity and configuration, including signing and hooks. Its message is =Update= followed by the file names, or =Update N files= with the paths in the body when there are more than three. The echo area says what was committed and pushed. | |
| 317 | ||
| 318 | orgstar runs the git it finds in =/opt/homebrew/bin=, =/usr/local/bin=, =/run/current-system/sw/bin= or on the =PATH= (=/usr/bin/git= only with the developer tools installed), or the one =ORGSTAR_GIT= names. It never asks for anything: a remote that needs a password or a host key confirmation fails, and the echo area says git couldn't sign in. Use an SSH key in the agent or a credential helper such as the keychain. Each git command is stopped after 30 seconds, or 60 for pull and push (15 when quitting). | |
| 319 | ||
| 320 | orgstar never merges, rebases or resolves a conflict: | |
| 321 | ||
| 322 | - When the pull can't fast-forward, because the remote and your repository both have commits or the remote changed a file you have changed, orgstar still commits locally, doesn't push, and says so. Pull and resolve it in a terminal (for example =git pull --rebase=). | |
| 323 | - While a merge, rebase, cherry-pick, revert or bisect is in progress, or another git command holds the index, orgstar doesn't run git in that repository. The files wait and are committed after the next save once it is finished. | |
| 324 | - A push runs only after the pull succeeded and something was committed. | |
| 325 | ||
| 326 | The Mac App Store version can't run git and has no Git pane. | |
| 327 | ||
| 304 | 328 | ** iCloud |
| 305 | 329 | |
| 306 | 330 | Files in iCloud Drive that aren't downloaded to the Mac show in the sidebar with a cloud icon and grey text, with the tooltip "Downloading from iCloud". orgstar asks iCloud to download them, and indexes them and lets you open them when they arrive. Files iCloud removes from the Mac to save space keep their index entries until they are back, so search and the agenda still find them. |
| @@ -318,4 +342,4 @@ orgstar does not convert between encodings or line endings. | ||
| 318 | 342 | |
| 319 | 343 | * On iOS |
| 320 | 344 | |
| 321 | The iOS app adds folders from its Folders screen and lists only org files there. Conflicts, Syncthing copies and recovery versions are in the editor's menu. Files are watched through file presenters rather than FSEvents. See [[file:14-ios.org][iOS]]. | |
| 345 | The iOS app adds folders from its Folders screen and lists only org files there. Conflicts, Syncthing copies and recovery versions are in the editor's menu; the iOS app doesn't list git commits or commit to git. Files are watched through file presenters rather than FSEvents. See [[file:14-ios.org][iOS]]. | |
docs/manual/guide/13-configuration.org +11 −1 · view
| @@ -49,7 +49,7 @@ A file that isn't valid TOML is reported with its parse error, and none of it ap | ||
| 49 | 49 | |
| 50 | 50 | * The Settings window |
| 51 | 51 | |
| 52 | Open it with orgstar ▸ Settings (=⌘,=). It has six panes. The last, orgstar+, has the plans and Restore Purchases in the Mac App Store version and the license key in the download version. Each control in the others writes the =config.toml= key named in the tables below; the config.toml reference below gives the type and the Emacs variable. | |
| 52 | Open it with orgstar ▸ Settings (=⌘,=). It has six panes, and a seventh, Git, in the download version. The last, orgstar+, has the plans and Restore Purchases in the Mac App Store version and the license key in the download version. Each control in the others, except Git, writes the =config.toml= key named in the tables below; the config.toml reference below gives the type and the Emacs variable. | |
| 53 | 53 | |
| 54 | 54 | ** General |
| 55 | 55 | |
| @@ -166,6 +166,16 @@ Turning on the idle question sets =org-clock-idle-time= to 15 minutes; turning i | ||
| 166 | 166 | |
| 167 | 167 | The footer shows the path of =capture.toml=. Templates are covered in [[file:08-capture.org][Capture]]. |
| 168 | 168 | |
| 169 | ** Git | |
| 170 | ||
| 171 | Download version only. One row for each folder in the sidebar; a folder that isn't in a git repository says so. | |
| 172 | ||
| 173 | | Control | Choices | Default | | |
| 174 | |-------------+--------------------------------------+---------| | |
| 175 | | Each folder | Off; Commit; Commit, Pull and Push | Off | | |
| 176 | ||
| 177 | The choice is kept on this Mac for the folder's path, not in =config.toml=, since another Mac has other folders. Removing a folder from the sidebar and adding it again keeps it. See [[file:01-files-and-folders.org::*Committing to git][Committing to git]]. | |
| 178 | ||
| 169 | 179 | ** Settings only in config.toml |
| 170 | 180 | |
| 171 | 181 | These settings have no control in the Settings window. Some are in the View menu. |
docs/manual/install.org +1 · view
| @@ -63,6 +63,7 @@ App Store version. | ||
| 63 | 63 | | Settings | In the app's container, or a folder you choose | =~/.config/orgstar= | |
| 64 | 64 | | Files outside your folders | After you grant access to their folder | Directly | |
| 65 | 65 | | Attachments | Copied, or moved from inside your folders | Copied, moved, linked or symlinked | |
| 66 | | Git | No | Commits as you save, with pull and push | | |
| 66 | 67 | | Updates | The Mac App Store | Built in, or Homebrew | |
| 67 | 68 | | orgstar+ | In-app purchase, shared with iPhone and iPad | License key | |
| 68 | 69 | |
l10n/DeveloperID.xcstrings +731 −17 · view
| @@ -1,104 +1,648 @@ | ||
| 1 | 1 | { |
| 2 | 2 | "sourceLanguage": "en", |
| 3 | 3 | "strings": { |
| 4 | "%@: git couldn't sign in to the remote (%@). orgstar can't answer prompts; use an SSH key in the agent or a credential helper.": { | |
| 5 | "localizations": { | |
| 6 | "de": { | |
| 7 | "stringUnit": { | |
| 8 | "state": "translated", | |
| 9 | "value": "%1$@: git konnte sich nicht beim Remote anmelden (%2$@). orgstar kann keine Abfragen beantworten; nutze einen SSH-Schlüssel im Agent oder einen Credential-Helper." | |
| 10 | } | |
| 11 | }, | |
| 12 | "es": { | |
| 13 | "stringUnit": { | |
| 14 | "state": "translated", | |
| 15 | "value": "%1$@: git no pudo iniciar sesión en el remoto (%2$@). orgstar no puede responder solicitudes; usa una clave SSH en el agente o un asistente de credenciales." | |
| 16 | } | |
| 17 | }, | |
| 18 | "fr": { | |
| 19 | "stringUnit": { | |
| 20 | "state": "translated", | |
| 21 | "value": "%1$@ : git n’a pas pu se connecter au dépôt distant (%2$@). orgstar ne peut pas répondre aux invites ; utilisez une clé SSH dans l’agent ou un assistant d’identifiants." | |
| 22 | } | |
| 23 | }, | |
| 24 | "ja": { | |
| 25 | "stringUnit": { | |
| 26 | "state": "translated", | |
| 27 | "value": "%1$@: git がリモートにサインインできませんでした(%2$@)。orgstar は入力を求められても応答できません。エージェントの SSH 鍵か認証情報ヘルパーを使ってください。" | |
| 28 | } | |
| 29 | }, | |
| 30 | "pt-BR": { | |
| 31 | "stringUnit": { | |
| 32 | "state": "translated", | |
| 33 | "value": "%1$@: o git não conseguiu entrar no remoto (%2$@). O orgstar não responde a solicitações; use uma chave SSH no agente ou um auxiliar de credenciais." | |
| 34 | } | |
| 35 | } | |
| 36 | } | |
| 37 | }, | |
| 38 | "A minute after the last save in a folder, and when orgstar quits, orgstar commits the files it saved there, and only those. Commit, Pull and Push pulls with --ff-only first and pushes after the commit. orgstar never merges or resolves a conflict, and doesn't commit while a merge, rebase or cherry-pick is in progress.": { | |
| 39 | "localizations": { | |
| 40 | "de": { | |
| 41 | "stringUnit": { | |
| 42 | "state": "translated", | |
| 43 | "value": "Eine Minute nach dem letzten Sichern in einem Ordner und beim Beenden committet orgstar die Dateien, die es dort gesichert hat, und nur diese. „Committen, Pull und Push“ holt zuerst mit --ff-only und pusht nach dem Commit. orgstar führt nie zusammen, löst keine Konflikte und committet nicht, solange ein Merge, Rebase oder Cherry-Pick läuft." | |
| 44 | } | |
| 45 | }, | |
| 46 | "es": { | |
| 47 | "stringUnit": { | |
| 48 | "state": "translated", | |
| 49 | "value": "Un minuto después del último guardado en una carpeta, y al salir, orgstar confirma los archivos que guardó allí, y solo esos. «Confirmar, pull y push» hace pull con --ff-only primero y push después de confirmar. orgstar nunca fusiona ni resuelve conflictos, y no confirma mientras haya un merge, rebase o cherry-pick en curso." | |
| 50 | } | |
| 51 | }, | |
| 52 | "fr": { | |
| 53 | "stringUnit": { | |
| 54 | "state": "translated", | |
| 55 | "value": "Une minute après le dernier enregistrement dans un dossier, et à la fermeture, orgstar valide les fichiers qu’il y a enregistrés, et seulement ceux-là. « Valider, pull et push » fait d’abord un pull avec --ff-only et un push après la validation. orgstar ne fusionne jamais, ne résout aucun conflit et ne valide pas pendant un merge, un rebase ou un cherry-pick." | |
| 56 | } | |
| 57 | }, | |
| 58 | "ja": { | |
| 59 | "stringUnit": { | |
| 60 | "state": "translated", | |
| 61 | "value": "フォルダで最後に保存してから 1 分後と終了時に、orgstar はそこで保存したファイルだけをコミットします。「コミット、プル、プッシュ」は先に --ff-only でプルし、コミット後にプッシュします。orgstar はマージやコンフリクトの解決を行わず、マージ、リベース、チェリーピックの途中ではコミットしません。" | |
| 62 | } | |
| 63 | }, | |
| 64 | "pt-BR": { | |
| 65 | "stringUnit": { | |
| 66 | "state": "translated", | |
| 67 | "value": "Um minuto após o último salvamento em uma pasta, e ao sair, o orgstar faz commit dos arquivos que salvou ali, e só deles. “Commit, pull e push” faz pull com --ff-only antes e push depois do commit. O orgstar nunca faz merge nem resolve conflitos, e não faz commit durante um merge, rebase ou cherry-pick." | |
| 68 | } | |
| 69 | } | |
| 70 | } | |
| 71 | }, | |
| 4 | 72 | "Activate": { |
| 5 | 73 | "localizations": { |
| 6 | 74 | "de": { |
| 7 | 75 | "stringUnit": { |
| 8 | 76 | "state": "translated", |
| 9 | "value": "Aktivieren" | |
| 77 | "value": "Aktivieren" | |
| 78 | } | |
| 79 | }, | |
| 80 | "es": { | |
| 81 | "stringUnit": { | |
| 82 | "state": "translated", | |
| 83 | "value": "Activar" | |
| 84 | } | |
| 85 | }, | |
| 86 | "fr": { | |
| 87 | "stringUnit": { | |
| 88 | "state": "translated", | |
| 89 | "value": "Activer" | |
| 90 | } | |
| 91 | }, | |
| 92 | "ja": { | |
| 93 | "stringUnit": { | |
| 94 | "state": "translated", | |
| 95 | "value": "アクティベート" | |
| 96 | } | |
| 97 | }, | |
| 98 | "pt-BR": { | |
| 99 | "stringUnit": { | |
| 100 | "state": "translated", | |
| 101 | "value": "Ativar" | |
| 102 | } | |
| 103 | } | |
| 104 | } | |
| 105 | }, | |
| 106 | "Add a folder to the sidebar to commit its changes automatically.": { | |
| 107 | "localizations": { | |
| 108 | "de": { | |
| 109 | "stringUnit": { | |
| 110 | "state": "translated", | |
| 111 | "value": "Füge der Seitenleiste einen Ordner hinzu, um seine Änderungen automatisch zu committen." | |
| 112 | } | |
| 113 | }, | |
| 114 | "es": { | |
| 115 | "stringUnit": { | |
| 116 | "state": "translated", | |
| 117 | "value": "Añade una carpeta a la barra lateral para confirmar sus cambios automáticamente." | |
| 118 | } | |
| 119 | }, | |
| 120 | "fr": { | |
| 121 | "stringUnit": { | |
| 122 | "state": "translated", | |
| 123 | "value": "Ajoutez un dossier à la barre latérale pour valider ses modifications automatiquement." | |
| 124 | } | |
| 125 | }, | |
| 126 | "ja": { | |
| 127 | "stringUnit": { | |
| 128 | "state": "translated", | |
| 129 | "value": "変更を自動的にコミットするには、サイドバーにフォルダを追加してください。" | |
| 130 | } | |
| 131 | }, | |
| 132 | "pt-BR": { | |
| 133 | "stringUnit": { | |
| 134 | "state": "translated", | |
| 135 | "value": "Adicione uma pasta à barra lateral para fazer commit das alterações automaticamente." | |
| 136 | } | |
| 137 | } | |
| 138 | } | |
| 139 | }, | |
| 140 | "Can't commit automatically: git isn't installed.": { | |
| 141 | "localizations": { | |
| 142 | "de": { | |
| 143 | "stringUnit": { | |
| 144 | "state": "translated", | |
| 145 | "value": "Automatisches Committen nicht möglich: git ist nicht installiert." | |
| 146 | } | |
| 147 | }, | |
| 148 | "es": { | |
| 149 | "stringUnit": { | |
| 150 | "state": "translated", | |
| 151 | "value": "No se puede confirmar automáticamente: git no está instalado." | |
| 152 | } | |
| 153 | }, | |
| 154 | "fr": { | |
| 155 | "stringUnit": { | |
| 156 | "state": "translated", | |
| 157 | "value": "Impossible de valider automatiquement : git n’est pas installé." | |
| 158 | } | |
| 159 | }, | |
| 160 | "ja": { | |
| 161 | "stringUnit": { | |
| 162 | "state": "translated", | |
| 163 | "value": "自動コミットできません: git がインストールされていません。" | |
| 164 | } | |
| 165 | }, | |
| 166 | "pt-BR": { | |
| 167 | "stringUnit": { | |
| 168 | "state": "translated", | |
| 169 | "value": "Não é possível fazer commit automaticamente: o git não está instalado." | |
| 170 | } | |
| 171 | } | |
| 172 | } | |
| 173 | }, | |
| 174 | "Check for Updates…": { | |
| 175 | "localizations": { | |
| 176 | "de": { | |
| 177 | "stringUnit": { | |
| 178 | "state": "translated", | |
| 179 | "value": "Nach Updates suchen …" | |
| 180 | } | |
| 181 | }, | |
| 182 | "es": { | |
| 183 | "stringUnit": { | |
| 184 | "state": "translated", | |
| 185 | "value": "Buscar actualizaciones…" | |
| 186 | } | |
| 187 | }, | |
| 188 | "fr": { | |
| 189 | "stringUnit": { | |
| 190 | "state": "translated", | |
| 191 | "value": "Rechercher les mises à jour…" | |
| 192 | } | |
| 193 | }, | |
| 194 | "ja": { | |
| 195 | "stringUnit": { | |
| 196 | "state": "translated", | |
| 197 | "value": "アップデートを確認…" | |
| 198 | } | |
| 199 | }, | |
| 200 | "pt-BR": { | |
| 201 | "stringUnit": { | |
| 202 | "state": "translated", | |
| 203 | "value": "Buscar Atualizações…" | |
| 204 | } | |
| 205 | } | |
| 206 | } | |
| 207 | }, | |
| 208 | "Check for updates automatically": { | |
| 209 | "localizations": { | |
| 210 | "de": { | |
| 211 | "stringUnit": { | |
| 212 | "state": "translated", | |
| 213 | "value": "Automatisch nach Updates suchen" | |
| 214 | } | |
| 215 | }, | |
| 216 | "es": { | |
| 217 | "stringUnit": { | |
| 218 | "state": "translated", | |
| 219 | "value": "Buscar actualizaciones automáticamente" | |
| 220 | } | |
| 221 | }, | |
| 222 | "fr": { | |
| 223 | "stringUnit": { | |
| 224 | "state": "translated", | |
| 225 | "value": "Rechercher automatiquement les mises à jour" | |
| 226 | } | |
| 227 | }, | |
| 228 | "ja": { | |
| 229 | "stringUnit": { | |
| 230 | "state": "translated", | |
| 231 | "value": "アップデートを自動的に確認" | |
| 232 | } | |
| 233 | }, | |
| 234 | "pt-BR": { | |
| 235 | "stringUnit": { | |
| 236 | "state": "translated", | |
| 237 | "value": "Buscar atualizações automaticamente" | |
| 238 | } | |
| 239 | } | |
| 240 | } | |
| 241 | }, | |
| 242 | "Commit": { | |
| 243 | "localizations": { | |
| 244 | "de": { | |
| 245 | "stringUnit": { | |
| 246 | "state": "translated", | |
| 247 | "value": "Committen" | |
| 248 | } | |
| 249 | }, | |
| 250 | "es": { | |
| 251 | "stringUnit": { | |
| 252 | "state": "translated", | |
| 253 | "value": "Confirmar" | |
| 254 | } | |
| 255 | }, | |
| 256 | "fr": { | |
| 257 | "stringUnit": { | |
| 258 | "state": "translated", | |
| 259 | "value": "Valider" | |
| 260 | } | |
| 261 | }, | |
| 262 | "ja": { | |
| 263 | "stringUnit": { | |
| 264 | "state": "translated", | |
| 265 | "value": "コミット" | |
| 266 | } | |
| 267 | }, | |
| 268 | "pt-BR": { | |
| 269 | "stringUnit": { | |
| 270 | "state": "translated", | |
| 271 | "value": "Commit" | |
| 272 | } | |
| 273 | } | |
| 274 | } | |
| 275 | }, | |
| 276 | "Commit changes automatically": { | |
| 277 | "localizations": { | |
| 278 | "de": { | |
| 279 | "stringUnit": { | |
| 280 | "state": "translated", | |
| 281 | "value": "Änderungen automatisch committen" | |
| 282 | } | |
| 283 | }, | |
| 284 | "es": { | |
| 285 | "stringUnit": { | |
| 286 | "state": "translated", | |
| 287 | "value": "Confirmar cambios automáticamente" | |
| 288 | } | |
| 289 | }, | |
| 290 | "fr": { | |
| 291 | "stringUnit": { | |
| 292 | "state": "translated", | |
| 293 | "value": "Valider les modifications automatiquement" | |
| 294 | } | |
| 295 | }, | |
| 296 | "ja": { | |
| 297 | "stringUnit": { | |
| 298 | "state": "translated", | |
| 299 | "value": "変更を自動的にコミット" | |
| 300 | } | |
| 301 | }, | |
| 302 | "pt-BR": { | |
| 303 | "stringUnit": { | |
| 304 | "state": "translated", | |
| 305 | "value": "Fazer commit das alterações automaticamente" | |
| 306 | } | |
| 307 | } | |
| 308 | } | |
| 309 | }, | |
| 310 | "Commit, Pull and Push": { | |
| 311 | "localizations": { | |
| 312 | "de": { | |
| 313 | "stringUnit": { | |
| 314 | "state": "translated", | |
| 315 | "value": "Committen, Pull und Push" | |
| 316 | } | |
| 317 | }, | |
| 318 | "es": { | |
| 319 | "stringUnit": { | |
| 320 | "state": "translated", | |
| 321 | "value": "Confirmar, pull y push" | |
| 322 | } | |
| 323 | }, | |
| 324 | "fr": { | |
| 325 | "stringUnit": { | |
| 326 | "state": "translated", | |
| 327 | "value": "Valider, pull et push" | |
| 328 | } | |
| 329 | }, | |
| 330 | "ja": { | |
| 331 | "stringUnit": { | |
| 332 | "state": "translated", | |
| 333 | "value": "コミット、プル、プッシュ" | |
| 334 | } | |
| 335 | }, | |
| 336 | "pt-BR": { | |
| 337 | "stringUnit": { | |
| 338 | "state": "translated", | |
| 339 | "value": "Commit, pull e push" | |
| 340 | } | |
| 341 | } | |
| 342 | } | |
| 343 | }, | |
| 344 | "Committed %@ in %@.": { | |
| 345 | "localizations": { | |
| 346 | "de": { | |
| 347 | "stringUnit": { | |
| 348 | "state": "translated", | |
| 349 | "value": "%1$@ in %2$@ committet." | |
| 350 | } | |
| 351 | }, | |
| 352 | "es": { | |
| 353 | "stringUnit": { | |
| 354 | "state": "translated", | |
| 355 | "value": "Confirmado %1$@ en %2$@." | |
| 356 | } | |
| 357 | }, | |
| 358 | "fr": { | |
| 359 | "stringUnit": { | |
| 360 | "state": "translated", | |
| 361 | "value": "%1$@ validé dans %2$@." | |
| 362 | } | |
| 363 | }, | |
| 364 | "ja": { | |
| 365 | "stringUnit": { | |
| 366 | "state": "translated", | |
| 367 | "value": "%2$@ で %1$@ をコミットしました。" | |
| 368 | } | |
| 369 | }, | |
| 370 | "pt-BR": { | |
| 371 | "stringUnit": { | |
| 372 | "state": "translated", | |
| 373 | "value": "Commit de %1$@ em %2$@." | |
| 374 | } | |
| 375 | } | |
| 376 | } | |
| 377 | }, | |
| 378 | "Committed and pushed %@ in %@.": { | |
| 379 | "localizations": { | |
| 380 | "de": { | |
| 381 | "stringUnit": { | |
| 382 | "state": "translated", | |
| 383 | "value": "%1$@ in %2$@ committet und gepusht." | |
| 384 | } | |
| 385 | }, | |
| 386 | "es": { | |
| 387 | "stringUnit": { | |
| 388 | "state": "translated", | |
| 389 | "value": "Confirmado y enviado %1$@ en %2$@." | |
| 390 | } | |
| 391 | }, | |
| 392 | "fr": { | |
| 393 | "stringUnit": { | |
| 394 | "state": "translated", | |
| 395 | "value": "%1$@ validé et poussé dans %2$@." | |
| 396 | } | |
| 397 | }, | |
| 398 | "ja": { | |
| 399 | "stringUnit": { | |
| 400 | "state": "translated", | |
| 401 | "value": "%2$@ で %1$@ をコミットしてプッシュしました。" | |
| 402 | } | |
| 403 | }, | |
| 404 | "pt-BR": { | |
| 405 | "stringUnit": { | |
| 406 | "state": "translated", | |
| 407 | "value": "Commit e push de %1$@ em %2$@." | |
| 408 | } | |
| 409 | } | |
| 410 | } | |
| 411 | }, | |
| 412 | "Couldn't commit in %@: %@": { | |
| 413 | "localizations": { | |
| 414 | "de": { | |
| 415 | "stringUnit": { | |
| 416 | "state": "translated", | |
| 417 | "value": "Commit in %1$@ fehlgeschlagen: %2$@" | |
| 418 | } | |
| 419 | }, | |
| 420 | "es": { | |
| 421 | "stringUnit": { | |
| 422 | "state": "translated", | |
| 423 | "value": "No se pudo confirmar en %1$@: %2$@" | |
| 424 | } | |
| 425 | }, | |
| 426 | "fr": { | |
| 427 | "stringUnit": { | |
| 428 | "state": "translated", | |
| 429 | "value": "Validation impossible dans %1$@ : %2$@" | |
| 430 | } | |
| 431 | }, | |
| 432 | "ja": { | |
| 433 | "stringUnit": { | |
| 434 | "state": "translated", | |
| 435 | "value": "%1$@ でコミットできませんでした: %2$@" | |
| 436 | } | |
| 437 | }, | |
| 438 | "pt-BR": { | |
| 439 | "stringUnit": { | |
| 440 | "state": "translated", | |
| 441 | "value": "Não foi possível fazer commit em %1$@: %2$@" | |
| 442 | } | |
| 443 | } | |
| 444 | } | |
| 445 | }, | |
| 446 | "Couldn't pull in %@": { | |
| 447 | "localizations": { | |
| 448 | "de": { | |
| 449 | "stringUnit": { | |
| 450 | "state": "translated", | |
| 451 | "value": "Pull in %@ fehlgeschlagen" | |
| 10 | 452 | } |
| 11 | 453 | }, |
| 12 | 454 | "es": { |
| 13 | 455 | "stringUnit": { |
| 14 | 456 | "state": "translated", |
| 15 | "value": "Activar" | |
| 457 | "value": "No se pudo hacer pull en %@" | |
| 16 | 458 | } |
| 17 | 459 | }, |
| 18 | 460 | "fr": { |
| 19 | 461 | "stringUnit": { |
| 20 | 462 | "state": "translated", |
| 21 | "value": "Activer" | |
| 463 | "value": "Pull impossible dans %@" | |
| 22 | 464 | } |
| 23 | 465 | }, |
| 24 | 466 | "ja": { |
| 25 | 467 | "stringUnit": { |
| 26 | 468 | "state": "translated", |
| 27 | "value": "アクティベート" | |
| 469 | "value": "%@ でプルできませんでした" | |
| 28 | 470 | } |
| 29 | 471 | }, |
| 30 | 472 | "pt-BR": { |
| 31 | 473 | "stringUnit": { |
| 32 | 474 | "state": "translated", |
| 33 | "value": "Ativar" | |
| 475 | "value": "Não foi possível fazer pull em %@" | |
| 34 | 476 | } |
| 35 | 477 | } |
| 36 | 478 | } |
| 37 | 479 | }, |
| 38 | "Check for Updates…": { | |
| 480 | "Couldn't pull in %@: %@. Not pushed.": { | |
| 39 | 481 | "localizations": { |
| 40 | 482 | "de": { |
| 41 | 483 | "stringUnit": { |
| 42 | 484 | "state": "translated", |
| 43 | "value": "Nach Updates suchen …" | |
| 485 | "value": "Pull in %1$@ fehlgeschlagen: %2$@. Nicht gepusht." | |
| 44 | 486 | } |
| 45 | 487 | }, |
| 46 | 488 | "es": { |
| 47 | 489 | "stringUnit": { |
| 48 | 490 | "state": "translated", |
| 49 | "value": "Buscar actualizaciones…" | |
| 491 | "value": "No se pudo hacer pull en %1$@: %2$@. Sin push." | |
| 50 | 492 | } |
| 51 | 493 | }, |
| 52 | 494 | "fr": { |
| 53 | 495 | "stringUnit": { |
| 54 | 496 | "state": "translated", |
| 55 | "value": "Rechercher les mises à jour…" | |
| 497 | "value": "Pull impossible dans %1$@ : %2$@. Pas de push." | |
| 56 | 498 | } |
| 57 | 499 | }, |
| 58 | 500 | "ja": { |
| 59 | 501 | "stringUnit": { |
| 60 | 502 | "state": "translated", |
| 61 | "value": "アップデートを確認…" | |
| 503 | "value": "%1$@ でプルできませんでした: %2$@。プッシュしていません。" | |
| 62 | 504 | } |
| 63 | 505 | }, |
| 64 | 506 | "pt-BR": { |
| 65 | 507 | "stringUnit": { |
| 66 | 508 | "state": "translated", |
| 67 | "value": "Buscar Atualizações…" | |
| 509 | "value": "Não foi possível fazer pull em %1$@: %2$@. Sem push." | |
| 68 | 510 | } |
| 69 | 511 | } |
| 70 | 512 | } |
| 71 | 513 | }, |
| 72 | "Check for updates automatically": { | |
| 514 | "Couldn't push %@": { | |
| 73 | 515 | "localizations": { |
| 74 | 516 | "de": { |
| 75 | 517 | "stringUnit": { |
| 76 | 518 | "state": "translated", |
| 77 | "value": "Automatisch nach Updates suchen" | |
| 519 | "value": "Push von %@ fehlgeschlagen" | |
| 78 | 520 | } |
| 79 | 521 | }, |
| 80 | 522 | "es": { |
| 81 | 523 | "stringUnit": { |
| 82 | 524 | "state": "translated", |
| 83 | "value": "Buscar actualizaciones automáticamente" | |
| 525 | "value": "No se pudo hacer push de %@" | |
| 84 | 526 | } |
| 85 | 527 | }, |
| 86 | 528 | "fr": { |
| 87 | 529 | "stringUnit": { |
| 88 | 530 | "state": "translated", |
| 89 | "value": "Rechercher automatiquement les mises à jour" | |
| 531 | "value": "Push impossible pour %@" | |
| 90 | 532 | } |
| 91 | 533 | }, |
| 92 | 534 | "ja": { |
| 93 | 535 | "stringUnit": { |
| 94 | 536 | "state": "translated", |
| 95 | "value": "アップデートを自動的に確認" | |
| 537 | "value": "%@ をプッシュできませんでした" | |
| 96 | 538 | } |
| 97 | 539 | }, |
| 98 | 540 | "pt-BR": { |
| 99 | 541 | "stringUnit": { |
| 100 | 542 | "state": "translated", |
| 101 | "value": "Buscar atualizações automaticamente" | |
| 543 | "value": "Não foi possível fazer push de %@" | |
| 544 | } | |
| 545 | } | |
| 546 | } | |
| 547 | }, | |
| 548 | "Couldn't push %@: %@": { | |
| 549 | "localizations": { | |
| 550 | "de": { | |
| 551 | "stringUnit": { | |
| 552 | "state": "translated", | |
| 553 | "value": "Push von %1$@ fehlgeschlagen: %2$@" | |
| 554 | } | |
| 555 | }, | |
| 556 | "es": { | |
| 557 | "stringUnit": { | |
| 558 | "state": "translated", | |
| 559 | "value": "No se pudo hacer push de %1$@: %2$@" | |
| 560 | } | |
| 561 | }, | |
| 562 | "fr": { | |
| 563 | "stringUnit": { | |
| 564 | "state": "translated", | |
| 565 | "value": "Push impossible pour %1$@ : %2$@" | |
| 566 | } | |
| 567 | }, | |
| 568 | "ja": { | |
| 569 | "stringUnit": { | |
| 570 | "state": "translated", | |
| 571 | "value": "%1$@ をプッシュできませんでした: %2$@" | |
| 572 | } | |
| 573 | }, | |
| 574 | "pt-BR": { | |
| 575 | "stringUnit": { | |
| 576 | "state": "translated", | |
| 577 | "value": "Não foi possível fazer push de %1$@: %2$@" | |
| 578 | } | |
| 579 | } | |
| 580 | } | |
| 581 | }, | |
| 582 | "Didn't commit in %@: a git %@ is in progress. Finish or abort it; orgstar commits after the next save.": { | |
| 583 | "localizations": { | |
| 584 | "de": { | |
| 585 | "stringUnit": { | |
| 586 | "state": "translated", | |
| 587 | "value": "Kein Commit in %1$@: Ein git-%2$@ läuft. Schließe ihn ab oder brich ihn ab; orgstar committet nach dem nächsten Sichern." | |
| 588 | } | |
| 589 | }, | |
| 590 | "es": { | |
| 591 | "stringUnit": { | |
| 592 | "state": "translated", | |
| 593 | "value": "No se confirmó en %1$@: hay un %2$@ de git en curso. Termínalo o cancélalo; orgstar confirmará tras el próximo guardado." | |
| 594 | } | |
| 595 | }, | |
| 596 | "fr": { | |
| 597 | "stringUnit": { | |
| 598 | "state": "translated", | |
| 599 | "value": "Aucune validation dans %1$@ : un %2$@ git est en cours. Terminez-le ou annulez-le ; orgstar validera après le prochain enregistrement." | |
| 600 | } | |
| 601 | }, | |
| 602 | "ja": { | |
| 603 | "stringUnit": { | |
| 604 | "state": "translated", | |
| 605 | "value": "%1$@ でコミットしませんでした: git の %2$@ が進行中です。完了するか中止してください。次の保存後にコミットします。" | |
| 606 | } | |
| 607 | }, | |
| 608 | "pt-BR": { | |
| 609 | "stringUnit": { | |
| 610 | "state": "translated", | |
| 611 | "value": "Nenhum commit em %1$@: um %2$@ do git está em andamento. Conclua ou cancele; o orgstar fará commit após o próximo salvamento." | |
| 612 | } | |
| 613 | } | |
| 614 | } | |
| 615 | }, | |
| 616 | "Didn't commit in %@: another git command is running there. orgstar tries again after the next save.": { | |
| 617 | "localizations": { | |
| 618 | "de": { | |
| 619 | "stringUnit": { | |
| 620 | "state": "translated", | |
| 621 | "value": "Kein Commit in %@: Dort läuft ein anderer git-Befehl. orgstar versucht es nach dem nächsten Sichern erneut." | |
| 622 | } | |
| 623 | }, | |
| 624 | "es": { | |
| 625 | "stringUnit": { | |
| 626 | "state": "translated", | |
| 627 | "value": "No se confirmó en %@: hay otro comando git en ejecución. orgstar lo intentará de nuevo tras el próximo guardado." | |
| 628 | } | |
| 629 | }, | |
| 630 | "fr": { | |
| 631 | "stringUnit": { | |
| 632 | "state": "translated", | |
| 633 | "value": "Aucune validation dans %@ : une autre commande git y est en cours. orgstar réessaiera après le prochain enregistrement." | |
| 634 | } | |
| 635 | }, | |
| 636 | "ja": { | |
| 637 | "stringUnit": { | |
| 638 | "state": "translated", | |
| 639 | "value": "%@ でコミットしませんでした: 別の git コマンドが実行中です。次の保存後に再試行します。" | |
| 640 | } | |
| 641 | }, | |
| 642 | "pt-BR": { | |
| 643 | "stringUnit": { | |
| 644 | "state": "translated", | |
| 645 | "value": "Nenhum commit em %@: outro comando git está em execução. O orgstar tentará de novo após o próximo salvamento." | |
| 102 | 646 | } |
| 103 | 647 | } |
| 104 | 648 | } |
| @@ -137,6 +681,40 @@ | ||
| 137 | 681 | } |
| 138 | 682 | } |
| 139 | 683 | }, |
| 684 | "Git": { | |
| 685 | "localizations": { | |
| 686 | "de": { | |
| 687 | "stringUnit": { | |
| 688 | "state": "translated", | |
| 689 | "value": "Git" | |
| 690 | } | |
| 691 | }, | |
| 692 | "es": { | |
| 693 | "stringUnit": { | |
| 694 | "state": "translated", | |
| 695 | "value": "Git" | |
| 696 | } | |
| 697 | }, | |
| 698 | "fr": { | |
| 699 | "stringUnit": { | |
| 700 | "state": "translated", | |
| 701 | "value": "Git" | |
| 702 | } | |
| 703 | }, | |
| 704 | "ja": { | |
| 705 | "stringUnit": { | |
| 706 | "state": "translated", | |
| 707 | "value": "Git" | |
| 708 | } | |
| 709 | }, | |
| 710 | "pt-BR": { | |
| 711 | "stringUnit": { | |
| 712 | "state": "translated", | |
| 713 | "value": "Git" | |
| 714 | } | |
| 715 | } | |
| 716 | } | |
| 717 | }, | |
| 140 | 718 | "License key": { |
| 141 | 719 | "localizations": { |
| 142 | 720 | "de": { |
| @@ -171,6 +749,74 @@ | ||
| 171 | 749 | } |
| 172 | 750 | } |
| 173 | 751 | }, |
| 752 | "Not a git repository": { | |
| 753 | "localizations": { | |
| 754 | "de": { | |
| 755 | "stringUnit": { | |
| 756 | "state": "translated", | |
| 757 | "value": "Kein Git-Repository" | |
| 758 | } | |
| 759 | }, | |
| 760 | "es": { | |
| 761 | "stringUnit": { | |
| 762 | "state": "translated", | |
| 763 | "value": "No es un repositorio git" | |
| 764 | } | |
| 765 | }, | |
| 766 | "fr": { | |
| 767 | "stringUnit": { | |
| 768 | "state": "translated", | |
| 769 | "value": "Pas un dépôt git" | |
| 770 | } | |
| 771 | }, | |
| 772 | "ja": { | |
| 773 | "stringUnit": { | |
| 774 | "state": "translated", | |
| 775 | "value": "git リポジトリではありません" | |
| 776 | } | |
| 777 | }, | |
| 778 | "pt-BR": { | |
| 779 | "stringUnit": { | |
| 780 | "state": "translated", | |
| 781 | "value": "Não é um repositório git" | |
| 782 | } | |
| 783 | } | |
| 784 | } | |
| 785 | }, | |
| 786 | "Nothing was merged; pull and resolve it in a terminal. Not pushed.": { | |
| 787 | "localizations": { | |
| 788 | "de": { | |
| 789 | "stringUnit": { | |
| 790 | "state": "translated", | |
| 791 | "value": "Nichts wurde zusammengeführt; hole und löse es im Terminal. Nicht gepusht." | |
| 792 | } | |
| 793 | }, | |
| 794 | "es": { | |
| 795 | "stringUnit": { | |
| 796 | "state": "translated", | |
| 797 | "value": "No se fusionó nada; haz pull y resuélvelo en un terminal. Sin push." | |
| 798 | } | |
| 799 | }, | |
| 800 | "fr": { | |
| 801 | "stringUnit": { | |
| 802 | "state": "translated", | |
| 803 | "value": "Rien n’a été fusionné ; faites le pull et résolvez-le dans un terminal. Pas de push." | |
| 804 | } | |
| 805 | }, | |
| 806 | "ja": { | |
| 807 | "stringUnit": { | |
| 808 | "state": "translated", | |
| 809 | "value": "何もマージしていません。ターミナルでプルして解決してください。プッシュしていません。" | |
| 810 | } | |
| 811 | }, | |
| 812 | "pt-BR": { | |
| 813 | "stringUnit": { | |
| 814 | "state": "translated", | |
| 815 | "value": "Nada foi mesclado; faça pull e resolva em um terminal. Sem push." | |
| 816 | } | |
| 817 | } | |
| 818 | } | |
| 819 | }, | |
| 174 | 820 | "ORGSTAR1-…": { |
| 175 | 821 | "localizations": { |
| 176 | 822 | "de": { |
| @@ -205,6 +851,40 @@ | ||
| 205 | 851 | } |
| 206 | 852 | } |
| 207 | 853 | }, |
| 854 | "Off": { | |
| 855 | "localizations": { | |
| 856 | "de": { | |
| 857 | "stringUnit": { | |
| 858 | "state": "translated", | |
| 859 | "value": "Aus" | |
| 860 | } | |
| 861 | }, | |
| 862 | "es": { | |
| 863 | "stringUnit": { | |
| 864 | "state": "translated", | |
| 865 | "value": "Desactivado" | |
| 866 | } | |
| 867 | }, | |
| 868 | "fr": { | |
| 869 | "stringUnit": { | |
| 870 | "state": "translated", | |
| 871 | "value": "Désactivé" | |
| 872 | } | |
| 873 | }, | |
| 874 | "ja": { | |
| 875 | "stringUnit": { | |
| 876 | "state": "translated", | |
| 877 | "value": "オフ" | |
| 878 | } | |
| 879 | }, | |
| 880 | "pt-BR": { | |
| 881 | "stringUnit": { | |
| 882 | "state": "translated", | |
| 883 | "value": "Desativado" | |
| 884 | } | |
| 885 | } | |
| 886 | } | |
| 887 | }, | |
| 208 | 888 | "Once a day, from the app's own feed. orgstar ▸ Check for Updates… checks now.": { |
| 209 | 889 | "localizations": { |
| 210 | 890 | "de": { |
| @@ -375,6 +1055,40 @@ | ||
| 375 | 1055 | } |
| 376 | 1056 | } |
| 377 | 1057 | }, |
| 1058 | "git isn't installed. Install the Xcode command line tools or git from Homebrew.": { | |
| 1059 | "localizations": { | |
| 1060 | "de": { | |
| 1061 | "stringUnit": { | |
| 1062 | "state": "translated", | |
| 1063 | "value": "git ist nicht installiert. Installiere die Xcode-Befehlszeilentools oder git aus Homebrew." | |
| 1064 | } | |
| 1065 | }, | |
| 1066 | "es": { | |
| 1067 | "stringUnit": { | |
| 1068 | "state": "translated", | |
| 1069 | "value": "git no está instalado. Instala las herramientas de línea de comandos de Xcode o git desde Homebrew." | |
| 1070 | } | |
| 1071 | }, | |
| 1072 | "fr": { | |
| 1073 | "stringUnit": { | |
| 1074 | "state": "translated", | |
| 1075 | "value": "git n’est pas installé. Installez les outils en ligne de commande de Xcode ou git depuis Homebrew." | |
| 1076 | } | |
| 1077 | }, | |
| 1078 | "ja": { | |
| 1079 | "stringUnit": { | |
| 1080 | "state": "translated", | |
| 1081 | "value": "git がインストールされていません。Xcode コマンドラインツールか Homebrew の git をインストールしてください。" | |
| 1082 | } | |
| 1083 | }, | |
| 1084 | "pt-BR": { | |
| 1085 | "stringUnit": { | |
| 1086 | "state": "translated", | |
| 1087 | "value": "O git não está instalado. Instale as ferramentas de linha de comando do Xcode ou o git do Homebrew." | |
| 1088 | } | |
| 1089 | } | |
| 1090 | } | |
| 1091 | }, | |
| 378 | 1092 | "orgstar+ for Mac comes with sponsoring orgstar on GitHub: $60 once, or $5 a month. Editing, the agenda, capture, clocking and search stay free.": { |
| 379 | 1093 | "localizations": { |
| 380 | 1094 | "de": { |
scripts/sync-strings.sh +1 −1 · view
| @@ -29,7 +29,7 @@ done | ||
| 29 | 29 | |
| 30 | 30 | [ -f "$catalog" ] || printf '{\n "sourceLanguage" : "en",\n "strings" : {\n\n },\n "version" : "1.0"\n}\n' > "$catalog" |
| 31 | 31 | find "$mac" "$ios" -path '*/arm64/*' -name '*.stringsdata' \ |
| 32 | | grep -E '/(Orgstar|OrgstarMobile|OrgstarWidgets|OrgstarShare|OrgstarWatch|OrgstarWatchWidgets)-p\.build/|/(OrgApp|OrgPresentation|OrgEditorAppKit)-t?\.build/' \ | |
| 32 | | grep -E '/(Orgstar|OrgstarMobile|OrgstarWidgets|OrgstarShare|OrgstarWatch|OrgstarWatchWidgets)-p\.build/|/(OrgApp|OrgPresentation|OrgEditorAppKit|OrgPrograms)-t?\.build/' \ | |
| 33 | 33 | > "$mac/stringsdata.txt" |
| 34 | 34 | find "$mas" -path '*/arm64/*' -name '*.stringsdata' | grep -E '/(Orgstar macOS|OrgstarWidgets)\.build/' >> "$mac/stringsdata.txt" |
| 35 | 35 | # The App Store target's folder name has a space, so the list is read a line at a time. |