| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
<file>..." command
Small formatting and style fixes before rebasing against master
Setup args for restore in TestExamples
Fix typo in error message and remove dependency on fmt in worktree_test
|
|\
| |
| | |
git: Add commit validation for Reset
|
| |
| |
| |
| | |
Signed-off-by: Paulo Gomes <paulo.gomes@suse.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Introduces the Merge function for merging branches in the codebase.
Currently, the function only supports FastForwardMerge strategy, meaning it
can efficiently update the target branch pointer if the source branch history
is a linear descendant.
Support for additional merge strategies (e.g., three-way merge) will be added
in future commits.
Signed-off-by: Paulo Gomes <paulo.gomes@suse.com>
|
|/
|
|
|
|
| |
Add a Merge function that behaves like git merge. This is a first
iteration that only supports --ff-only, which is the simplest type of
merge.
|
|
|
|
| |
Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
crypto.Signer was incorrectly used before. Signer documentation says
that Signer.Sign should be used on digests, whereas we were using this
on message bodies.
To fix this, create our own Signer interface (+ signableObject borrowed
from #705) that describes more accurately what we want.
As before, the expectation is that signer implementations only need to
worry about acting on encoded message bodies rather than needing to
encode objects themselves.
This is technically a breaking change from the previous Signer
implementation, but since this is new and hasn't made it into cut
release yet, this seems like an acceptible change.
Also adds example test showing how signers can be made (uses base64 for
consistent outputs).
|
|\
| |
| | |
Worktree.AddWithOptions: add skipStatus option when providing a specific path
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds a new crypto.Signer option to CommitOptions as an
alternative to SignKey to allow alternative commit signers to be used.
This change byitself does not add other signing methods (e.g. ssh,
x509, gitsign), but gives callers the ability to add their own.
This roughly follows git's sign_buffer approach where go-git handles the
commit message body encoding, and hands off the encoded []byte to the signing
implementation for the signature to be returned.
Signed-off-by: Billy Lynch <billy@chainguard.dev>
|
|
|
|
|
|
|
| |
Allow checking out a worktree using a tag hash id.
Fixes: https://github.com/go-git/go-git/issues/959
Supersedes: https://github.com/go-git/go-git/pull/964
|
| |
|
| |
|
|
|
|
| |
Refactor `PlainInit` to call `PlainInitWithOptions`
|
|\ |
|
| |\
| | |
| | | |
git: add a clone option to allow for shallow cloning of submodules
|
| | |
| | |
| | |
| | |
| | | |
This option matches the git clone option --shallow-submodules.
https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---no-shallow-submodules
|
| |/
| |
| |
| |
| |
| |
| | |
The previous hard-coded 10 second value is too short for listing large
repositories like https://gitlab.com/gitlab-org/gitlab
Return an error on nonsensical subzero timeout values
|
| |\
| | |
| | | |
git: Add Depth to SubmoduleUpdateOptions
|
| | | |
|
| | |
| | |
| | |
| | | |
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
A new PeelingOption field was introduced into ListOptions. The new options
include the default (and backwards compatible) IgnorePeeled. Plus another
two variations which either only returns peeled references (OnlyPeeled), or
append peeled references to the list (AppendPeeled).
The ls-remote example was updated to align with upstream, in which peeled
references are appended to the results by default.
A new ErrEmptyUrls error is now returned when List or ListContext do not
receive a URL to work with, to improve overall execution flow.
Signed-off-by: Paulo Gomes <pjbgf@linux.com>
|
| |\ \
| | | |
| | | | |
fix: git grep bare repositories
|
| | |/
| | |
| | |
| | |
| | |
| | | |
Perform grep on `*Repository` instead of `*Worktree`.
Fixes: https://github.com/go-git/go-git/issues/68
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Clone remote as a mirror. This fetches all remote refs, implies bare
repository, and sets the appropriate configs.
Fixes: https://github.com/go-git/go-git/issues/293
Update options.go
Co-authored-by: Paulo Gomes <paulo.gomes.uk@gmail.com>
Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
|
| |
| |
| |
| |
| |
| | |
Relates to the SHA256 implementation, defined in #706.
Signed-off-by: Paulo Gomes <pjbgf@linux.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
BuildTree now returns an ErrEmptyCommit error, when there are no
changes to be committed. This can be opted-out via
CommitOptions.AllowEmptyCommits.
This is a breaking change which enables applications to detect when
empty commits are to be created.
Some instances in which this can occur is when the fs (e.g. `billy/osfs`)
make changes to the underlying files, causing a conflict between what
the previous Git worktree state was, and the current state. Changes to
the fs implementations are orthogonal to this, and will be dealt with
separately.
The new behaviour aligns with the Git CLI, in which empty commits
returns the error message: 'nothing to commit, working tree clean'.
Signed-off-by: Paulo Gomes <pjbgf@linux.com>
|
| | |
|
| |
| |
| |
| |
| | |
Signed-off-by: cui fliter <imcusg@gmail.com>
Signed-off-by: cui fliter <imcusg@gmail.com>
|
|/
|
|
|
|
| |
Adds an Amend option to CommitOptions that behaves like git --amend.
This change includes modifications to the Validate function to disallow
a Commit call with both Amend and either Parents or All enabled.
|
|\ |
|
| |\
| | |
| | | |
Worktree: Checkout, simplified sparse checkout
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| |/
| |
| |
| |
| |
| |
| |
| | |
--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
|
|/
|
|
|
|
| |
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.
|
|\
| |
| | |
Remote: PushOptions add push-options
|
| |
| |
| |
| | |
go-git: Add field `Options` to `PushOptions`, wire functionality.
|
|/
|
|
|
|
|
|
|
|
| |
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)).
|
|\
| |
| | |
Remote: add RemoteURL to {Fetch,Pull,Push}Options
|
| |
| |
| |
| |
| | |
Can be used to override the URL to operate on:
RemoteName will be ignored for the actual fetch
|
|/
|
|
| |
This PR adds support for the --follow-tags option for pushes.
|
| |
|
|
|
|
| |
github.com/ProtonMail/go-crypto/openpgp (#283)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The git protocol itself uses a compare-and-swap mechanism, where changes
send the old and new values and the change is only applied if the old
value matches. This is used to implement the --force-with-lease feature
in git push.
go-git populates the `old` field with the current value of the ref that
is read from the remote. We can implement a convenient (albeit more
limited) form of the --force-with-lease feature just by allowing the
caller to specify particular values for this ref.
Callers can then implement complex multi-step atomic operations by
reading the ref themselves at the start of the process, and passing to
in RequireRemoteRefs at the end. This is also a suitable building block
for implementing --force-with-lease (#101), which is mostly an exercise
in computing the correct hash to require. Hence, this appears to be the
most reasonable API to expose.
|
|
|
|
|
| |
This PR add insecureSkipTLSVerify and cabundle to any remote http calls
so that https repo with private CA signed can be used. This is the
equivalent of https.sslVerify and GIT_SSL_CAINFO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Git creates `.git/commondir` when there are custom worktrees (see "git worktree add" related commands).
`.git/commondir` in such case contains a link to another dot-git repository tree, which could contain some folders like:
- objects;
- config;
- refs;
- etc.
In this PR a new dotgit.RepositoryFilesystem struct is defined, which is billy.Filesystem interface compatible object-wrapper, that can handle commondir and dispatch all operations to the correct file path.
`git.PlainOpen` remain unchanged, but `git.PlainOpenWithOptions` has a new option: `PlainOpenOptions.EnableDotGitCommonDir=true|false` (which is false by default). When `EnableDotGitCommonDir=true` repository-open procedure will read `.git/commondir` (if it exists) and then create dotgit.RepositoryFilesystem object initialized with 2 filesystems. This object then passed into storage and then into dotgit.DotGit as `billy.Filesystem` interface. This object will catch all filesystem operations and dispatch to the correct repository-filesystem (dot-git or common-dot-git) according to the rules described in the doc: https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt. EnableDotGitCommonDir option will only work with the filesystem-backed storage.
Also worktree_test.go has been adopted from an older, already existing existing PR: https://github.com/src-d/go-git/pull/1098. This PR needs new fixtures added in the following PR: https://github.com/go-git/go-git-fixtures/pull/1.
|
| |
|
| |
|
| |
|
|\ |
|