Re: [PATCH v2 6/6] commit-graph: add repo arg to graph readers

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

 



Hi,

On Tue, 10 Jul 2018, SZEDER Gábor wrote:

> > diff --git a/t/helper/test-repository.c b/t/helper/test-repository.c
> > new file mode 100644
> > index 0000000000..5fff540a26
> > --- /dev/null
> > +++ b/t/helper/test-repository.c
> > @@ -0,0 +1,88 @@
> > +#include "test-tool.h"
> > +#include "cache.h"
> > +#include "commit-graph.h"
> > +#include "commit.h"
> > +#include "config.h"
> > +#include "object-store.h"
> > +#include "object.h"
> > +#include "repository.h"
> > +#include "tree.h"
> > +
> > +static void test_parse_commit_in_graph(const char *gitdir, const char *worktree,
> > +				       const struct object_id *commit_oid)
> > +{
> > +	struct repository r;
> > +	struct commit *c;
> > +	struct commit_list *parent;
> > +
> > +	/*
> > +	 * Create a commit independent of any repository.
> > +	 */
> > +	c = lookup_commit(commit_oid);
> > +
> > +	repo_init(&r, gitdir, worktree);
> > +
> > +	if (!parse_commit_in_graph(&r, c))
> > +		die("Couldn't parse commit");
> > +
> > +	printf("%lu", c->date);
> 
> 32-bit builds complain about this:
> 
>   t/helper/test-repository.c: In function 'test_parse_commit_in_graph':
>   t/helper/test-repository.c:28:9: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'timestamp_t {aka long long unsigned int}' [-Werror=format=]
>     printf("%lu", c->date);
>          ^
>   cc1: all warnings being treated as errors
>   Makefile:2262: recipe for target 't/helper/test-repository.o' failed
>   make: *** [t/helper/test-repository.o] Error 1

Let's also state how we usually fix this:

	printf("%"PRItime, c->date);

Ciao,
Dscho

[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