Hello,

currently the refresh command writes directly into the existing patch file 
instead of creating a new file, which makes a difference when the patch is a 
symlink or hardlink. I think it makes more sense to create a new object 
instead, so that a refresh will work nicely with hardlinked patches. Are 
there any reasons not to change that?

Proposed patch attached.

Thanks,
-- 
Andreas Gruenbacher <[EMAIL PROTECTED]>
SUSE Labs, SUSE LINUX PRODUCTS GMBH
Index: quilt/refresh.in
===================================================================
RCS file: /cvsroot/quilt/quilt/quilt/refresh.in,v
retrieving revision 1.43
diff -u -r1.43 refresh.in
--- quilt/refresh.in	18 Jun 2005 18:03:58 -0000	1.43
+++ quilt/refresh.in	2 Jul 2005 12:17:47 -0000
@@ -295,8 +295,8 @@
 then
 	printf $"Patch %s is unchanged\n" "$(print_patch $patch)"
 elif ( [ -z "$QUILT_BACKUP" -o ! -e $patch_file ] || \
-       cp $patch_file $patch_file~ ) && \
-     cat_to_file $patch_file < $tmp_result
+       mv $patch_file $patch_file~ ) && \
+     cat_to_new_file $patch_file < $tmp_result
 then
 	printf $"Refreshed patch %s\n" "$(print_patch $patch)"
 else
Index: scripts/patchfns.in
===================================================================
RCS file: /cvsroot/quilt/quilt/scripts/patchfns.in,v
retrieving revision 1.63
diff -u -r1.63 patchfns.in
--- scripts/patchfns.in	26 Jun 2005 22:08:59 -0000	1.63
+++ scripts/patchfns.in	2 Jul 2005 12:17:47 -0000
@@ -610,23 +610,21 @@
 	done
 }
 
-cat_to_file()
+cat_to_new_file()
 {
 	local filename="$1"
 
-	if [ -z "$filename" ]
-	then
-		cat
-	else
-		case "$filename" in
-		*.gz|*.tgz)
-			gzip -c > "$filename" ;;
-		*.bz2)
-			bzip2 -c > "$filename" ;;
-		*)
-			cat > "$filename" ;;
-		esac
-	fi
+	[ -e "$filename" ] && rm -f "$filename"
+
+	case "$filename" in
+	*.gz|*.tgz)
+		gzip -c ;;
+	*.bz2)
+		bzip2 -c ;;
+	*)
+		cat ;;
+	esac \
+	> "$filename"
 }
 
 patch_description()
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to