summaryrefslogtreecommitdiff
path: root/sys/src/cmd/git
AgeCommit message (Collapse)Author
2021-12-05git: improve pack cache heuristicsOri Bernstein
the pack cache was very stupid: it would close packs as early as possible, which would prevent packs from getting reused effectively. It would also select a bad pack to close. This picks the oldest pack, refcounts correctly, and keeps up to Npackcache open at once (though it will go over if more are in use).
2021-11-04git/revert: fix empty invocationKyle Milz
git/revert requires a file name argument, but when none is given it fails in a strange way: % git/revert usage: cleanname [-d pwd] name... /bin/git/revert:15: null list in concatenation
2021-10-28git/pack: check pf->pack for nil before Bterming itSigrid Solveig Haflínudóttir
2021-10-24git/serve: one more silencing of non-interactive printsOri Bernstein
2021-10-24git/serve: don't show progress when not interactiveOri Bernstein
this prevents console spam
2021-09-14git: when stealing from the old packs list, keep what we stole.Ori Bernstein
we were missing a return after stealing, which killed the point of doing the theft.
2021-09-11git/query: fix spurious merge requestsOri Bernstein
Due to the way LCA is defined, a using a strict LCA on a graph like this: <--a--b--c--d--e--f--g \ / +-----h------- can lead to spurious requests to merge. This happens because 'lca(b, g)' would return 'a', since it can be reached in one step from 'b', and 2 steps from 'g', while reaching 'b' from 'a' would be a longer path. As a result, we need to implement an lca variant that returns the starting node if one is reachable from the other, even if it's already found the technically correct least common ancestor. This replaces our LCA algorithm with one based on the painting we do while finding a twixt, making it give the resutls we want. git/query: fix spurious merge requests Due to the way LCA is defined, a using a strict LCA on a graph like this: <--a--b--c--d--e--f--g \ / +-----h------- can lead to spurious requests to merge. This happens because 'lca(b, g)' would return 'a', since it can be reached in one step from 'b', and 2 steps from 'g', while reaching 'b' from 'a' would be a longer path. As a result, we need to implement an lca variant that returns the starting node if one is reachable from the other, even if it's already found the technically correct least common ancestor. This replaces our LCA algorithm with one based on the painting we do while finding a twixt.
2021-09-03git: separate author and committerOri Bernstein
Git has the ability to track the person who creates a commit separately from the person who wrote the commit. For git9, we ignored this feature. However, as we start using git/import more, it will be useful to figure out who imported a commit, as well as who wrote it. This change adds support for seeing this information in git, as well as setting the author and committer separately in git/import.
2021-08-25git/serve: add a '\n' after HEADOri Bernstein
Per the docs: the sender SHOULD include a LF, but the receiver MUST NOT complain if it is not present. I typoed away the SHOULD, and got missed the MUST NOT. thanks qbit.
2021-08-25git/compat: add support for ls-remote [-d]Ori Bernstein
This is used by 'go get' sometimes, so add it.
2021-08-23git/diff: clean up diffsOri Bernstein
We were overzealous about showing the changed header, as well as setting a junk variable for files that didn't exist; fix both.
2021-08-23git/commit: remove trailing 'subst -g'Ori Bernstein
the subst utility no longer supports a '-g' flag, but this was left behind in commit; this means that the lines listing modified files were not correctly commented in the commit header. This is mostly harmless, but when using an editor like sam to edit the commit message, the modified lines would have to be removed manually.
2021-08-22git/{diff,import}: make it easier to handle manually-asembled patch emailsori@eigenstate.org
Often, people (including myself) will write emails that can almost be applied with git/import. This changes git/diff and git/import so that things will generally work even when assembling diffs by hand: 1. git/import becomes slightly more lax: ^diff ... ^--- ... will both be detected as the start of a patch. 2. git/diff produces the same format of diff as git/export, starting with paths: --- a/path/to/file +++ b/path/to/file which means that the 'ape/patch -p1' used within git/import will just work. So with this, if you send an email to the mailing list, write up a committable description, and append the output of git/diff to the end of the email, git/import should just work. [this patch was send through the mailing list using the above procedure, and will be committed with git/import to verify that it works as advertised]
2021-08-17git: better handling of absolute paths, regex metacharsOri Bernstein
Git currently gets a bit confused if you try to manipulate files by absolute path. There were also a number of places where user-controlled file paths ended up getting passed to regex interpretation, which could confuse things. This change mainly does 2 things: - Adds a 'drop' function which drops a non-regex prefix from a string, and uses that to manipulate paths, simplifies 'subst', and removes 'subst -g', which was only used with fixed regexes; sed does this job fine. - When getting a path from a user, we make it absolute and then strip out the head Along the way it cleans up a couple of stupids: - 'for(f in $list) if(! ~ $#f 0) use $f: $f can't be a nil list because of list flattening. - removes a useless substitution here: all=`$nl{{git/query -c $1 $2; git/query -c $2 $3} | sed 's/^..//' | \ gsubst '^('$ourbr'|'$basebr'|'$theirbr')/*' | sort | uniq} where git/query -c doesn't produce paths prefixed with the query.
2021-08-13git/branch: make '-n' use HEAD when '-b' unspecifiedOri Bernstein
This brings the behavior in line with the manual page, and makes things less surprising for users.
2021-08-12git/export: use 'date -f' instead of 'date -m'Ori Bernstein
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-11git: fix non-interruptible temporary warningOri Bernstein
harmless, but annoying.
2021-08-07git/save: leave submodules unmangledOri Bernstein
When modifying a submodule, we would garble the mode, leading to an apparently dangling object. This fixes the issue.
2021-07-27git/fetch: be more robustOri Bernstein
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-18git/fetch: fix overly eager 's/pack/idx/g' in refactorOri Bernstein
This would break pulling. We would try to index into a place that didn't exist.
2021-07-17git/fetch: ensure we clean packfiles on failureOri Bernstein
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-06git: create .git/objects/ on git/initkvik
2021-07-04git/export: make output pipable to /bin/mailOri Bernstein
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-06-29git/revert: revertOri Bernstein
the old implementation was correct; we want to mark it dirty and let walk sort it out.
2021-06-28git/revert: fix previous commit (helps if you save the file, thanks qwx)Ori Bernstein
git/revert: fix previous commit (helps if you save the file, thanks qwx)
2021-06-28git/branch: mark files we couldn't update as dirtyOri Bernstein
2021-06-22git/fs: use a better heuristic for permissions.Ori Bernstein
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-21git/revert: handle absolute paths gracefully (thanks deuteron)Ori Bernstein
when reverting files, absolute paths would get concatenated with $gitrel; use `cleanname -d` to fix this.
2021-06-20git/log: handle absolute paths gracefully.Ori Bernstein
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-16git/branch: resolve implicit branch switch before using itOri Bernstein
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-15git/import: handle mails with line wrapping and mimeOri Bernstein
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-13git/push, git/send: get better about erroring out earlyOri Bernstein
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-13git/branch: preserve checked in permissions on branch updateOri Bernstein
we need to copy the files, and we should copy them with the permissions that exist in the repo.
2021-06-12git/add: clear qid cache as side effectOri Bernstein
this is an occasionally useful side effect when doing surgery on repos, so let's have it.
2021-06-08git/conf: check in /sys/lib/git/config as a fallback to user-wide configkemal
2021-06-08git/revert: fork the namespace before running git/fskvik
2021-06-06git: avoid uninterruptible temporary warningOri Bernstein
dont' fall into the rathole.
2021-06-06distproto: sync with hgOri Bernstein
2021-06-06git/branch: diff clean and dirty lists correctlyOri Bernstein
no spaces in our lists.
2021-06-06git/branch: revert optimization fullyOri Bernstein
it doesn't help *that* much, and confuses the code.
2021-06-06git/branch: somewhere in the syncing, the fix for junk files was lostOri Bernstein
bring it back.
2021-06-06git/send: allow the remote to have refs that we don'tOri Bernstein
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-06git/commit: allow passing absolute pathsOri Bernstein
we would treat paths as relative, and not step past leading '/'s, leading to an infinte loop.
2021-06-05git/branch: merge correct set of filesglenda
we were switching branches before we got the full list of modified files, which could garble what we were trying to merge.
2021-06-05git: handle absolute paths betterOri Bernstein
we were catting $gitrel onto absolute paths. stop it.
2021-06-04git: allow local repository directories as remote uri'scinap_lenrek
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-04git/serve: remove undocumented -n namespace option and -r /usr/git defaultcinap_lenrek
This makes it easier to serve local repositories where the sandboxing gets in the way.
2021-06-03git/log: show first commit as file changeOri Bernstein
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-05-31git/init: create fs dirOri Bernstein
2021-05-31git/send: pick minimal delta set correctly (thanks igor)Ori Bernstein
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.