Re: [PATCH] gitweb: Fix "Use of uninitialized value" warning in git_tags_body

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

 



Jakub Narebski <jnareb@xxxxxxxxx> writes:

>> Fix "Use of uninitialized value" warning in git_tags_body generated
>> for lightweight tags of tree and blob object; those don't have age
>> ($tag{'age'}) defined.
>
> By the way, the latest "Fix warnings" patches for gitweb were result
> of working on bare bones test suite for gitweb. For now I'm only
> checking if there was anything written to STDERR.

I think this is a useful thing to have in-tree at this point,
with perhaps minor tweaks I'd suggest later.  That way other
people can write more tests to catch regressions.

> BTW how in portable way to check that given file matches given patterns
> in specified order, or matches given patterns in any order?

This depends on how different the same page is rendered at
different times; I suspect the outputs for the same request from
two runs of the test are expected to be different in age, commit
and tag object ID and nothing else?

If so, I think using test_tick() to force the stable commit
object ID while your test is building a test repository would be
a useful thing to do.  Also I think replacing call to "time"
(you seem to call it from multiple places, all to compute "age")
with a call to a subroutine "git_time" and then defining:

	sub git_time {
        	if (exists $::ENV{GIT_TEST_TIME}) {
                	return $::ENV{GIT_TEST_TIME};
                }
                return time;
        }

to help testing would be sensible.  Set and export GIT_TEST_TIME
to a fixed time (say, midnight GMT December 28th, 2006) in
gitweb_init and you will get stable agestring if you have
already made the commit and author timestamps stable with
test_tick().

-
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]