git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Pushing tag from a partial clone
@ 2020-07-20 11:44 Son Luong Ngoc
  2020-07-20 12:18 ` Derrick Stolee
  0 siblings, 1 reply; 4+ messages in thread
From: Son Luong Ngoc @ 2020-07-20 11:44 UTC (permalink / raw)
  To: git

Hi folks,

At $day_job, we are trying to push tags to a repo from a partial clone copy.
However it seems like this push would requires the partial clone copy to download more objects?
Is this intended?

Reproduce:

	mkdir repo && cd repo
	git init
	git remote add origin git@domain.com:path/repo.git
	git fetch --filter=tree:0 --no-tags --prune origin <commit-id>
	git sparse-checkout init --cone
	git checkout --force <commit-id>
	git tag -a sluongng-test -m "Test push from partial clone"
	git push HEAD:refs/tags/sluongng-test
	<git starts to download objects>

Ideally we would like to be able to push tag from a shallow + partial clone repo without 
having to download extra objects if possible.
We would like to keep the required repo to the absolute minimum.
	git fetch --depth 1 --filter=tree:0 --no-tags --prune origin <commit-id>

Creating and pushing tags should not require local repo to have trees/blobs in it?

Git version: 2.27.0

Cheers,
Son Luong.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pushing tag from a partial clone
  2020-07-20 11:44 Pushing tag from a partial clone Son Luong Ngoc
@ 2020-07-20 12:18 ` Derrick Stolee
  2020-07-20 13:47   ` Son Luong Ngoc
  0 siblings, 1 reply; 4+ messages in thread
From: Derrick Stolee @ 2020-07-20 12:18 UTC (permalink / raw)
  To: Son Luong Ngoc, git, Jonathan Tan

On 7/20/2020 7:44 AM, Son Luong Ngoc wrote:
> Hi folks,
> 
> At $day_job, we are trying to push tags to a repo from a partial clone copy.
> However it seems like this push would requires the partial clone copy to download more objects?
> Is this intended?
> 
> Reproduce:
> 
> 	mkdir repo && cd repo
> 	git init
> 	git remote add origin git@domain.com:path/repo.git
> 	git fetch --filter=tree:0 --no-tags --prune origin <commit-id>
> 	git sparse-checkout init --cone
> 	git checkout --force <commit-id>
> 	git tag -a sluongng-test -m "Test push from partial clone"
> 	git push HEAD:refs/tags/sluongng-test
> 	<git starts to download objects>
> 
> Ideally we would like to be able to push tag from a shallow + partial clone repo without 
> having to download extra objects if possible.
> We would like to keep the required repo to the absolute minimum.
> 	git fetch --depth 1 --filter=tree:0 --no-tags --prune origin <commit-id>
> 
> Creating and pushing tags should not require local repo to have trees/blobs in it?
> 
> Git version: 2.27.0

Could you try this again with 2.28.0-rc1? I think Jonathan
Tan added the "no-fetch" flag in more places since 2.27.0,
and this might already be fixed.

Thanks,
-Stolee


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pushing tag from a partial clone
  2020-07-20 12:18 ` Derrick Stolee
@ 2020-07-20 13:47   ` Son Luong Ngoc
  2020-07-20 17:54     ` Jonathan Tan
  0 siblings, 1 reply; 4+ messages in thread
From: Son Luong Ngoc @ 2020-07-20 13:47 UTC (permalink / raw)
  To: Derrick Stolee; +Cc: git, Jonathan Tan

Hi,

> On Jul 20, 2020, at 14:18, Derrick Stolee <stolee@gmail.com> wrote:
> 
> On 7/20/2020 7:44 AM, Son Luong Ngoc wrote:
>> Hi folks,
>> 
>> At $day_job, we are trying to push tags to a repo from a partial clone copy.
>> However it seems like this push would requires the partial clone copy to download more objects?
>> Is this intended?
>> 
>> Reproduce:
>> 
>> 	mkdir repo && cd repo
>> 	git init
>> 	git remote add origin git@domain.com:path/repo.git
>> 	git fetch --filter=tree:0 --no-tags --prune origin <commit-id>
>> 	git sparse-checkout init --cone
>> 	git checkout --force <commit-id>
>> 	git tag -a sluongng-test -m "Test push from partial clone"
>> 	git push HEAD:refs/tags/sluongng-test
>> 	<git starts to download objects>
>> 
>> Ideally we would like to be able to push tag from a shallow + partial clone repo without 
>> having to download extra objects if possible.
>> We would like to keep the required repo to the absolute minimum.
>> 	git fetch --depth 1 --filter=tree:0 --no-tags --prune origin <commit-id>
>> 
>> Creating and pushing tags should not require local repo to have trees/blobs in it?
>> 
>> Git version: 2.27.0
> 
> Could you try this again with 2.28.0-rc1? I think Jonathan
> Tan added the "no-fetch" flag in more places since 2.27.0,
> and this might already be fixed.

