Skip to content

Commit abd66f2

Browse files
Matthew Ogilviegitster
authored andcommitted
cvsserver status: provide real sticky info
Signed-off-by: Matthew Ogilvie <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bed8a19 commit abd66f2

File tree

2 files changed

+55
-4
lines changed

2 files changed

+55
-4
lines changed

git-cvsserver.perl

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ sub req_Entry
502502

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

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

507507
$state->{entries}{$state->{directory}.$data[1]} = {
508508
revision => $data[2],
@@ -1681,9 +1681,25 @@ sub req_status
16811681
print "M Repository revision:\t" .
16821682
$meta->{revision} .
16831683
"\t$state->{CVSROOT}/$state->{module}/$filename,v\n";
1684-
print "M Sticky Tag:\t\t(none)\n";
1685-
print "M Sticky Date:\t\t(none)\n";
1686-
print "M Sticky Options:\t\t(none)\n";
1684+
my($tagOrDate)=$state->{entries}{$filename}{tag_or_date};
1685+
my($tag)=($tagOrDate=~m/^T(.+)$/);
1686+
if( !defined($tag) )
1687+
{
1688+
$tag="(none)";
1689+
}
1690+
print "M Sticky Tag:\t\t$tag\n";
1691+
my($date)=($tagOrDate=~m/^D(.+)$/);
1692+
if( !defined($date) )
1693+
{
1694+
$date="(none)";
1695+
}
1696+
print "M Sticky Date:\t\t$date\n";
1697+
my($options)=$state->{entries}{$filename}{options};
1698+
if( $options eq "" )
1699+
{
1700+
$options="(none)";
1701+
}
1702+
print "M Sticky Options:\t\t$options\n";
16871703
} else {
16881704
print "M Repository revision:\tNo revision control file\n";
16891705
}

t/t9401-git-cvsserver-crlf.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,25 @@ not_present() {
3838
fi
3939
}
4040

41+
check_status_options() {
42+
(cd "$1" &&
43+
GIT_CONFIG="$git_config" cvs -Q status "$2" > "${WORKDIR}/status.out" 2>&1
44+
)
45+
if [ x"$?" != x"0" ] ; then
46+
echo "Error from cvs status: $1 $2" >> "${WORKDIR}/marked.log"
47+
return 1;
48+
fi
49+
got="$(sed -n -e 's/^\s*Sticky Options:\s*//p' "${WORKDIR}/status.out")"
50+
expect="$3"
51+
if [ x"$expect" = x"" ] ; then
52+
expect="(none)"
53+
fi
54+
test x"$got" = x"$expect"
55+
stat=$?
56+
echo "cvs status: $1 $2 $stat '$3' '$got'" >> "${WORKDIR}/marked.log"
57+
return $stat
58+
}
59+
4160
cvs >/dev/null 2>&1
4261
if test $? -ne 1
4362
then
@@ -233,6 +252,22 @@ test_expect_success 'cvs co another copy (guess)' '
233252
marked_as cvswork2/subdir newfile.c ""
234253
'
235254

255+
test_expect_success 'cvs status - sticky options' '
256+
check_status_options cvswork2 textfile.c "" &&
257+
check_status_options cvswork2 binfile.bin -kb &&
258+
check_status_options cvswork2 .gitattributes "" &&
259+
check_status_options cvswork2 mixedUp.c -kb &&
260+
check_status_options cvswork2 multiline.c -kb &&
261+
check_status_options cvswork2 multilineTxt.c "" &&
262+
check_status_options cvswork2/subdir withCr.bin -kb &&
263+
check_status_options cvswork2 subdir/withCr.bin -kb &&
264+
check_status_options cvswork2/subdir file.h "" &&
265+
check_status_options cvswork2 subdir/file.h "" &&
266+
check_status_options cvswork2/subdir unspecified.other "" &&
267+
check_status_options cvswork2/subdir newfile.bin "" &&
268+
check_status_options cvswork2/subdir newfile.c ""
269+
'
270+
236271
test_expect_success 'add text (guess)' '
237272
(cd cvswork &&
238273
echo "simpleText" > simpleText.c &&

0 commit comments

Comments
 (0)