From: "Chris Lee" <clee@kde.org>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: Re: Simple UI question...
Date: Sun, 7 Jan 2007 03:21:56 -0800 [thread overview]
Message-ID: <204011cb0701070321w18942a3w7fb4f7ecd26fc457@mail.gmail.com> (raw)
In-Reply-To: <20070107111305.GD10351@spearce.org>
On 1/7/07, Shawn O. Pearce <spearce@spearce.org> wrote:
> Chris Lee <clee@kde.org> wrote:
> > So I'm trying to figure out the best way to pull out a checkout of the
> > entire tree as of a given revision ID. I have a whole bunch of
> > revision IDs, and I'd like to know what the git equivalent of (say)
> > the following is:
> >
> > svn co -r280600 file:///path/to/svn/repo
> >
> > For the sake of argument, let's say that r280600 imported as
> > 07058310db903317faa300b93004a5a2e0fc2dcc into my git tree.
> >
> > How do I get a pristine checkout in my working copy of the entire tree
> > as the repository saw it at 07058310db903317faa300b93004a5a2e0fc2dcc?
>
> One way is:
>
> git archive \
> --format=tar \
> 07058310db903317faa300b93004a5a2e0fc2dcc \
> | (mkdir ../export; cd ../export; tar xf -)
>
> Would give you a new directory tree which is not related to any
> Git repository, but which contains the exact set of files in 070583.
> But that's probably not what you meant.
>
> > Eric Anholt suggested 'git checkout -b temporary-branch-name
> > $sha1sum';
>
> Yes, that is usually the way you do this. Unlike the archive trick
> above the result will be in your current working directory and
> will be associated with the current Git repository. Further you
> can modify this and commit changes if you need to.
>
> > davej suggested 'git-read-tree $sha1sum &&
> > git-checkout-index -a -f'
>
> That's just cruel. Its only part of the underlying operations that
> git checkout is performing, and its trashing your current branch
> by making HEAD no longer match the index. And its very low-level.
> And it doesn't really do a 2-way merge to fully update the working
> directory. Not the best way for a user to perform this action.
> Forget davej ever suggested this.
Heh. He's going to kill me for continuing to drag his name throught he
mud. Anyway... :)
> > but for some reason, neither of these
> > commands seems to do exactly as I expect. davej's method seems to work
> > for some revision IDs, but not for others, and the other method seems
> > to work just about as well. (The problem I have seen is that, for some
> > revisions, the only files I get in the working copy are the files that
> > were changed in that commit; the rest of the files in the tree do not
> > get checked out.)
>
> The problem is davej's method doesn't take into account what the
> current working directory actually has stored in it. It does not
> delete any files which should not appear in $sha1sum. It also
> overwrites more files than it needs to, as it overwrites everything
> instead of just those files which actually differ between the
> current working directory and $sha1sum.
What I've been doing is 'rm -rf *' from the working directory and
trying the commands out; I don't want any empty folders or anything.
> Eric Anholt's version is the correct way to do it. It is also very
> fast as it only has to modify the files which actually differed.
Eric's shows the same problem - for some revision IDs, when I do a
checkout, I only get the files that were changed in that revision.
> If Eric's version isn't always working then I'd have to suggest
> that you exmaine the output of `git status` for switching to
> some temporary branch based on $sha1sum. Perhaps you have local
> modifications which are carrying over in your working directory?
I assume 'removing everything in the working tree' counts as "local
modifications"? :)
next prev parent reply other threads:[~2007-01-07 11:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-07 11:02 Simple UI question Chris Lee
2007-01-07 11:06 ` Josef "Jeff" Sipek
2007-01-07 11:13 ` Shawn O. Pearce
2007-01-07 11:21 ` Chris Lee [this message]
2007-01-07 11:29 ` Shawn O. Pearce
2007-01-07 11:38 ` Chris Lee
2007-01-07 11:40 ` Junio C Hamano
2007-01-07 11:50 ` Chris Lee
2007-01-07 11:30 ` Junio C Hamano
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=204011cb0701070321w18942a3w7fb4f7ecd26fc457@mail.gmail.com \
--to=clee@kde.org \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.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).