Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProjectFile.save with forceTouch to only modify the last write time without content if unchanged #1493

Merged
merged 3 commits into from
Mar 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/Paket.Core/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -941,13 +941,12 @@ module ProjectFile =
project.ProjectNode.AppendChild analyzersNode |> ignore
)


let save forceTouch project =
if forceTouch then
project.Document.Save(project.FileName)
elif Utils.normalizeXml project.Document <> project.OriginalText then
if Utils.normalizeXml project.Document <> project.OriginalText || not (File.Exists(project.FileName)) then
verbosefn "Project %s changed" project.FileName
project.Document.Save(project.FileName)
elif forceTouch then
File.SetLastWriteTimeUtc(project.FileName, DateTime.UtcNow)

let getPaketFileItems project =
findPaketNodes "Content" project
Expand Down Expand Up @@ -1305,7 +1304,7 @@ type ProjectFile with
member this.RemovePaketNodes () = ProjectFile.removePaketNodes this

member this.UpdateReferences (completeModel, usedPackages, hard) = ProjectFile.updateReferences completeModel usedPackages hard this

member this.Save(forceTouch) = ProjectFile.save forceTouch this

member this.GetPaketFileItems () = ProjectFile.getPaketFileItems this
Expand Down