diff --git a/Other/screenshot1.png b/Other/screenshot1.png
new file mode 100644
index 0000000..de7d8f5
Binary files /dev/null and b/Other/screenshot1.png differ
diff --git a/Other/screenshot2.png b/Other/screenshot2.png
new file mode 100644
index 0000000..7df05f7
Binary files /dev/null and b/Other/screenshot2.png differ
diff --git a/Other/screenshot3.png b/Other/screenshot3.png
new file mode 100644
index 0000000..7ed9bd7
Binary files /dev/null and b/Other/screenshot3.png differ
diff --git a/README.md b/README.md
index 967acd8..ff05161 100755
--- a/README.md
+++ b/README.md
@@ -1,5 +1,13 @@
# SwiftGit
+
+
## Use
* Run `carthage update --platform osx --cache-builds` to install dependencies, run the app
diff --git a/SwiftGit/AppDelegate.swift b/SwiftGit/AppDelegate.swift
index 55330b2..cc508ab 100755
--- a/SwiftGit/AppDelegate.swift
+++ b/SwiftGit/AppDelegate.swift
@@ -98,6 +98,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@objc func commit(_ sender: NSMenuItem) {
let storyboard = NSStoryboard(name: "Main", bundle: nil)
let windowController = storyboard.instantiateController(withIdentifier: "Commit Window Controller") as! NSWindowController
+ guard let path = sender.project.path else { return }
+ var context = CustomContext()
+ context.currentdirectory = path
if let commitWindow = windowController.window {
let controller = commitWindow.contentViewController as! CommitViewController
controller.project = sender.project
@@ -105,13 +108,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
windowController.close()
}
controller.stageAll = {
- guard let path = sender.project.path else { return }
- var context = CustomContext()
- context.currentdirectory = path
try? context.runAndPrint("git", "add", ".", "-A")
}
controller.commit = { commitMessage in
- sender.project.repo?.commit(message: commitMessage, signature: Signature(name: "", email: <#T##String#>))
+ try? context.runAndPrint("git", "commit", "-m", commitMessage)
}
NSApplication.shared.runModal(for: commitWindow)
diff --git a/SwiftGit/Commit/CommitViewController.swift b/SwiftGit/Commit/CommitViewController.swift
index c481692..c1f23e1 100644
--- a/SwiftGit/Commit/CommitViewController.swift
+++ b/SwiftGit/Commit/CommitViewController.swift
@@ -12,7 +12,7 @@ import Reloaded
import SwiftGit2
-class CommitViewController: NSViewController, NSTextViewDelegate {
+class CommitViewController: NSViewController, NSTextViewDelegate, NSTextFieldDelegate {
var project: Project!
@@ -26,6 +26,8 @@ class CommitViewController: NSViewController, NSTextViewDelegate {
var cancel: (() -> Void)?
var stageAll: (() -> Void)?
+ // MARK: View lifecycle
+
override func viewWillAppear() {
super.viewWillAppear()
@@ -49,11 +51,15 @@ class CommitViewController: NSViewController, NSTextViewDelegate {
NSApplication.shared.stopModal()
}
+ // MARK: Delegate methods
+
func textDidChange(_ notification: Notification) {
project.lastCommitMessage = (notification.object as? NSTextView)?.string
try! project.save()
}
+ // MARK: Actions
+
@IBAction func stageMissing(_ sender: NSButton) {
stageAll?()
@@ -70,6 +76,12 @@ class CommitViewController: NSViewController, NSTextViewDelegate {
}
@IBAction func makeCommit(_ sender: NSButton) {
+ guard !textView.string.isEmpty else {
+
+ return
+ }
+ sender.isEnabled = false
+
project.lastCommitMessage = ""
try! project.save()
@@ -96,6 +108,7 @@ extension CommitViewController: NSTableViewDelegate, NSTableViewDataSource {
let status = statuses[row]
if let cell = cell as? NSButtonCell {
cell.state = status.status.isStaged ? .on : .off
+ cell.isEnabled = false
} else if let cell = cell as? NSTextFieldCell {
cell.stringValue = status.title
}
diff --git a/SwiftGit/Supporting files/Main.storyboard b/SwiftGit/Supporting files/Main.storyboard
index 0d9ebad..357bed2 100644
--- a/SwiftGit/Supporting files/Main.storyboard
+++ b/SwiftGit/Supporting files/Main.storyboard
@@ -151,6 +151,7 @@
+
@@ -161,7 +162,6 @@
-