git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-revover-tags-script

From
Junio C Hamano <junkio@cox.net>
Date
Jul 18, 2005, 01:13 UTC
Message-ID
<7v64v8j4qn.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<m1hdetnfjq.fsf@ebiederm.dsl.xmission.com>
ebiederm@xmission.com (Eric W. Biederman) writes:
> There are a couple pieces of your example that disturb me.

Did you actually think I suggested you to make that into a script that cannot be configured? No, it was Junio acquiring a habit from Linus to give a rough outline in a code form in his e-mail client.

In another message, you said:
> Actually looking a little deeper unless I have misread
> the code git-fetch-pack at least will only ask for commit
> objects so git fetch will never return a tag object.

I thought so but then I tried it and actually it does seem to work as expected (well, it is Linus code so it has to be perfect ;-). I created an empty directory and ran the following script. It creates two commits, tags the later commit to ".git/refs/tags/one", and shows the list of objects the upload-pack (the peer git-fetch-pack talks to) decides to pack and send to the puller that has the first commit only. The first git-rev-list shows one extra object compared to the second one; the difference is the named tag that is being asked.

------------ #!/bin/sh

rm -fr .git
git-init-db
zero_tree=$(git-write-tree)
echo "base tree $zero_tree"
zero_commit=$(
	echo Empty tree as the base |
	git-commit-tree $zero_tree
)
echo "base commit $zero_commit"
echo >a
git-update-cache --add a
one_tree=$(git-write-tree)
echo "one tree $one_tree"
one_commit=$(
	echo Add one file |
	git-commit-tree $one_tree -p $zero_commit
)
echo "one commit $one_commit"

tagger=$(git-var GIT_COMMITTER_IDENT) echo "object $one_commit type commit tag tag-one tagger $tagger

just a tag." | git-mktag >.git/refs/tags/one echo "one tag `cat .git/refs/tags/one`"

echo "*** reachable from one tag but not from zero" git-rev-list --objects tags/one ^$zero_commit

echo "*** reachable from one commit but not from zero" git-rev-list --objects $one_commit ^$zero_commit

Previous: Eric W. BiedermanNext: Eric W. Biederman
Message 6 of 12 in “git-revover-tags-script”
  1. git-revover-tags-scriptEric W. Biederman, Jul 16, 2005
  2. Junio C HamanoJul 17, 2005
  3. Eric W. BiedermanJul 17, 2005
  4. Junio C HamanoJul 17, 2005
  5. Eric W. BiedermanJul 18, 2005
  6. Junio C HamanoJul 18, 2005
  7. Eric W. BiedermanJul 18, 2005
  8. Junio C HamanoJul 18, 2005
  9. Eric W. BiedermanJul 18, 2005
  10. [RFD] server-info to help clientsJunio C Hamano, Jul 20, 2005
  11. David LangJul 20, 2005
  12. Junio C HamanoJul 20, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.