Re: [PATCH 05/11] Add a library function to add an alternate to the alternates file

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

 



On Sun, 9 Mar 2008, Johannes Schindelin wrote:

> Hi,
> 
> On Sat, 8 Mar 2008, Daniel Barkalow wrote:
> 
> 
> > +void add_to_alternates_file(const char *reference)
> > +{
> > +	char *file;
> > +	char *alt;
> > +	int fd;
> > +
> > +	file = mkpath("%s/objects/info/alternates", get_git_dir());
> > +	fd = open(file, O_CREAT | O_WRONLY | O_APPEND, 0666);
> > +	if (fd < 0)
> > +		die("failed to create %s", file);
> 
> Even with alternates, which are probably written only rarely, I would have 
> expected a lockfile procedure (if only to be consistent with the rest).

That's a good idea; I started with this inside clone, where you can be 
pretty certain not to get contention (and the shell version is using >> to 
update it), but in the library the lockfile is the right thing to do, so 
that other code can use it safely.

	-Daniel
*This .sig left intentionally blank*
--
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