Commits
- Commit:
1b3e8e8674ebd24834b549a70d90487307d0f3bf
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
use sub-second precision when checking for objects/pack/ modification
Convert from st.m_time (second-precision time_t) to st.m_tim (struct timespec).
To compensate for the potential case where a filesystem provides resolution
in seconds only, always read the directory if no pack files are known to exist.
Otherwise, there is a race condition when gotd repo_write creates a new pack
and a request arrives for repo_read shortly after. Caught by a regression test
for gotd on empty repositories. Test failure pointed out by Mikhail.
ok op@
- Commit:
758dc042e8fc2399dc58d96ce6d80b4a0adf4705
- From:
- Josiah Frentsos <jfrent@tilde.team>
- Via:
- Stefan Sperling <stsp@stsp.name>
- Date:
remove trailing whitespace; patch by Josiah Frentsos
- Commit:
5753b4a9eb064cbf57b2a9299ad7bdc4a53efecb
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
respect resource limit for number of open files when sizing the pack file cache
ok op@
- Commit:
1c28a36116110db5de40e6edf09887651f3ca37b
- From:
- Omar Polo <op@omarpolo.com>
- Date:
check size before calling mmap(2)
It's only a preparatory step, as checking whether a size_t is less than
SIZE_MAX is moot. In a follow-up commit, however, the `filesize' field
of the struct got_pack will become off_t and these checks will kick in.
This also makes consistent how we guard mmap(2) against empty files.
ok and improvements stsp@
- Commit:
13b2bc374c1870ec27b2eeb40efe68fd465f64bb
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
introduce gotd(8), a Git repository server reachable via ssh(1)
This is an initial barebones implementation which provides the absolute
minimum of functionality required to serve got(1) and git(1) clients.
Basic fetch/send functionality has been tested and seems to work here,
but this server is not yet expected to be stable.
More testing is welcome. See the man pages for setup instructions.
The current design uses one reader and one writer process per repository,
which will have to be extended to N readers and N writers in the future.
At startup, each process will chroot(2) into its assigned repository.
This works because gotd(8) can only be started as root, and will then
fork+exec, chroot, and privdrop.
At present the parent process runs with the following pledge(2) promises:
"stdio rpath wpath cpath proc getpw sendfd recvfd fattr flock unix unveil"
The parent is the only process able to modify the repository in a way
that becomes visible to Git clients. The parent uses unveil(2) to
restrict its view of the filesystem to /tmp and the repositories
listed in the configuration file gotd.conf(5).
Per-repository chroot(2) processes use "stdio rpath sendfd recvfd".
The writer defers to the parent for modifying references in the
repository to point at newly uploaded commits. The reader is fine
without such help, because Git repositories can be read without
having to create any lock-files.
gotd(8) requires a dedicated user ID, which should own repositories
on the filesystem, and a separate secondary group, which should not
have filesystem-level repository access, and must be allowed access
to the gotd(8) socket.
To obtain Git repository access, users must be members of this
secondary group, and must have their login shell set to gotsh(1).
gotsh(1) connects to the gotd(8) socket and speaks Git-protocol
towards the client on the other end of the SSH connection.
gotsh(1) is not an interactive command shell.
At present, authenticated clients are granted read/write access to
all repositories and all references (except for the "refs/got/" and
the "refs/remotes/" namespaces, which are already being protected
from modification).
While complicated access control mechanism are not a design goal,
making it possible to safely offer anonymous Git repository access
over ssh(1) is on the road map.
- Commit:
1af8800025bf22cf87cde038bbcfda0d2564eefc
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
refresh cached list of pack index paths while searching a packed object
Previously, this list was only refreshed while trying to match an object
ID prefix. Regular pack file access needs to refresh this list, too.
In particular, future gotd(8) needs this to ensure that newly uploaded
packfiles are picked up as expected.
- Commit:
6a800804535a75203abfb3708e68a661c1c89958
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
move code for reading Git's config file into new file read_gitconfig_privsep.c
The end goal here is to remove the dependency of repository.c on privsep.c
during compilation.
- Commit:
6f04a73d17761092a3a7ab07632cd1a89d4bfd21
- From:
- Mark Jamsek <mark@jamsek.dev>
- Date:
add gotadmin init -b <branch> to specify repo head ref
Similar to `git init -b`. Includes a change to `got import` behaviour such that
"main" is no longer hardcoded by default; instead, we import to the branch
resolved via the repository's HEAD reference unless `got import -b` is used,
and only if HEAD cannot be resolved to a branch do we fallback to "main".
includes fix plus ok from stsp@
- Commit:
8ee99f946108c3442fcc98fa53ecc9264ed5d947
- From:
- Omar Polo <op@omarpolo.com>
- Date:
free the return of got_repo_get_path_objects{,_pack}
- Commit:
6f711b103fc86abf1cc94d145c48c5a927f01527
- From:
- Omar Polo <op@omarpolo.com>
- Date:
plug mem leak in got_repo_pack_fds_open
pack_fds_tmp is not always free'd. However, while here, simplify it to
not use a temporary array.
ok stsp@
- Commit:
5d22ea52df30acf1895cb703d770514a2154b5ae
- From:
- Omar Polo <op@omarpolo.com>
- Date:
plug a leak in match_loose_object
in the loop of match_loose_object we allocate a string per directory
entry that in some case it was free(3)'d before `continue' or `goto',
but not always. Instead, use a more common idiom.
ok stsp@
- Commit:
b8a4401b8e46c0a32b824433c648ea749898616b
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
refresh our pack-index path list if the mtime of objects/pack has changed
ok op@
- Commit:
794662a4547b17c0243addf37d330d39e0eb5662
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
don't leak memory allocated internally by bloom filters; ok jamsek
- Commit:
5e91dae4dd43b8024731223110ab18f505f453ac
- From:
- Josiah Frentsos <jfrent@tilde.team>
- Via:
- Stefan Sperling <stsp@stsp.name>
- Date:
remove trailing whitespace; patch by Josiah Frentsos
- Commit:
4fa16b393ac52eadd8159d265e31961b11a10a25
- From:
- Omar Polo <op@omarpolo.com>
- Date:
read_gitconfig: fix GOT_IGNORE_GITCONFIG case
set gitconfig_remotes to NULL to avoid a double-free, and reset the
global author name/email fields too.
ok stsp@
- Commit:
3e0f95fc704e82b2b916e10c016299e1b49e8383
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
add a way to ignore author and remote repository info found in Git config files
ok op@
- Commit:
6f748833062c683ec23808460f4bb67bd18693e3
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
comment tweak
- Commit:
0c41134356d52f1dd4db38637202364533f43866
- From:
- Lucas <lucas@sexy.is>
- Via:
- Stefan Sperling <stsp@stsp.name>
- Date:
got_repo_pack_fds_close: don't close(0)
got_repo_pack_fds_close will try to close all of the GOT_PACK_NUM_TEMPFILES fds,
even the ones that didn't manage to get a value from got_opentempfd(), which
would result in a close(0) if we do not initialize to -1 here.
- Commit:
f97edf0cbcf2ee1ea1d71a162699f0be79bd0400
- From:
- Florian Obser <florian@narrans.de>
- Date:
Make sure got_repo_pack_fds_close() frees a malloc'ed pointer.
Found by llvm's scan-build (bad free).
OK stsp
- Commit:
b5d22c386422ab4e29e05d887089fae7e446e40b
- From:
- Florian Obser <florian@narrans.de>
- Date:
Don't chug along if repo format version is unsupported.
Found by llvm's scan-build (dead store).
OK stsp
- Commit:
61af9b215c06bece11deb27d941b390b81e0f8c6
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
implement support for commit coloring in got-read-pack for speed
ok op, tracey
- Commit:
d188eb1946acd5671794bb6cbdd256d7b962a669
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
remove pointless assignment at the end of got_repo_pack_fds_close()
- Commit:
bb711527a87bef0fc809a71d53e9bc2dad28150d
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
don't look for close() errors if opentemp() failed in got_repo_pack_fds_open()
- Commit:
0ae84acc1f0a0584e4f26ccbe029c895043b3abe
- From:
- Tracey Emery <tracey@traceyemery.net>
- Date:
move got_opentempfd out of got_repo_open. ok stsp@
thanks for all the help massaging this diff
- Commit:
6a881297759a4b3c4f62093aef5fdbaad0dae8df
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
properly swap cached struct pack array elements in got_repo_cache_pack()
Avoids clobbering open files for delta base/accumulation, leaking file
descriptors, and triggering errors from close(2) during got_repo_close()
as we try to close the same file descriptor more than once.