Commit graph

41 commits

Author SHA1 Message Date
Ori Bernstein da085a2d4c git/branch: make '-n' use HEAD when '-b' unspecified
This brings the behavior in line with the manual page,
and makes things less surprising for users.
2021-08-13 05:16:50 +00:00
Ori Bernstein 758067ee56 git/export: use 'date -f' instead of 'date -m'
The '-m' flag was added to date largely
to support git scripts. It predates the
tmdate code, which is why it exists, but
it's a recent enough addition that nothing
I'm aware of uses it, other than git.

As a result, it would be good to remove
it, so let's do that.
2021-08-12 14:42:47 +00:00
Ori Bernstein 54993a1f5b git: fix non-interruptible temporary warning
harmless, but annoying.
2021-08-11 15:00:48 +00:00
Ori Bernstein 3909b83a90 git/save: leave submodules unmangled
When modifying a submodule, we would garble the
mode, leading to an apparently dangling object.

This fixes the issue.
2021-08-07 18:01:22 +00:00
Ori Bernstein 70d173bfa4 git/fetch: be more robust
currently, git/fetch prints the refs
to update before it fully fetches the
pack files; this can lead to updates
to the refs before we're 100% certain
that the objects are present.

This change prints the updates after
the packfile has been successfully
indexed.
2021-07-27 15:05:45 +00:00
Ori Bernstein acc504c319 git/fetch: fix overly eager 's/pack/idx/g' in refactor
This would break pulling. We would try to index into
a place that didn't exist.
2021-07-18 14:59:51 +00:00
Ori Bernstein 2204634275 git/fetch: ensure we clean packfiles on failure
When pulling into a git repository that is group
writable as a non-owner, the pack file is left
in place because we do not have permission to
remove it.

We also leave it behind if we bail out early due
to an error, or due to only listing the changes.

This pushes down the creation of the file, and
cleans it up on error.

thanks to Anthony Martin for spotting the bug.
git/fetch: ensure we clean packfiles on failure

When pulling into a git repository that is group
writable as a non-owner, the pack file is left
in place because we do not have permission to
remove it.

We also leave it behind if we bail out early due
to an error, or due to only listing the changes.

This pushes down the creation of the file, and
cleans it up on error.

Also, while we're here, clean up index caching,
and ensure we close the fd in all cases.

thanks to Anthony Martin for spotting the bug.
2021-07-17 00:10:44 +00:00
kvik a0e65ca075 git: create .git/objects/ on git/init 2021-07-06 16:21:18 +00:00
Ori Bernstein 7010ad85c5 git/export: make output pipable to /bin/mail
git/export *almost* produces output that can be
emailed with upas using

	git/export $commit | mail maintainer@site.com

but, the

	From: commit-id date

line that git generates trips it up. Luckily,
'git am' doesn't seem to care much if that line
is missing, so we can simply omit it with no issue.
2021-07-04 20:18:37 +00:00
Ori Bernstein dd7352fd35 git/revert: revert
the old implementation was correct; we want to
mark it dirty and let walk sort it out.
2021-06-29 20:03:26 +00:00
Ori Bernstein ca6058e0e1 git/revert: fix previous commit (helps if you save the file, thanks qwx)
git/revert: fix previous commit (helps if you save the file, thanks qwx)
2021-06-28 23:40:40 +00:00
Ori Bernstein 682aabf9f6 git/branch: mark files we couldn't update as dirty 2021-06-28 18:28:08 +00:00
Ori Bernstein b904edadd8 git/fs: use a better heuristic for permissions.
Since we now store /dist/plan9front in git, the
initial assumption that the owner of the repo
is the person touching it is not always true.

This change gives us a better heuristic for the
file permissions we should have in the files we
copy around, basing it off of the permissions of
the .git directory.
2021-06-22 23:55:54 +00:00
Ori Bernstein 21075859e4 git/revert: handle absolute paths gracefully (thanks deuteron)
when reverting files, absolute paths would get concatenated with
$gitrel; use `cleanname -d` to fix this.
2021-06-21 02:12:58 +00:00
Ori Bernstein eeb0f9a9da git/log: handle absolute paths gracefully.
strip off the repo prefix if the path given
is absolute, and then look up as though it
was rooted in the repo.
2021-06-20 17:07:33 +00:00
Ori Bernstein 1da1ac52d2 git/branch: resolve implicit branch switch before using it
When switching a branch implicitly -- ie, creating a local
branch off of a remote branch -- we would get the list of
changed files before we would resolve the implicit branch
switch, leading to an empty list of changes.
2021-06-16 15:25:02 +00:00
Ori Bernstein 7c3ff53574 git/import: handle mails with line wrapping and mime
git/import expected a patch, however upas/fs serves
either a raw file without any of the mime decoding
and line joining, or a directory, with the headers
and body split out.

