0002-Allow-input-files-to-be-missing-for-ed-style-patches.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From b5a91a01e5d0897facdd0f49d64b76b0f02b43e1 Mon Sep 17 00:00:00 2001
  2. From: Andreas Gruenbacher <agruen@gnu.org>
  3. Date: Fri, 6 Apr 2018 11:34:51 +0200
  4. Subject: [PATCH] Allow input files to be missing for ed-style patches
  5. * src/pch.c (do_ed_script): Allow input files to be missing so that new
  6. files will be created as with non-ed-style patches.
  7. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
  8. ---
  9. Upstream status: commit b5a91a01e5d0
  10. src/pch.c | 8 +++++---
  11. 1 file changed, 5 insertions(+), 3 deletions(-)
  12. diff --git a/src/pch.c b/src/pch.c
  13. index bc6278c4032c..0c5cc2623079 100644
  14. --- a/src/pch.c
  15. +++ b/src/pch.c
  16. @@ -2394,9 +2394,11 @@ do_ed_script (char const *inname, char const *outname,
  17. if (! dry_run && ! skip_rest_of_patch) {
  18. int exclusive = *outname_needs_removal ? 0 : O_EXCL;
  19. - assert (! inerrno);
  20. - *outname_needs_removal = true;
  21. - copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
  22. + if (inerrno != ENOENT)
  23. + {
  24. + *outname_needs_removal = true;
  25. + copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
  26. + }
  27. sprintf (buf, "%s %s%s", editor_program,
  28. verbosity == VERBOSE ? "" : "- ",
  29. outname);
  30. --
  31. 2.16.3