Commit Briefs

b16893ba28 Thomas Adam

add some helper functions to compute hashes

This adds a set of functions to abstract over SHA1Init, SHA1Update, SHA1Final, their respective SHA256 variants and how to compare digests. Replace all the SHA1*() usage with the new APIs. It's a preparatory step for sha256 handling. ok stsp@


98670ba726 Thomas Adam

portable: rework SHA detection

Simply the SHA detection by not predicating on libcrypto, but instead checking individual header files.


4680f70435 Thomas Adam

portable: remove sha1.h; found portably

Remove sha1.h as this is found portably across systems.


be288a59f4 Thomas Adam

rename lib/sha1.c to lib/hash.c

It will soon grow functions to deal with sha256 too. stsp@ agrees.


588a8092bc Thomas Adam

include sha2.h too where sha1.h is included

In preparation for wide sha256 support; stsp@ agrees. Change done mechanically with find . -iname \*.[cy] -exec sam {} + X ,x/<sha1\.h>/i/\n#include <sha2.h>


25b84e6cea Thomas Adam

lib/object_create.c: calloc object ids

future fields added to the got_object_id will be implicitly zeroed instead of gibberish. ok stsp@


fc2a50f289 Thomas Adam

use mkstemps(3) instead of mkstemp(3) for opening named temporary files

Allows 'got commit' to use a ".diff" suffix for temporary diff files. ok op@


f57ea9f3db Thomas Adam

don't create signed tag objects with trailing NUL

Although Git itself did not care, the superfluous NUL at the end of the tag object was breaking GitHub's SSH signature detection. ok stsp@


717a78d4f8 Thomas Adam

fix snprintf error handling

follow the "proper secure idiom" described in the CAVEATS section of printf(3). reminded by tb@ and millert@


f2c54bde77 Thomas Adam

Prevent memory leak when asprintf fails.

Found by llvm's scan-build. OK stsp


8b925c6ccd Thomas Adam

portable: add back sys/queue.h

Now that the handling of including sys/queue.h is better, there's no need to remove those lines from the source. Copy the location of those original sys/queue.h lines from upstream at the same line number, so as to avoid any conflicts in the future.


3cb9337907 Thomas Adam

fix pipe usage for linux

This uses the correct read and write ends of the fds returned by pipe(2) on linux. It also moves away from creating FILE* streams with fdopen and reading the stream with buf_load (which performs a fstat, and breaks due to a zero length file size on linux) by instead reading from the fd itself. Reported by abieber@, with assistance from stsp@ ok stsp@


d5775a924f Thomas Adam

portable: object_create: remove sys/queue.h

This is included portably.


64313a9ca0 Thomas Adam

fix tag signing when the key file does not exist

This should fail without creating any tag. Before, ssh-keygen(1) would print an error to stderr, but got would create an unsigned tag. ok op@


871bd03807 Thomas Adam

create and verify tags signed by SSH keys

This adds a new -s flag to 'got tag' that specifies the signer identity (for example, a key file) of the tagger. The tag object will include a signature that validates each of the tag object headers and the tag message. Verifying these signed tags requires maintaining an allowed signers file which maps signer identities (i.e. the email address of the tagger) to SSH public keys. See ssh-keygen(1) for more details of the allowed signers file. After creating this file and providing the path to it in got.conf(5) using the allowed_signers option, tags may be verified using with 'got tag -V tag_name'. The return code will be non-zero if a signature fails to verify. ok stsp@


ef20f54204 Thomas Adam

build with -Wmissing-prototypes

ok stsp@


ec242592d3 Thomas Adam

inline struct got_object_id in struct got_object_qid

Saves us from doing a malloc/free call for every item on the list. ok op@



0634062147 Thomas Adam

add O_CLOEXEC (close-on-exec) flag to open(2) calls

suggested by millert ok thomas_adam


dced00381a Thomas Adam

remove outdated comment


3dc1dc04a5 Thomas Adam

for portability, handle errno variations upon open(2) failure with O_NOFOLLOW

Problem pointed out by naddy for FreeBSD -portable. Discussed with millert, thomas adam, and naddy.


92a9e85d28 Thomas Adam

portable: add FreeBSD support

This adds the capability to compile got-portable on FreeBSD.


10604dce6e Thomas Adam

add a 'got merge' command for creating merge commits

Additional testing by Thomas Adam. ok tracey


dd038bc6ec Thomas Adam

portable: initial Linux compilation

This commit modifies the GoT main branch to be able to compile it under linux.