From a78ec6052d6b6f4cb220ba77e477f4a399b68e17 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 24 Apr 2023 10:01:54 +1200 Subject: [PATCH] Ignore `:ignored` files when considering `modified?` status. --- lib/teapot/command/fetch.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/teapot/command/fetch.rb b/lib/teapot/command/fetch.rb index 456d20d..70084f1 100644 --- a/lib/teapot/command/fetch.rb +++ b/lib/teapot/command/fetch.rb @@ -122,7 +122,15 @@ def credentials(url, username, types) # We should prompt for username/password if required... return Rugged::Credentials::SshKeyFromAgent.new(username: username) end - + + def modified?(repository) + repository.status.each do |path, status| + return true if status != [:ignored] + end + + return false + end + def clone_or_pull_package(context, configuration, package, package_lock, logger) logger.info "Processing #{package}..." #.color(:cyan) @@ -150,7 +158,7 @@ def clone_or_pull_package(context, configuration, package, package_lock, logger) repository = Rugged::Repository.new(destination_path.to_s) # Are there uncommitted changes in the work tree? - if repository.to_enum(:status).any? + if modified?(repository) raise FetchError.new(package, "Uncommited local modifications") end