Created
March 30, 2014 04:15
-
-
Save pwc3/9867443 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Xcode" | |
set _workspace to active workspace document | |
set _workspaceFile to file of _workspace | |
end tell | |
tell application "Finder" | |
set _posixTargetPath to quoted form of POSIX path of _workspaceFile | |
end tell | |
tell application "Xcode" | |
set _curBranch to do shell script "cd " & _posixTargetPath & "; cd ../../; git rev-parse --abbrev-ref HEAD" | |
set _mods to do shell script "cd " & _posixTargetPath & "; cd ../../; git diff --no-ext-diff --quiet --exit-code || echo 'modified'" | |
set _adds to do shell script "cd " & _posixTargetPath & "; cd ../../; git diff-index --cached --quiet HEAD -- || echo 'added'" | |
if _mods is equal to "" and _adds is equal to "" then | |
set _status to "Working directory is clean" | |
else if _mods is not equal to "" and _adds is equal to "" then | |
set _status to "Files " & _mods | |
else if _mods is equal to "" and _adds is not equal to "" then | |
set _status to "Files " & _adds | |
else | |
set _status to "Files " & _mods & " and " & _adds | |
end if | |
display notification _status with title "Xcode Git status" subtitle "⎇ " & _curBranch | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment