git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Pasky problem with 'git init URL'
@ 2005-04-21 16:21 Martin Schlemmer
  2005-04-21 20:29 ` Petr Baudis
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Schlemmer @ 2005-04-21 16:21 UTC (permalink / raw)
  To: GIT Mailing Lists

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

Hi,

Just pulled linux-2.6.git, and got this:

----
New branch: 3a6fd752a50af92765853879f4a11cc0cfcd0320
Tracked branch, applying changes...
Merging 4d78b6c78ae6d87e4c1c8072f42efa716f04afb9 -> 3a6fd752a50af92765853879f4a11cc0cfcd0320
        to a2755a80f40e5794ddc20e00f781af9d6320fafb...

Enter commit message, terminated by ctrl-D on a separate line:
Merge with 3a6fd752a50af92765853879f4a11cc0cfcd0320
----

Weird thing was that I made no changes.

Digging a bit deeper, I saw that .git/HEAD was a symlink
to .git/heads/master, and the tracked branch was 'origin'.  Due to the
fact that Linus only have a .git/heads/master on his rsync, and this
thus updated to the new sha1, but the 'origin' (and tracked) head is
still pointing to an older sha1 caused this confusion.

I replicated the linux tree via:

----
git init URL
----

So I had a look at gitinit.sh, which first creates the .git/heads/master
and symlinks HEAD to it, then on seeing a URL was supplied, creates
a .git/heads/origin, track it, but do *not* change the .git/HEAD
symlink ... Is this intended?  I see also that gittrack.sh do not update
the HEAD symlink ...  Is this also intended?

I guess a solution is to either just use 'master', and do not do the
'origin' head, or to update the HEAD symlink.  I however do not think
this is very generic, especially if the remote repo do not call their
main head 'master' - so it might be better to check what it have
in .git/heads, and if only one, use that as the main and tracked head,
else do nothing and tell the user to decide what head to track, etc.

The last option however brings a problem or two.  First, how do you do
the multi-head thing?  Maybe add a command 'git lsheads' (and while at
it, also add 'git lstags'?)?  Secondly, if there was more than one head,
the local copy needs to be checked out ... don't know if 'git cancel' is
the logical thing the user will think to do ('git clone' perhaps?) ...

I think it might be a good time to start thinking and putting to text
what commands is really needed, what they should be called, and how
exactly they should behave before it gets much later in the game.

Anyhow, suggestions/comments welcome.


Thanks,

-- 
Martin Schlemmer


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Pasky problem with 'git init URL'
  2005-04-21 16:21 Pasky problem with 'git init URL' Martin Schlemmer
@ 2005-04-21 20:29 ` Petr Baudis
  2005-04-21 21:15   ` John Stoffel
  2005-04-21 21:17   ` Martin Schlemmer
  0 siblings, 2 replies; 7+ messages in thread
From: Petr Baudis @ 2005-04-21 20:29 UTC (permalink / raw)
  To: Martin Schlemmer; +Cc: GIT Mailing Lists

Dear diary, on Thu, Apr 21, 2005 at 06:21:58PM CEST, I got a letter
where Martin Schlemmer <azarah@nosferatu.za.org> told me that...
> Hi,

Hi,

> Just pulled linux-2.6.git, and got this:
> 
> ----
> New branch: 3a6fd752a50af92765853879f4a11cc0cfcd0320
> Tracked branch, applying changes...
> Merging 4d78b6c78ae6d87e4c1c8072f42efa716f04afb9 -> 3a6fd752a50af92765853879f4a11cc0cfcd0320
>         to a2755a80f40e5794ddc20e00f781af9d6320fafb...
> 
> Enter commit message, terminated by ctrl-D on a separate line:
> Merge with 3a6fd752a50af92765853879f4a11cc0cfcd0320
> ----
> 
> Weird thing was that I made no changes.

did you compensate for the renamed hashes? Didn't you before update from
some very old git-pasky version?

Actually, did you do that git init _after_ the unsuccessful pull, or
before?

