Skip to content

Commit

Permalink
cvsserver status: provide real sticky info
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Matthew Ogilvie authored and Junio C Hamano committed Oct 16, 2012
1 parent bed8a19 commit abd66f2
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
24 changes: 20 additions & 4 deletions git-cvsserver.perl
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ sub req_Entry

#$log->debug("req_Entry : $data");

my @data = split(/\//, $data);
my @data = split(/\//, $data, -1);

$state->{entries}{$state->{directory}.$data[1]} = {
revision => $data[2],
Expand Down Expand Up @@ -1681,9 +1681,25 @@ sub req_status
print "M Repository revision:\t" .
$meta->{revision} .
"\t$state->{CVSROOT}/$state->{module}/$filename,v\n";
print "M Sticky Tag:\t\t(none)\n";
print "M Sticky Date:\t\t(none)\n";
print "M Sticky Options:\t\t(none)\n";
my($tagOrDate)=$state->{entries}{$filename}{tag_or_date};
my($tag)=($tagOrDate=~m/^T(.+)$/);
if( !defined($tag) )
{
$tag="(none)";
}
print "M Sticky Tag:\t\t$tag\n";
my($date)=($tagOrDate=~m/^D(.+)$/);
if( !defined($date) )
{
$date="(none)";
}
print "M Sticky Date:\t\t$date\n";
my($options)=$state->{entries}{$filename}{options};
if( $options eq "" )
{
$options="(none)";
}
print "M Sticky Options:\t\t$options\n";
} else {
print "M Repository revision:\tNo revision control file\n";
}
Expand Down
35 changes: 35 additions & 0 deletions t/t9401-git-cvsserver-crlf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ not_present() {
fi
}

check_status_options() {
(cd "$1" &&
GIT_CONFIG="$git_config" cvs -Q status "$2" > "${WORKDIR}/status.out" 2>&1
)
if [ x"$?" != x"0" ] ; then
echo "Error from cvs status: $1 $2" >> "${WORKDIR}/marked.log"
return 1;
fi
got="$(sed -n -e 's/^\s*Sticky Options:\s*//p' "${WORKDIR}/status.out")"
expect="$3"
if [ x"$expect" = x"" ] ; then
expect="(none)"
fi
test x"$got" = x"$expect"
stat=$?
echo "cvs status: $1 $2 $stat '$3' '$got'" >> "${WORKDIR}/marked.log"
return $stat
}

cvs >/dev/null 2>&1
if test $? -ne 1
then
Expand Down Expand Up @@ -233,6 +252,22 @@ test_expect_success 'cvs co another copy (guess)' '
marked_as cvswork2/subdir newfile.c ""
'

test_expect_success 'cvs status - sticky options' '
check_status_options cvswork2 textfile.c "" &&
check_status_options cvswork2 binfile.bin -kb &&
check_status_options cvswork2 .gitattributes "" &&
check_status_options cvswork2 mixedUp.c -kb &&
check_status_options cvswork2 multiline.c -kb &&
check_status_options cvswork2 multilineTxt.c "" &&
check_status_options cvswork2/subdir withCr.bin -kb &&
check_status_options cvswork2 subdir/withCr.bin -kb &&
check_status_options cvswork2/subdir file.h "" &&
check_status_options cvswork2 subdir/file.h "" &&
check_status_options cvswork2/subdir unspecified.other "" &&
check_status_options cvswork2/subdir newfile.bin "" &&
check_status_options cvswork2/subdir newfile.c ""
'

test_expect_success 'add text (guess)' '
(cd cvswork &&
echo "simpleText" > simpleText.c &&
Expand Down

0 comments on commit abd66f2

Please sign in to comment.