Skip to content
This repository has been archived by the owner on Nov 11, 2017. It is now read-only.

Commit

Permalink
Don't remerge an up-to-date file
Browse files Browse the repository at this point in the history
  • Loading branch information
jferris committed Sep 21, 2010
1 parent 0c3b22a commit 6efff37
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
17 changes: 16 additions & 1 deletion features/sync_gemfile.feature
Expand Up @@ -51,4 +51,19 @@ Feature: sync a Gemfile between two repositories
gem "postgresql"
>>>>>>> .trout/upstream
"""

When I write to "Gemfile" with:
"""
source "http://rubygems.org"
gem "rails"
gem "mysql"
gem "redcloth"
"""
When I run "trout update Gemfile"
And I run "cat Gemfile"
Then the output should contain:
"""
source "http://rubygems.org"
gem "rails"
gem "mysql"
gem "redcloth"
"""
11 changes: 9 additions & 2 deletions lib/trout/managed_file.rb
Expand Up @@ -19,7 +19,10 @@ def copy_from(git_url)

def update
checkout(previous_git_url)
merge_to_destination
unless up_to_date?
merge_to_destination
write_url_and_version
end
ensure
cleanup
end
Expand Down Expand Up @@ -76,7 +79,7 @@ def write_url_and_version
end

def checked_out_version
git_command("rev-parse HEAD")
git_command("rev-parse master")
end

def checkout_last_version
Expand All @@ -95,6 +98,10 @@ def previous_git_version
version_list.version_for(filename)
end

def up_to_date?
previous_git_version == checked_out_version
end

def version_list
@version_list ||= VersionList.new(working('versions'))
end
Expand Down

0 comments on commit 6efff37

Please sign in to comment.