> Digging a bit deeper, I saw that .git/HEAD was a symlink
> to .git/heads/master, and the tracked branch was 'origin'.  Due to the
> fact that Linus only have a .git/heads/master on his rsync, and this
> thus updated to the new sha1, but the 'origin' (and tracked) head is
> still pointing to an older sha1 caused this confusion.

Duh. The remote branch always grabs the HEAD over there; you don't need
to care about the various branches over there, and you really do not
*want* to care. Actually I might add some ^branchname to the rsync URL,
to be able to refer to particular branches inside of the repository.

> I replicated the linux tree via:
> 
> ----
> git init URL
> ----
> 
> So I had a look at gitinit.sh, which first creates the .git/heads/master
> and symlinks HEAD to it, then on seeing a URL was supplied, creates
> a .git/heads/origin, track it, but do *not* change the .git/HEAD
> symlink ... Is this intended?  I see also that gittrack.sh do not update
> the HEAD symlink ...  Is this also intended?

Yes.

You never work directly on the remote branch. Ever. That's what this
tracking stuff is for; you set up a local branch which follows the
remote one.

Otherwise, you fork to two trees, one is remote branch, second is local
branch, and you do git pull remotebranch in the second. You are in
trouble now. Also, if you do some local commit on the remote branch,
what would happen? This kind of stuff is why I decided that you just
cannot work on remote branches directly.

> The last option however brings a problem or two.  First, how do you do
> the multi-head thing?  Maybe add a command 'git lsheads' (and while at
> it, also add 'git lstags'?)?  Secondly, if there was more than one head,

Perhaps it would be useful to have some "command classes" (with at least
cg-*-(add|ls|rm)), like:

	cg-branch-ls
	cg-remote-rm
	cg-tag-add

> the local copy needs to be checked out ... don't know if 'git cancel' is
> the logical thing the user will think to do ('git clone' perhaps?) ...

I don't know what do you mean here.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Pasky problem with 'git init URL'
  2005-04-21 20:29 ` Petr Baudis
@ 2005-04-21 21:15   ` John Stoffel
  2005-04-21 21:26     ` Petr Baudis
  2005-04-21 21:57     ` Fabian Franz
  2005-04-21 21:17   ` Martin Schlemmer
  1 sibling, 2 replies; 7+ messages in thread
From: John Stoffel @ 2005-04-21 21:15 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Martin Schlemmer, GIT Mailing Lists

>>>>> "Petr" == Petr Baudis <pasky@ucw.cz> writes:

Petr> Perhaps it would be useful to have some "command classes" (with at least
Petr> cg-*-(add|ls|rm)), like:

Petr> 	cg-branch-ls
Petr> 	cg-remote-rm
Petr> 	cg-tag-add

Just speaking of consistency, can we make it so that all the commands
are just variations with out the damm dashes in them?  Something like:

  git lsbranch
  git lstag
  ...

Or something mildly along those lines.  I don't even care what ORDER
they are, whether the 'ls' comes before or after the object type it
works on.  But make it the same every where, so that ls, rm, add,
check, foo, barzle, ... all use the same format. 

Makes it much much easier to extrapolate what command syntax to use
when new objects to be acted upon are added.

Does a standard like:

  git <objecttype> <command> <args> [<obj> ...]

make sense?  Easy to script, easy to remember.  Even munging
<objtype><command> into a single word is ok.

John

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Pasky problem with 'git init URL'
  2005-04-21 20:29 ` Petr Baudis
  2005-04-21 21:15   ` John Stoffel
@ 2005-04-21 21:17   ` Martin Schlemmer
  1 sibling, 0 replies; 7+ messages in thread
From: Martin Schlemmer @ 2005-04-21 21:17 UTC (permalink / raw)
  To: Petr Baudis; +Cc: GIT Mailing Lists

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