I just freshly compiled from 'next' branch:

	> git version
	git version 2.28.0.rc1.139.gd6b33fda9d

And the problem still occurring:
	> mkdir scalar
	> cd scalar
	> git init
	Initialized empty Git repository in /Users/sluongngoc/work/booking/core/scalar/.git/
	# use my own fork here so that i have push permission
	> git remote add origin git@github.com:sluongng/scalar.git
	> git sparse-checkout init --cone
	> git fetch --filter=tree:0 --no-tags --prune origin 4ba6c1c090e6e5a413e3ac2fc094205bd78f761e
	remote: Enumerating objects: 2553, done.
	remote: Total 2553 (delta 0), reused 0 (delta 0), pack-reused 2553
	Receiving objects: 100% (2553/2553), 957.85 KiB | 1.06 MiB/s, done.
	Resolving deltas: 100% (74/74), done.
	From github.com:sluongng/scalar
	 * branch            4ba6c1c090e6e5a413e3ac2fc094205bd78f761e -> FETCH_HEAD
	> git tag -a test-tag -m 'test tag message' 4ba6c1c090e6e5a413e3ac2fc094205bd78f761e
	> git push origin refs/tags/test-tag:refs/tags/test-tag
	...<download start>

> 
> Thanks,
> -Stolee
> 

Thanks,
Son Luong.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pushing tag from a partial clone
  2020-07-20 13:47   ` Son Luong Ngoc
@ 2020-07-20 17:54     ` Jonathan Tan
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Tan @ 2020-07-20 17:54 UTC (permalink / raw)
  To: sluongng; +Cc: stolee, git, jonathantanmy

> I just freshly compiled from 'next' branch:
> 
> 	> git version
> 	git version 2.28.0.rc1.139.gd6b33fda9d
> 
> And the problem still occurring:
> 	> mkdir scalar
> 	> cd scalar
> 	> git init
> 	Initialized empty Git repository in /Users/sluongngoc/work/booking/core/scalar/.git/
> 	# use my own fork here so that i have push permission
> 	> git remote add origin git@github.com:sluongng/scalar.git
> 	> git sparse-checkout init --cone
> 	> git fetch --filter=tree:0 --no-tags --prune origin 4ba6c1c090e6e5a413e3ac2fc094205bd78f761e
> 	remote: Enumerating objects: 2553, done.
> 	remote: Total 2553 (delta 0), reused 0 (delta 0), pack-reused 2553
> 	Receiving objects: 100% (2553/2553), 957.85 KiB | 1.06 MiB/s, done.
> 	Resolving deltas: 100% (74/74), done.
> 	From github.com:sluongng/scalar
> 	 * branch            4ba6c1c090e6e5a413e3ac2fc094205bd78f761e -> FETCH_HEAD
> 	> git tag -a test-tag -m 'test tag message' 4ba6c1c090e6e5a413e3ac2fc094205bd78f761e
> 	> git push origin refs/tags/test-tag:refs/tags/test-tag
> 	...<download start>

Thanks for the reproduction steps. Is 4ba6c1c advertised as a ref by the
remote? If not, what is probably happening is that the client doesn't
realize that the server already has 4ba6c1c, so the client needs to
fetch 4ba6c1c's objects to send it to the server.

I am planning to see if I can add batch prefetching to pack-objects to
reduce the severity of similar situations (just one batch prefetch instead
of many one-by-one fetches), although that would work better with a blob
filter instead of a tree filter.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-20 17:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 11:44 Pushing tag from a partial clone Son Luong Ngoc
2020-07-20 12:18 ` Derrick Stolee
2020-07-20 13:47   ` Son Luong Ngoc
2020-07-20 17:54     ` Jonathan Tan

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).