Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #4666

Re: git-describe

From Tom Anderson <twic@urchin.earth.li>
Newsgroups comp.lang.java.programmer
Subject Re: git-describe
Date 2011-05-27 23:51 +0100
Organization Stack Usenet News Service
Message-ID <alpine.DEB.2.00.1105272251580.1610@urchin.earth.li> (permalink)
References <irikq5$q0c$1@lust.ihug.co.nz> <alpine.DEB.2.00.1105261519520.19918@urchin.earth.li> <irmm2m$5a3$1@lust.ihug.co.nz>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Fri, 27 May 2011, Lawrence D'Oliveiro wrote:

> In message <alpine.DEB.2.00.1105261519520.19918@urchin.earth.li>, Tom
> Anderson wrote:
>
>> The problem with this is that the numbers record the sequence in which 
>> changesets were added to the current repository - which in the presence 
>> of commits on multiple machines (ie for any realistic development team) 
>> means that the numbers won't be the same in different repositories.
>
> Sounds like it’s more equivalent to what you might get out of a “reflog” 
> on Git. This is a purely personal, interim record of changes to the 
> repository, which is never pushed/pulled as part of the repository 
> itself, and can be purged (on demand) at any time.

Yes, it's somewhat like reflog. It's a bit more front-and-centre than 
reflog is, less of a hidden bonus feature, and it has a model that seems 
simpler to me: the numbers count the addition of changesets to the 
repository. Every changeset added, by whatever means, gets a number one 
higher than the previous one. Whereas reflog, if i've understood it right, 
numbers revisions by how recently they were the head. So the numbers 
change when you change what's head. I may have misunderstood this.

In the sense that it's personal and never pushed or pulled, though, yes, 
it's just like reflog. I wouldn't really call it interim.

>> Mercurial has a very slight edge here, in that as well as the hash-based
>> changeset IDs, it also has a sequential changeset number.
>
> As soon as I read this, I wondered what would happen to the numbering if 
> you did the Git equivalent of committing something, then abandoning that 
> commit (resetting that branch back to a prior commit) and making a new 
> one. This can’t just arise from mistakes; it’s recommended in the Git 
> docs as a handy way of saving temporary changes while working om 
> something else.

It's also the normal way of working in Mercurial (as long as 'resetting' 
doesn't mean 'throwing away'). Here's a brief session that illustrates 
what happens:

$ hg init branchy
$ cd branchy/
$ date >first
$ hg add
adding first
$ hg commit -m 'the beginning'
$ date >second
$ hg add
adding second
$ hg commit -m 'continuation'
$ # no, too boring, try again
$ hg glog
@  changeset:   1:43d273e49ff1
|  tag:         tip
|  user:        Tom Anderson <twic@urchin.earth.li>
|  date:        Fri May 27 23:44:00 2011 +0100
|  summary:     continuation
|
o  changeset:   0:be2fb6a06ade
    user:        Tom Anderson <twic@urchin.earth.li>
    date:        Fri May 27 23:43:45 2011 +0100
    summary:     the beginning

$ hg update 0
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hostname >second
$ hg add
adding second
$ hg commit -m "that's more like it"
created new head
$ hg glog
@  changeset:   2:0354ae380fea
|  tag:         tip
|  parent:      0:be2fb6a06ade
|  user:        Tom Anderson <twic@urchin.earth.li>
|  date:        Fri May 27 23:44:57 2011 +0100
|  summary:     that's more like it
|
| o  changeset:   1:43d273e49ff1
|/   user:        Tom Anderson <twic@urchin.earth.li>
|    date:        Fri May 27 23:44:00 2011 +0100
|    summary:     continuation
|
o  changeset:   0:be2fb6a06ade
    user:        Tom Anderson <twic@urchin.earth.li>
    date:        Fri May 27 23:43:45 2011 +0100
    summary:     the beginning

The punchline is that, as i said, the numbers record the sequence in which 
changeset were added to the repository. Changesets 1 and 2 are on 
different branches, but they happened in a chronological order, so they 
get numbers in that order.

This is a difference from reflog, where the numbers relate to each other, 
and you can do arithmetic with them.

>>> Exercise for the reader: what happens if you don’t specify “--tags”?
>>
>> States it as revisions from the initial checkin?
>
> Actually, no. It turns out there are two different kinds of tags, and 
> which one is used depends on this option.

That's the kind of thing that's the reason i don't use git.

tom

-- 
Initial thoughts - who cares? Subsequent thoughts - omg!!! (Female, 14,
Scotland) -- 4.5 million young Brits' futures could be compromised by
their electronic footprint, Information Commissioner's Office

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

git-describe Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-25 22:14 +1200
  Re: git-describe Tom Anderson <twic@urchin.earth.li> - 2011-05-26 17:59 +0100
    Re: git-describe Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-27 11:00 +1200
      Re: git-describe Tom Anderson <twic@urchin.earth.li> - 2011-05-27 23:51 +0100
        Re: git-describe Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-28 14:34 +1200
          Re: git-describe Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-05-27 23:21 -0400
            Re: git-describe Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-05-28 16:29 +1200
              Re: git-describe Tom Anderson <twic@urchin.earth.li> - 2011-05-29 00:33 +0100
          Re: git-describe Tom Anderson <twic@urchin.earth.li> - 2011-05-29 00:25 +0100

csiph-web