File: 10-zero-filename.patch

package info (click to toggle)
splitpatch 0.0%2B20131223%2Bgitb13d810-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 128 kB
  • ctags: 46
  • sloc: ruby: 552; makefile: 11
file content (29 lines) | stat: -rw-r--r-- 1,005 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From 905113d0d3bd35970a3bd908eb8a36bcfafc3d1f Mon Sep 17 00:00:00 2001
From: Jari Aalto <jari.aalto@cante.net>
Date: Sun, 15 Jun 2014 21:46:19 +0300
Subject: [PATCH] Add zero padding to filename suffix in splitByFile()
Organization: Private
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Patch thanks to Alexandr Agranovsky <alesso@alesso.ru>

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
---
 splitpatch.rb |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/splitpatch.rb
+++ b/splitpatch.rb
@@ -43,8 +43,10 @@
         if File.exists?(filename)
             puts "File #{filename} already exists. Renaming patch."
             appendix = 0
-            while File.exists?("#{filename}.#{appendix}")
+            zero = appendix.to_s.rjust(3, '0')
+            while File.exists?("#{filename}.#{zero}")
                 appendix += 1
+                zero = appendix.to_s.rjust(3, '0')
             end
             filename << ".#{appendix}"
         end