On Thu, 2005-04-21 at 22:29 +0200, Petr Baudis wrote:
> Dear diary, on Thu, Apr 21, 2005 at 06:21:58PM CEST, I got a letter
> where Martin Schlemmer <azarah@nosferatu.za.org> told me that...
> > Hi,
> 
> Hi,
> 
> > Just pulled linux-2.6.git, and got this:
> > 
> > ----
> > New branch: 3a6fd752a50af92765853879f4a11cc0cfcd0320
> > Tracked branch, applying changes...
> > Merging 4d78b6c78ae6d87e4c1c8072f42efa716f04afb9 -> 3a6fd752a50af92765853879f4a11cc0cfcd0320
> >         to a2755a80f40e5794ddc20e00f781af9d6320fafb...
> > 
> > Enter commit message, terminated by ctrl-D on a separate line:
> > Merge with 3a6fd752a50af92765853879f4a11cc0cfcd0320
> > ----
> > 
> > Weird thing was that I made no changes.
> 
> did you compensate for the renamed hashes? Didn't you before update from
> some very old git-pasky version?
> 
> Actually, did you do that git init _after_ the unsuccessful pull, or
> before?
> 

I re-pulled it from scratch after the sha1 changes, so not that.  Just
the next pull that went wonky.

> > Digging a bit deeper, I saw that .git/HEAD was a symlink
> > to .git/heads/master, and the tracked branch was 'origin'.  Due to the
> > fact that Linus only have a .git/heads/master on his rsync, and this
> > thus updated to the new sha1, but the 'origin' (and tracked) head is
> > still pointing to an older sha1 caused this confusion.
> 
> Duh. The remote branch always grabs the HEAD over there; you don't need
> to care about the various branches over there, and you really do not
> *want* to care. Actually I might add some ^branchname to the rsync URL,
> to be able to refer to particular branches inside of the repository.
> 

Well, I just did a quick peek.  I thought it just changed the local head
to the sha1 of the remote, and then updated the local files - haven't
yet looked at gitmerge.sh.

> > I replicated the linux tree via:
> > 
> > ----
> > git init URL
> > ----
> > 
> > So I had a look at gitinit.sh, which first creates the .git/heads/master
> > and symlinks HEAD to it, then on seeing a URL was supplied, creates
> > a .git/heads/origin, track it, but do *not* change the .git/HEAD
> > symlink ... Is this intended?  I see also that gittrack.sh do not update
> > the HEAD symlink ...  Is this also intended?
> 
> Yes.
> 
> You never work directly on the remote branch. Ever. That's what this
> tracking stuff is for; you set up a local branch which follows the
> remote one.
> 

Ok, but for some weird reason it wanted to commit the merge between
remote and local.

> Otherwise, you fork to two trees, one is remote branch, second is local
> branch, and you do git pull remotebranch in the second. You are in
> trouble now. Also, if you do some local commit on the remote branch,
> what would happen? This kind of stuff is why I decided that you just
> cannot work on remote branches directly.
> 
> > The last option however brings a problem or two.  First, how do you do
> > the multi-head thing?  Maybe add a command 'git lsheads' (and while at
> > it, also add 'git lstags'?)?  Secondly, if there was more than one head,
> 
> Perhaps it would be useful to have some "command classes" (with at least
> cg-*-(add|ls|rm)), like:
> 
> 	cg-branch-ls
> 	cg-remote-rm
> 	cg-tag-add
> 

Might make things more sane.

> > the local copy needs to be checked out ... don't know if 'git cancel' is
> > the logical thing the user will think to do ('git clone' perhaps?) ...
> 
> I don't know what do you mean here.
> 

Don't worry, no biggy.

-- 
Martin Schlemmer


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Pasky problem with 'git init URL'
  2005-04-21 21:15   ` John Stoffel
@ 2005-04-21 21:26     ` Petr Baudis
  2005-04-22 12:44       ` John Stoffel
  2005-04-21 21:57     ` Fabian Franz
  1 sibling, 1 reply; 7+ messages in thread
From: Petr Baudis @ 2005-04-21 21:26 UTC (permalink / raw)
  To: John Stoffel; +Cc: Martin Schlemmer, GIT Mailing Lists

