git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Vlasov <vsu@altlinux.ru>
To: Petr Baudis <pasky@suse.cz>
Cc: Linus Torvalds <torvalds@osdl.org>, Dave Jones <davej@redhat.com>,
	git@vger.kernel.org
Subject: Re: Fwd: Re: git checkout -f branch doesn't remove extra files
Date: Sat, 13 Aug 2005 16:10:53 +0400	[thread overview]
Message-ID: <20050813161053.29593972.vsu@altlinux.ru> (raw)
In-Reply-To: <20050813110050.GA5608@pasky.ji.cz>

[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]

On Sat, 13 Aug 2005 13:00:51 +0200 Petr Baudis wrote:

> Dear diary, on Sat, Aug 13, 2005 at 07:05:11AM CEST, I got a letter
> where Linus Torvalds <torvalds@osdl.org> told me that...
[...]
> > 	snap=git-snapshot-$(date +"%Y%m%d")
> > 	git-tar-tree HEAD $snap | gzip -9 > $snap.tar.gz
> > 
> > which is even easier, and a hell of a lot more efficient.
> 
> To put my two cents too, Cogito has cg-export for this:
> 
> 	cg-export tmp-dir
> 
> to export to a temporary directory and
> 
> 	cg-export git-snapshot.tar.gz
> 
> to export to a gzipped tarball (it can also do .tar, .tgz and .tar.bz2).

However, cg-export is buggy - if you use the second argument
(cg-export DESTFILE TREE_ID), the resulting tar file is different
from what git-tar-tree produces for the same TREE_ID (unless that
TREE_ID actually points to a tree - but in practice a commit or even
tag ID is typically used).

The problem is in this line:

id=$(tree-id "$2")

This converts the passed commit or tag to the underlying tree, which
is then passed to git-tar-tree.  However, git-tar-tree can follow
such links itself, and, what's more important, it actually uses some
information from the passed commit (it writes the commit ID to the
tar file as an extended header, and sets timestamp of all archive
members to the time of the commit).  Therefore reducing the ID
passed to git-tar-tree to a plain tree ID is wrong - if a commit ID
is available, it should be used.

-- 
Sergey Vlasov

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-08-13 12:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-13  4:17 Fwd: Re: git checkout -f branch doesn't remove extra files Dave Jones
2005-08-13  5:05 ` Linus Torvalds
2005-08-13  5:27   ` Dave Jones
2005-08-13  5:39     ` Linus Torvalds
2005-08-13  5:33   ` Linus Torvalds
2005-08-13 11:00   ` Petr Baudis
2005-08-13 12:10     ` Sergey Vlasov [this message]
2005-08-13 12:33       ` Petr Baudis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050813161053.29593972.vsu@altlinux.ru \
    --to=vsu@altlinux.ru \
    --cc=davej@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=pasky@suse.cz \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).