From: Linus Torvalds <torvalds@osdl.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Jens Axboe <axboe@suse.de>, Git Mailing List <git@vger.kernel.org>
Subject: Re: git merging
Date: Fri, 17 Jun 2005 17:13:23 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.58.0506171700200.2268@ppc970.osdl.org> (raw)
In-Reply-To: <42B36207.3020209@pobox.com>
On Fri, 17 Jun 2005, Jeff Garzik wrote:
>
> This is definitely not the case; my .git/HEAD is _always_ a symlink.
Ok. Are you sure that you gave the same arguments (or rather, lack of
arguments) to both fsck and "git prune"? The thing is, they are both
really the same thing, so I'm pretty surprised. If git prune says
something is unreachable, then git-fsck-cache shouldn't complain about it
being gone, because one just depends on the other..
> My git-switch-tree script, attached, demonstrates how .git/HEAD symlink
> is retargetted to the specified branch. My workflow depends on
> .git/HEAD being a symlink.
Btw, you can now do the same thing more safely and guarantee that it
doesn't overwrite any old information by using
git-read-tree -m -u <old-head> <new-head>
which basically switches from "old" to "new", and verifies that all the
old index contents were valid in "old-head", and that any file that was
dirty is not different in "new-head".
Your old script would silently overwrite any dirty state in your working
directory, and drop anything that you had done a git-update-cache on but
not committed.
Now, you may have _depended_ on that behaviour as a way to just reset the
tree to a known state, but if so, I'd suggest using
git-read-tree --reset HEAD && git-checkout-cache -q -f -u -a
for that instead (which will also throw away any partial merges).
So for the "switch" case, you might make it be something like
if [ ! -f .git/refs/heads/$1 ]
then
echo "Branch '$1' not found"
exit 1;
fi
git-read-tree -m -u HEAD "heads/$1" && ln -sf refs/heads/$1 .git/HEAD
which should do the right thing.
Totally untested, of course ;)
[ But the two-tree read-tree is definitely not untested: this is how we
do a safe "fast forward" in the git-resolve-script, which really ends up
being the exact same thing: it "switches" from one head to another ].
Linus
next prev parent reply other threads:[~2005-06-18 0:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20050617133440.GI6957@suse.de>
[not found] ` <Pine.LNX.4.58.0506170937260.8487@ppc970.osdl.org>
[not found] ` <20050617175653.GS6957@suse.de>
[not found] ` <Pine.LNX.4.58.0506171101450.2268@ppc970.osdl.org>
[not found] ` <20050617181156.GT6957@suse.de>
[not found] ` <Pine.LNX.4.58.0506171132390.2268@ppc970.osdl.org>
[not found] ` <20050617183914.GX6957@suse.de>
2005-06-17 18:50 ` git merging Linus Torvalds
2005-06-17 19:16 ` Jens Axboe
2005-06-17 23:08 ` Jeff Garzik
2005-06-17 23:31 ` Linus Torvalds
2005-06-17 23:51 ` Jeff Garzik
2005-06-18 0:13 ` Linus Torvalds [this message]
2005-06-20 12:30 ` Jens Axboe
2005-06-20 13:48 ` Matthias Urlichs
2005-06-20 14:13 ` Jens Axboe
2005-06-20 15:58 ` Linus Torvalds
2005-06-20 16:06 ` Daniel Barkalow
2005-06-20 19:21 ` Matthias Urlichs
2005-06-20 20:38 ` Jens Axboe
2005-06-20 21:15 ` Linus Torvalds
2005-06-21 14:59 ` Jens Axboe
2005-06-21 15:53 ` Linus Torvalds
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=Pine.LNX.4.58.0506171700200.2268@ppc970.osdl.org \
--to=torvalds@osdl.org \
--cc=axboe@suse.de \
--cc=git@vger.kernel.org \
--cc=jgarzik@pobox.com \
/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).