mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Kyle McMartin <kyle@parisc-linux.org>
Cc: linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH] Move read_mostly definition to asm/cache.h
Date: Wed, 11 Jan 2006 13:20:27 -0800	[thread overview]
Message-ID: <7vslruqx5w.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0601110951210.5073@g5.osdl.org> (Linus Torvalds's message of "Wed, 11 Jan 2006 09:52:41 -0800 (PST)")

Linus Torvalds <torvalds@osdl.org> writes:

>> I accidently committed this to an up-to-date master branch, as
>> I forgot to check out the temporary branch I was going to commit
>> it on. Swapping the sums from .git/refs/heads/{master,read_mostly}
>> wouldn't break anything, if the only different between the two was
>> this commit, right?
>
> Correct. The branch head files really are just plain ascii references to 
> the top commit, you can rename branches by just renaming the file (and 
> thus switch branches by just cross-renaming them, ie just switching the 
> contents).

Careful.

If one of the swapped branches is your current branch
(i.e. pointed at by .git/HEAD), you need to remember to
switch that as well.

For example, after making the mistake of committing to "master":

	$ git commit ;# oops, to the master
        $ git show-branch origin master read_mostly
	!   [origin] latest update from Linus
         *  [master] latest for read_mostly
          ! [read_mostly] last update from Linus
        ---
         +  [master] latest for read_mostly
        +++ [origin] last update from Linus

Then swap heads:

	$ read_mostly_head=`cat .git/refs/heads/master`
        $ cat .git/refs/heads/read_mostly >.git/refs/heads/read_mostly
	$ echo "$read_mostly_head" >.git/refs/heads/read_mostly

At this point:

        * Your index file still matches $read_mostly_head
	* Your working tree matches your index file
	* Your .git/HEAD is pointing at .git/refs/heads/master

Essentially, you are (you want to be) in read_mostly branch, but
your .git/HEAD incorrectly says you are on the master branch.
So you would need:

	$ git symbolic-ref HEAD refs/heads/read_mostly

after swapping.  Then you would be on read_mostly branch.

        $ git show-branch origin master read_mostly
	!   [origin] latest update from Linus
         !  [master] last update from Linus
          * [read_mostly] latest for read_mostly
        ---
          + [read_mostly] latest for read_mostly
        +++ [origin] last update from Linus

BTW, would people object if I made the show-branch output like
this?


        $ git show-branch origin master read_mostly
	!   [origin] latest update from Linus
         !  [master] last update from Linus
          * [read_mostly] latest for read_mostly
        ---
          * [read_mostly] latest for read_mostly
        ++* [origin] last update from Linus



  reply	other threads:[~2006-01-11 21:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-11 17:33 Kyle McMartin
2006-01-11 17:52 ` Linus Torvalds
2006-01-11 21:20   ` Junio C Hamano [this message]
2006-01-12  5:36     ` Kyle McMartin
2006-01-15  9:48       ` 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=7vslruqx5w.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=kyle@parisc-linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®