aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* plumbing: transport/ssh, auto-populate ClientConfig.HostKeyAlgorithms. Fixes ↵Evan Elias2022-09-224-25/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | #411 This commit adjusts the transport/ssh logic in command.connect(), so that it now auto-populates ssh.ClientConfig.HostKeyAlgorithms. The algorithms are chosen based on the known host keys for the target host, as obtained from the known_hosts file. In order to look-up the algorithms from the known_hosts file, external module github.com/skeema/knownhosts is used. This package is just a thin wrapper around golang.org/x/crypto/ssh/knownhosts, adding an extra mechanism to query the known_hosts keys, implemented in a way which avoids duplication of any golang.org/x/crypto/ssh/knownhosts logic. Because HostKeyAlgorithms vary by target host, some related logic for setting HostKeyCallback has been moved out of the various AuthMethod implementations. This was necessary because the old HostKeyCallbackHelper is not host-specific. Since known_hosts handling isn't really tied to AuthMethod anyway, it seems reasonable to separate these. Previously-exported types/methods remain in place for backwards compat, but some of them are now unused. For testing approach, see pull request. Issue #411 can only be reproduced via end-to-end / integration testing, since it requires actually launching an SSH connection, in order to see the key mismatch error triggered from https://github.com/golang/go/issues/29286 as the root cause.
* minor grammatical fixesJon Eskin2022-09-227-12/+12
|
* all: replace go-homedir with os.UserHomeDirDaniel Martí2022-05-294-12/+7
| | | | Added in Go 1.12, this means we need one less dependency.
* plumbing: packp, Avoid duplicate encoding when overriding a Capability ↵Tyler Christensen2022-05-012-1/+14
| | | | | | | | | value. (#521) Previously, calling `Set($CAPABILITY, ...)` on a `capability.List` where `$CAPABILITY` was already present would correctly replace the existing value of that capability, but would also result in that capability being listed twice in the internal `l.sort` slice. This manifested publicly when the `List` was encoded as the same capability appearing twice with the same value in the encoded output.
* Worktree: use syscall.Timespec.Unix #437 Tobias Klauser2022-04-093-3/+3
| | | | Use the syscall method instead of repeating the type conversions for the syscall.Stat_t Atim/Atimespec/Ctim members.
* Merge pull request #475 from michenriksen/revision-fix-endless-loopMáximo Cuadros2022-02-242-2/+9
|\ | | | | revision: fix endless looping in revision parser
| * revision: fix endless looping in revision parserMichael Henriksen2022-02-192-2/+9
|/ | | | | | | | | | | Fixes a bug in the revision parser which caused an endless loop when parsing revisions with opening braces "{" but no closing braces "}". Example bad revisions: - ^{/ - ~@{ - @@{{0
* Repository: don't crash accessing invalid pathinfo (#443)Christian Muehlhaeuser2022-01-192-0/+8
| | | | | | | | | | | | | When fs.Stat returns an error, pathinfo may be nil. In such situations the only safe response seems to be to return the error to the caller. Without this fix, accessing pathinfo.IsDir() below would lead to a crash dereferencing a nil pointer. This crash can be reproduced by trying to initialize a Git repo with an invalid path name. Also see: https://github.com/muesli/gitty/issues/36
* plumbing: protocol/pakp, update agent Carlos Alexandro Becker2022-01-194-5/+5
| | | Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
* pumbling: packfile, resolve external reference deltaMáximo Cuadros2022-01-085-4/+30
|\ | | | | fix: resolve external reference delta
| * remove packfile and align to test fixturespaul.t2022-01-055-7/+8
| |
| * Merge branch 'master' into codecommit-ref-deltapaul.t2021-12-1550-155/+496
| |\
| | * Merge branch 'go-git:master' into masterPaul T2021-12-1556-191/+958
| | |\ | |_|/ |/| |
* | | Merge pull request #425 from abhinav/error-stringsMáximo Cuadros2021-12-1112-19/+19
|\ \ \ | | | | | | | | error strings: Don't capitalize, use periods, or newlines
| * | | Fix repository_testAbhinav Gupta2021-12-101-1/+1
| | | | | | | | | | | | | | | | The test verifies the exact error message.
| * | | error strings: Don't capitalize, use periods, or newlinesAbhinav Gupta2021-12-0411-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per [Go Code Review Comments][1], > Error strings should not be capitalized (unless beginning with proper > nouns or acronyms) or end with punctuation staticcheck's [ST1005][2] also complains about these. For example, ``` object_walker.go:63:10: error strings should not be capitalized (ST1005) object_walker.go:101:10: error strings should not be capitalized (ST1005) object_walker.go:101:10: error strings should not end with punctuation or a newline (ST1005) plumbing/format/commitgraph/file.go:17:26: error strings should not be capitalized (ST1005) ``` This fixes all instances of this issue reported by staticcheck. [1]: https://github.com/golang/go/wiki/CodeReviewComments#error-strings [2]: https://staticcheck.io/docs/checks/#ST1005
* | | | Merge pull request #418 from abhinav/unusedMáximo Cuadros2021-12-1022-94/+14
|\ \ \ \ | | | | | | | | | | Remove unused vars/types/funcs/fields
| * | | | remote/addReachableTags: Remove guard before deleteAbhinav Gupta2021-11-271-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The membership check before attempting to `delete` from the `tags` map is unnecessary because the operation is a no-op if the item does not already exist in the map.
| * | | | transactional/ReferenceStorage: Drop packRefs fieldAbhinav Gupta2021-11-271-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The packRefs field is unused. It is assigned to true from the `PackRefs()` method, but because the method is not on the pointer type, the assignment has no effect. var st ReferenceStorage fmt.Println(st.packRefs) // false st.PackRefs() fmt.Println(st.packRefs) // false Delete the unused field.
| * | | | storage/transactional: Use correct config in testAbhinav Gupta2021-11-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `cfg` loaded from `cs.Config` was unused. It looks like this assertion intended to validate that, not `temporalCfg`, which was already checked above this block.
| * | | | Remove unused variables/types/functionsAbhinav Gupta2021-11-2720-85/+12
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | [staticcheck](https://staticcheck.io/) reported a number of unused fields, functions, types, and variables across the code. Where possible, use them (assert unchecked errors in tests, for example) and otherwise remove them.
* | | | Merge pull request #406 from john-cai/jc-push-atomicMáximo Cuadros2021-12-103-0/+26
|\ \ \ \ | | | | | | | | | | Remote: Push, add atomic to push options
| * \ \ \ Merge branch 'master' into jc-push-atomicMáximo Cuadros2021-12-1025-42/+438
| |\ \ \ \ | |/ / / / |/| | | |
* | | | | Merge pull request #410 from john-cai/jc-sparseMáximo Cuadros2021-12-1014-10/+160
|\ \ \ \ \ | | | | | | | | | | | | Worktree: Checkout, simplified sparse checkout
| * | | | | simplified sparse checkoutJohn Cai2021-11-0914-10/+160
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the initial logic to support a simple sparse checkout where directories to be included can be specified in CheckoutOptions. This change doesn't fully support the sparse patterns, nor does this change include the optimization to collapse flie entries in ithe index that are excluded via the sparse checkout directory patterns included under the parent directory.
* | | | | Merge pull request #409 from ninedraft/branch-descriptionMáximo Cuadros2021-12-103-3/+42
|\ \ \ \ \ | | | | | | | | | | | | config: add branch description support
| * | | | | config: describe reason for custom quote functionsmerlin2021-11-081-0/+10
| | | | | |
| * | | | | config: add tests for branch desc marshaling and unmarshalingmerlin2021-11-081-3/+8
| | | | | |
| * | | | | config: add support for branch descriptionmerlin2021-11-082-0/+24
| | | | | |
* | | | | | Merge pull request #404 from john-cai/jc-force-with-leaseMáximo Cuadros2021-12-103-6/+179
|\ \ \ \ \ \ | | | | | | | | | | | | | | Remote: Push, add ForceWithLease Push Option
| * | | | | | Add ForceWithLease Push OptionJohn Cai2021-11-023-6/+179
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --force-with-lease allows a push to force push with some safety measures. If the ref on the remote is what we expect, then the force push is allowed to happen. See https://git-scm.com/docs/git-push#Documentation/git-push.txt---force-with-leaseltrefnamegt for more information
* | | | | | Merge pull request #420 from abhinav/packp-action-typeMáximo Cuadros2021-12-101-3/+3
|\ \ \ \ \ \ | | | | | | | | | | | | | | packp: Actions should have type Action
| * | | | | | packp: Actions should have type ActionAbhinav Gupta2021-11-271-3/+3
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per the [Go Spec](https://go.dev/ref/spec#Constant_declarations), the following yields the type `Action` for `Bar` and `Baz` only if there is no `=`. const ( Foo Action = ... Bar Baz ) The following has the type `Action` for the first item, but not the rest. Those are untyped constants of the corresponding type. const ( Foo Action = ... Bar = ... Baz = ... ) This means that `packp.{Update, Delete, Invalid}` are currently untyped string constants, and not `Action` constants as was intended here. This change fixes these.
* | | | | | storage: filesystem, switch from os.SEEK_* to io.Seek* (#421)Abhinav Gupta2021-12-102-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `os.SEEK_*` constants have been deprecated since Go 1.7. It is now recommended to use the equivalent `io.Seek*` constants. Switch `os.SEEK_CUR` to `io.SeekCurrent`, and `os.SEEK_SET` to `io.SeekStart`.
* | | | | | examples: remote fix typo (#408)NeP2021-12-101-1/+1
|/ / / / /
* | | | | Merge pull request #407 from john-cai/jc-support-index-v3Máximo Cuadros2021-11-082-14/+46
|\ \ \ \ \ | |/ / / / |/| | | | plumbing: format, support v3 index
| * | | | Support v3 indexJohn Cai2021-11-052-14/+46
|/ / / / | | | | | | | | | | | | | | | | | | | | Currently the index encoder does not support the v3 index format. This change adds support to the encoder. This helps to unlock sparse checkout.
| * / / Add Atomic to push optionsJohn Cai2021-11-033-0/+25
|/ / / | | | | | | | | | | | | | | | push --atomic allows a push to succeed or fail atomically. If one ref fails, the whole push fails. This commit allows the user to set Atomic as an option for a push.
| | * resolve external reference deltaspaul.t2021-10-111-0/+11
| | |
| * | include example codecommit pack filepaul.t2021-11-091-0/+0
| | |
| * | add codecommit packfile for testing external ref resolutionpaul.t2021-11-091-0/+14
| | |
| * | Merge branch 'go-git:master' into codecommit-ref-deltaPaul T2021-11-0214-43/+469
| |\ \ | |/ / |/| |
* | | Merge pull request #399 from S-Bohn/add-push-optionsMáximo Cuadros2021-11-015-1/+62
|\ \ \ | | | | | | | | Remote: PushOptions add push-options
| * | | plumbing: packp, Add encoding for push-options. Fixes #268.Sören Bohn2021-10-265-1/+62
| | | | | | | | | | | | | | | | go-git: Add field `Options` to `PushOptions`, wire functionality.
* | | | Merge pull request #325 from tjamet/push/shaMáximo Cuadros2021-11-013-2/+141
|\ \ \ \ | | | | | | | | | | Remote: Push, add support to push commits per hashes
| * | | | Document the push refspec formatThibault Jamet2021-10-281-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Taken from `git help push` and adapted to match the supported features only. Future iterations of this feature may include better support for git "SHA-1 expression", documented in `git help push` as: > any arbitrary "SHA-1 expression", such as master~4 or HEAD (see gitrevisions(7)).
| * | | | Add support to push commits per hashesThibault Jamet2021-10-282-0/+133
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using plain git, the command `git push ${sha}:refs/heads/some-branch` actually ensures that the remote branch `some-branch` points to the commit `${sha}`. In the current version of go-git, this results in an "everything is up to date" error. When a source reference is not found, check the object storage to find the sha. If it is found, consider pushing this exact commit. fixes: #105
* | | | Merge pull request #402 from enisdenjo/gitdir-info-excludeMáximo Cuadros2021-11-012-12/+30
|\ \ \ \ | | | | | | | | | | plumbing: gitignore, Read .git/info/exclude file too.
| * | | | better testsenisdenjo2021-10-271-39/+9
| | | | |
| * | | | plumbing: gitignore, Read .git/info/exclude file too.enisdenjo2021-10-272-10/+58
| |/ / /