Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

remote: use reference deltas on push when the remote server does not support offset deltas #952

Closed
wants to merge 66 commits into from
Closed

Conversation

bashims
Copy link
Contributor

@bashims bashims commented Sep 7, 2018

No description provided.

krylovsk and others added 18 commits January 21, 2018 14:42
Fixes #827

Signed-off-by: Dustin Frisch <[email protected]>
This adds a few methods:

* CreateTag, which can be used to create both lightweight and annotated
tags with a supplied TagObjectOptions struct. PGP signing is possible as
well.
* Tag, to fetch a single tag ref. As opposed to Tags or TagObjects, this
will also fetch the tag object if it exists and return it along with the
output. Lightweight tags just return the object as nil.
* DeleteTag, to delete a tag. This simply deletes the ref. The object is
left orphaned to be GCed later.

I'm not 100% sure if DeleteTag is the correct behavior - looking for
details on exactly *what* happens to a tag object if you delete the ref
and not the tag were sparse, and groking the Git source did not really
produce much insight to the untrained eye. This may be something that
comes up in review. If deletion of the object is necessary, the
in-memory storer may require some updates to allow DeleteLooseObject to
be supported.

Signed-off-by: Chris Marchesi <[email protected]>
As with the update in ec3d2a8, tag encoding needed to be corrected to
ensure extra newlines were not being added in during tag object
encoding, so that it did not corrupt the object for verification.

Signed-off-by: Chris Marchesi <[email protected]>
Tag encoding/decoding seems to be a lot more sensitive to requiring the
exact expected format in the object, which generally includes messages
canonicalized so that they have a newline on the end (even if they
didn't before).

As such, the message should be written with the newline (no need for an
extra), and the PGP signature right after that, which will be newline
split already, so there's no need to split it again.

All of this means it's very important for the caller to send the message
in the correct format - which I'm correcting in the next commit.

Signed-off-by: Chris Marchesi <[email protected]>
Tag messages are highly sensitive to being in the expected format,
especially when encoding/decoding for PGP verification.

As such, we do a simple trimming of whitespace on the incoming message
and add a newline on the end, to ensure there are no surprises here.

Signed-off-by: Chris Marchesi <[email protected]>
The old one was created with defaults, which would have caused CI
failures in 2 years.

The new one is valid for 10 years:

> gpg --list-secret-keys
/root/.gnupg/pubring.kbx
------------------------
sec   rsa4096 2018-08-22 [SC] [expires: 2028-08-19]
      93A17FF01E54328546087C8E029395402EFCCD53
uid           [ unknown] foo bar <[email protected]>

Signed-off-by: Chris Marchesi <[email protected]>
I figured there was a way to do this without having to have
TagObjectOptions supply this in - there is.

Added support for this in and removed the object type from
TagObjectOptions.

Signed-off-by: Chris Marchesi <[email protected]>
I've mainly noticed that in using the current Tag function, that there
were lots of times that I was ignoring the ref or the object, depending
on what I needed. This was evident in the tests as well. As such, I
think it just makes more sense for a singular tag fetcher to return just
a ref, through which the caller may grab the annotation if they need it,
and if it exists.

Also, contrary to the docs on Tags, all tags have a ref, even if they
are annotated. The difference between a lightweight tag and an annotated
tag is the presence of the tag object, which the ref will point to if
the tag is annotated. As such I've adjusted the docs with an example as
to how one can get the annotation for a tag ref through the iterator.

Source: https://git-scm.com/book/en/v2/Git-Internals-Git-References,
tags section.

Signed-off-by: Chris Marchesi <[email protected]>
Signed-off-by: Antonio Jesus Navarro Perez <[email protected]>
Signed-off-by: kuba-- <[email protected]>
This is to avoid any ambiguity with the act of "fetching" in git in
general.

Signed-off-by: Chris Marchesi <[email protected]>
This is necessary to support pruning on Tag objects.

Signed-off-by: Chris Marchesi <[email protected]>
Deleting a tag ref for an annotated tag in normal git behavior does not
delete the tag object right away. This is handled by the normal GC
process.

Signed-off-by: Chris Marchesi <[email protected]>
Added a couple of tests for annotated tag deletion:

* The first one is a general test and should work regardless of the
fixture used - the tag object could possibly be packed, so we do a prune
*and* a repack operation before testing to see if the object was GCed
correctly.

* The second one actually creates the tag to be deleted, so that the tag
object gets created as a loose, unpacked object. This is so we can
effectively test that purning unpacked objects is now working 100%
correctly (this was failing before because tag objects were not
supported for walking).

Signed-off-by: Chris Marchesi <[email protected]>
Just renaming the TagObjectOptions type to CreateTagOptions so that it's
consistent with the other option types.

Signed-off-by: Chris Marchesi <[email protected]>
Fix `fatal: corrupt patch` error in unified diff format
@mcuadros
Copy link
Contributor

mcuadros commented Sep 10, 2018

@bashims can you sign the DCO and add a test?

@bashims
Copy link
Contributor Author

bashims commented Sep 10, 2018

@mcuadros absolutely.

@smola
Copy link
Collaborator

smola commented Sep 14, 2018

The PR looks perfect, let's see the test cases.

mcuadros and others added 27 commits October 9, 2018 06:34
git: Fix Status.IsClean() documentation
config: Add test for Windows local paths.
plumbing: object, Add support for Log with filenames. Fixes #826
Without reading the entire object into memory.

Signed-off-by: Jeremy Stribling <[email protected]>
Suggested by taruti.

Signed-off-by: Jeremy Stribling <[email protected]>
Use remote name in fetch while clone
references: sort: compare author timestamps when commit timestamps are equal. Fixes #725
Teach ResolveRevision how to look up annotated tags
Suggested by mcuadros.

Issue: #982
Signed-off-by: Jeremy Stribling <[email protected]>
tree: add a Size() method for getting plaintext size
blame: fix edge case with missing \n in content length causing mismatched length error
repository: allow open non-bare repositories as bare
repository: improve CheckoutOption.Hash doc
@bashims
Copy link
Contributor Author

bashims commented Oct 16, 2018

I think I have messed up the rebase/merge for this PR. I will close out this PR and submit a new one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.