[PATCH 1/2 v2] cvsexportcommit: chomp only removes trailing whitespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In commit fef3a7cc(cvsexportcommit: be graceful when "cvs status"
reorders the arguments), caution was taken to get the status even
for files with leading or trailing whitespace.

However, the author of that commit missed that chomp() removes only
trailing newlines.  With help of the mailing list, the author realized
his mistake and provided this patch.

The idea is that we do not want to rely on a certain layout of the 
output of "cvs status".  Therefore we only call it with files that are 
unambiguous after stripping leading and trailing whitespace.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---

	On Wed, 14 May 2008, Johannes Schindelin wrote:

	> To prevent bad things from happening, the status is checked on a 
	> set of files which have unique names with regard to the chomp()ed
	> name (well, whatever we do to the name, really).
	> 
	> So yes, this patch needs an update.
	> 
	> Will do so in a couple of hours,

	And so I did.

 git-cvsexportcommit.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index b6036bd..52ba7de 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -210,7 +210,7 @@ if (@canstatusfiles) {
 	my $basename = basename($name);
 
 	$basename = "no file " . $basename if (exists($added{$basename}));
-	chomp($basename);
+	$basename =~ s/^\s+(.*?)\s*$/$1/;
 
 	if (!exists($fullname{$basename})) {
 	  $fullname{$basename} = $name;
-- 
1.5.5.1.375.g1becb

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux