aharrison24-git-external 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/git-external +15 -3
  2. metadata +2 -2
data/bin/git-external CHANGED
@@ -60,6 +60,12 @@ def normalize_url(url)
60
60
  end
61
61
  end
62
62
 
63
+ # Check for uncommitted changes
64
+ def uncommitted_changes?(path)
65
+ diffExit, diff = execute("cd #{path}; git diff-index --quiet HEAD")
66
+ return ((diffExit == 1) ? true : false)
67
+ end
68
+
63
69
  # Check if a branch exists
64
70
  def branch_exists(path, branch)
65
71
  branches = `cd #{path}; git branch`
@@ -130,20 +136,26 @@ def command_status
130
136
  gitBranchExit, gitBranch = execute("cd #{path} && git config \"branch.#{headBranch}.merge\" | sed \"s/refs\\/heads\\///g\"")
131
137
  gitRemoteExit, gitRemote = execute("cd #{path} && git config \"remote.$(git config \"branch.#{headBranch}.remote\").url\"");
132
138
 
139
+ if uncommitted_changes?(path)
140
+ changesString = "(Uncommitted Changes) "
141
+ else
142
+ changesString = ""
143
+ end
144
+
133
145
  if gitBranchExit != 0 && gitRemoteExit != 0
134
146
  puts " ✗ #{path}: exit code #{gitBranchExit}, #{gitRemoteExit}"
135
147
  broken += 1
136
148
  else
137
149
  if branch == gitBranch[0]
138
150
  if url == gitRemote[0]
139
- puts " ✓ #{path}"
151
+ puts " ✓ #{path} #{changesString}"
140
152
  ok += 1
141
153
  else
142
- puts " ✗ #{path} -- expected url '#{url}' but was '#{gitRemote[0]}'"
154
+ puts " ✗ #{path} #{changesString}-- expected url '#{url}' but was '#{gitRemote[0]}'"
143
155
  broken +=1
144
156
  end
145
157
  else
146
- puts " ✗ #{path} -- expected branch '#{branch}' but was '#{gitBranch[0]}'"
158
+ puts " ✗ #{path} #{changesString}-- expected branch '#{branch}' but was '#{gitBranch[0]}'"
147
159
  broken +=1
148
160
  end
149
161
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aharrison24-git-external
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-15 00:00:00.000000000 Z
12
+ date: 2012-08-03 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Extension for git which adds a command providing similar functionality
15
15
  to git submodules but without attaching each module to a single version