Dear diary, on Thu, Apr 21, 2005 at 11:15:54PM CEST, I got a letter
where John Stoffel <john@stoffel.org> told me that...
> >>>>> "Petr" == Petr Baudis <pasky@ucw.cz> writes:
> 
> Petr> Perhaps it would be useful to have some "command classes" (with at least
> Petr> cg-*-(add|ls|rm)), like:
> 
> Petr> 	cg-branch-ls
> Petr> 	cg-remote-rm
> Petr> 	cg-tag-add
> 
> Does a standard like:
> 
>   git <objecttype> <command> <args> [<obj> ...]

Isn't this basically what I was proposing? (Modulo the UI changes
related to git-pasky -> Cogito.)

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Pasky problem with 'git init URL'
  2005-04-21 21:15   ` John Stoffel
  2005-04-21 21:26     ` Petr Baudis
@ 2005-04-21 21:57     ` Fabian Franz
  1 sibling, 0 replies; 7+ messages in thread
From: Fabian Franz @ 2005-04-21 21:57 UTC (permalink / raw)
  To: John Stoffel; +Cc: Martin Schlemmer, GIT Mailing Lists, Petr Baudis

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Donnerstag, 21. April 2005 23:15 schrieb John Stoffel:
> >>>>> "Petr" == Petr Baudis <pasky@ucw.cz> writes:
>
> Petr> Perhaps it would be useful to have some "command classes" (with at
> least Petr> cg-*-(add|ls|rm)), like:
>
> Petr> 	cg-branch-ls
> Petr> 	cg-remote-rm
> Petr> 	cg-tag-add
>
> Just speaking of consistency, can we make it so that all the commands
> are just variations with out the damm dashes in them?  

I think the dashes are especially useful, because of "tab-completion".

>   git <objecttype> <command> <args> [<obj> ...]
>

I think thats exactly like above:

cg-<objtype>-<command>

cu

Fabian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFCaCHbI0lSH7CXz7MRAuSXAJ40v4yNgS13BIExfYTwPv8zbj2HcACdG7G6
YiLFD8u8Guh3xppaa14uD+I=
=dkN/
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Pasky problem with 'git init URL'
  2005-04-21 21:26     ` Petr Baudis
@ 2005-04-22 12:44       ` John Stoffel
  0 siblings, 0 replies; 7+ messages in thread
From: John Stoffel @ 2005-04-22 12:44 UTC (permalink / raw)
  To: Petr Baudis; +Cc: John Stoffel, Martin Schlemmer, GIT Mailing Lists


Petr> Dear diary, on Thu, Apr 21, 2005 at 11:15:54PM CEST, I got a letter
Petr> where John Stoffel <john@stoffel.org> told me that...
>> >>>>> "Petr" == Petr Baudis <pasky@ucw.cz> writes:
>> 
Petr> Perhaps it would be useful to have some "command classes" (with at least
Petr> cg-*-(add|ls|rm)), like:
>> 
Petr> cg-branch-ls
Petr> cg-remote-rm
Petr> cg-tag-add
>> 
>> Does a standard like:
>> 
>> git <objecttype> <command> <args> [<obj> ...]

Petr> Isn't this basically what I was proposing? (Modulo the UI
Petr> changes related to git-pasky -> Cogito.)

I'm not quite upto speed on git, I was away on vacation when the list
started up and didn't catch it until just recently... 

And it is close to what you were proposing, but instead of dashes (-)
between the command and the object, I'm proposing just a space.
Actually, I'm proposing that we decide on a grammar and it's syntax
and to try and make it orthagonal and consistent.  Principal of least
surprises, etc.

Thanks,
John

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-04-22 12:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-21 16:21 Pasky problem with 'git init URL' Martin Schlemmer
2005-04-21 20:29 ` Petr Baudis
2005-04-21 21:15   ` John Stoffel
2005-04-21 21:26     ` Petr Baudis
2005-04-22 12:44       ` John Stoffel
2005-04-21 21:57     ` Fabian Franz
2005-04-21 21:17   ` Martin Schlemmer

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).