This makes it a pain to apply some mails.

So, here we teach git to import upas dirs natively,
making it easy to handle all patches that come in
as emails.
2021-06-15 21:29:22 +00:00
Ori Bernstein 8ab397c23c git/push, git/send: get better about erroring out early
git/push died within a subshell, which prevented the
whole program from exiting, and lead to an incorrect
ref update line that confused people.

git/send would eventually error out, but would push
all the data before that happened; this was annoying.
2021-06-13 12:48:49 +00:00
Ori Bernstein 4aef95e205 git/branch: preserve checked in permissions on branch update
we need to copy the files, and we should copy them with the
permissions that exist in the repo.
2021-06-13 01:20:46 +00:00
Ori Bernstein 73db7a20f7 git/add: clear qid cache as side effect
this is an occasionally useful side effect when
doing surgery on repos, so let's have it.
2021-06-12 14:57:58 +00:00
kemal 09b0eb0d1a git/conf: check in /sys/lib/git/config as a fallback to user-wide config 2021-06-08 20:13:57 +00:00
kvik a859d53145 git/revert: fork the namespace before running git/fs 2021-06-08 20:20:06 +00:00
Ori Bernstein 8aa69e55b6 git: avoid uninterruptible temporary warning
dont' fall into the rathole.
2021-06-06 23:50:45 +00:00
Ori Bernstein d1d5f21992 distproto: sync with hg 2021-06-06 13:21:53 -04:00
Ori Bernstein ce30e785b1 git/branch: diff clean and dirty lists correctly
no spaces in our lists.
2021-06-06 13:07:51 -04:00
Ori Bernstein fb15534c78 git/branch: revert optimization fully
it doesn't help *that* much, and confuses the code.
2021-06-06 13:07:51 -04:00
Ori Bernstein 78d2064a7c git/branch: somewhere in the syncing, the fix for junk files was lost
bring it back.
2021-06-06 13:07:51 -04:00
Ori Bernstein a2a0717c99 git/send: allow the remote to have refs that we don't
It's not fatal for someone else to push a branch
with objects that we don't have. We should deal
with it gracefully, and act as though it doesn't
exist.
2021-06-06 13:07:51 -04:00
Ori Bernstein 74912993de git/commit: allow passing absolute paths
we would treat paths as relative, and not
step past leading '/'s, leading to an infinte
loop.
2021-06-06 13:07:51 -04:00
glenda 706aad3d94 git/branch: merge correct set of files
we were switching branches before we got the full list
of modified files, which could garble what we were trying
to merge.
2021-06-05 18:50:20 +00:00
Ori Bernstein fd9679d97b git: handle absolute paths better
we were catting $gitrel onto absolute paths. stop it.
2021-06-05 13:40:28 +00:00
cinap_lenrek 5a34cc86a8 git: allow local repository directories as remote uri's
This is implemented by checking first if the uri is
a directory containing the .git/ subdirectory.
If this is the case, we fork git/serve serving the
repository on a pipe.
2021-06-04 17:47:26 +02:00
cinap_lenrek 4dd461e440 git/serve: remove undocumented -n namespace option and -r /usr/git default
This makes it easier to serve local repositories where the sandboxing
gets in the way.
2021-06-04 17:44:29 +02:00
Ori Bernstein db5ca0017c git/log: show first commit as file change
We checked if the file was changed from its parents.
If there were no parents, the answer was no, but it
should be yes.
2021-06-03 16:15:16 -07:00
Ori Bernstein b42111117b git/init: create fs dir 2021-05-31 19:30:07 -07:00
Ori Bernstein 1160919f81 git/send: pick minimal delta set correctly (thanks igor)
We weren't giving all objects to the twixt() function, and
it was making bad life choices -- gambling, smoking, drinking,
and packing in too much data.

With more information, it doesn't do the last.
2021-05-31 18:02:23 -07:00
Ori Bernstein f0bb6bbcb7 git/branch: ...all the debug prints. 2021-05-30 19:21:57 -07:00
Ori Bernstein 519ff30098 git/branch: remove debug prints 2021-05-30 19:07:11 -07:00
Ori Bernstein 31fc689ad9 git/branch: reduce execs to sync working dir
We were execing a lot to copy the data -- do less of it.
2021-05-30 19:06:01 -07:00
Ori Bernstein 12e952e684 git/fs: move mount point to $repo/.git/fs
Moving the mount point to within the repo
directory means that we can have multiple
git repos mounted at once with no conflict.
2021-05-30 17:46:21 -07:00
Ori Bernstein 1ee1bfaa8c git: got git?
Add a snapshot of git9 to 9front.
2021-05-16 18:49:45 -07:00