aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeongJae Park <sj@kernel.org>2024-04-27 10:41:42 -0700
committerSeongJae Park <sj@kernel.org>2024-04-27 10:41:42 -0700
commitea5156cfc8235cf12f89d6f69b24448216fad14c (patch)
tree154af12fd27b0bd04a137a4917bd5592f2cee3fe
parentc17153be4bbb4e10876e770833e7fcc91c8a3846 (diff)
downloaddamon-hack-ea5156cfc8235cf12f89d6f69b24448216fad14c.tar.gz
backup_patches: Handle duplicated patch file names
Signed-off-by: SeongJae Park <sj@kernel.org>
-rwxr-xr-xbackup_patches.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/backup_patches.sh b/backup_patches.sh
index 9e098a7..08cae77 100755
--- a/backup_patches.sh
+++ b/backup_patches.sh
@@ -16,6 +16,12 @@ do
fi
patch=$(git format-patch "$commit^".."$commit")
final_name=$(echo "$patch" | cut -c 6-)
+ nr_duplicates=0
+ while [ -e "$dest_dir/$final_name" ]
+ do
+ nr_duplicates=$((nr_duplicates + 1))
+ final_name+="$nr_duplicates"
+ done
mv "$patch" "$dest_dir/$final_name"
echo "$final_name" >> "$dest_dir/series"
done