Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
systemsmanagement:chef:10
rubygem-chef
CHEF-4322-only-if-there-are-actual-changes.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File CHEF-4322-only-if-there-are-actual-changes.patch of Package rubygem-chef
From 70482de5cd6ee2d2209bc70d56be9e2c7f4dcc97 Mon Sep 17 00:00:00 2001 From: Vincent Untz <vuntz@suse.com> Date: Mon, 15 Jul 2013 14:49:16 +0200 Subject: [PATCH] FilEdit: Do not mark file as edited when changed line is the same as old Right now, when a line is changed, the file is always marked as edited. But the changed line can actually be the same as the old one, which means the file was really not edited. --- lib/chef/util/file_edit.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/chef/util/file_edit.rb b/lib/chef/util/file_edit.rb index ea0a523..348be22 100644 --- a/lib/chef/util/file_edit.rb +++ b/lib/chef/util/file_edit.rb @@ -104,17 +104,23 @@ class Chef contents.each do |line| if line.match(exp) - self.file_edited = true case when command == 'r' - new_contents << ((method == 1) ? replace : line.gsub!(exp, replace)) + new_line = ((method == 1) ? replace : line.gsub!(exp, replace)) + new_contents << new_line + self.file_edited = file_edited || (line.chomp != new_line) when command == 'd' if method == 2 - new_contents << line.gsub!(exp, "") + new_line = line.gsub!(exp, "") + new_contents << new_line + self.file_edited = file_edited || (line.chomp != new_line) + else + self.file_edited = true end when command == 'i' new_contents << line new_contents << replace unless method == 2 + self.file_edited = true end else new_contents << line
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor