git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: Marco Costalba <mcostalba@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [Qgit RFC] commit --amend
Date: Thu, 5 Jul 2007 20:54:26 +0200	[thread overview]
Message-ID: <20070705185426.GB3991@efreet.light.src> (raw)
In-Reply-To: <e5bfff550706102245p27aea579w65ee96161630a624@mail.gmail.com>

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

Hello,

On Mon, Jun 11, 2007 at 07:45:51 +0200, Marco Costalba wrote:
> On 6/11/07, Jan Hudec <bulb@ucw.cz> wrote:
>> I think I mostly understood it now. Thank you.
>
> Anyhow I think this could be useful to you:
>
> 	/*
> 	   getAllRefSha() returns the list of sha of a given
> 	   type, where type is a mask of Git::RefType flags
> 	   see src/git.h.
> 	   In this case we want the sha of the current branch
> 	*/
> 	QStringList revs = getAllRefSha(CUR_BRANCH);
> 	
> 	if (!revs.isEmpty()) {
>
> 		// all the sha info is stored in this QGit::Rev
> 		// class defined in src/common.h
> 		const Rev* r = revLookup(revs.first());
>
> 		// short log (title) is
> 		r->shortLog();
>
> 		// message body is
> 		r->longLog();
>
> 		// etc....
> 	}

I thought I should be using something more explicit. Like getRefSha("HEAD",
ANY_REF, false) -- only to find that it wouldn't work. That means that this
code would not work either. Why? Well, because HEAD does not have to be
a symbolic ref. If you check out anything else than branch (which you can),
HEAD will be set to the SHA1 directly and if you commit in such state (which
you also can), the HEAD will be different from anything in refs/.

Therefore I'll either have to always ask git via run("git-rev-parse HEAD",
head), add HEAD into the map, or store HEAD somewhere in the Git object.
Which do you think makes most sense?

(Note: Yes, I noted that getRefSha("HEAD", ANY_REF, true) should work, but of
course that is the run("git-rev-parse HEAD") case.

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2007-07-05 18:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-10 15:08 [Qgit RFC] commit --amend Jan Hudec
2007-06-10 22:10 ` Marco Costalba
2007-06-11  4:42   ` Jan Hudec
2007-06-11  5:24     ` Marco Costalba
2007-06-11  5:45     ` Marco Costalba
2007-07-01 12:26       ` Jan Hudec
2007-07-01 16:09         ` Marco Costalba
2007-07-02 18:03           ` Jan Hudec
2007-07-04  5:10             ` Junio C Hamano
2007-07-04 12:44               ` Marco Costalba
2007-07-04 18:28                 ` Jan Hudec
2007-07-04 19:51                   ` Junio C Hamano
2007-07-06  7:54                   ` Marco Costalba
2007-07-05 18:54       ` Jan Hudec [this message]
2007-07-06  8:12         ` Marco Costalba
2007-07-08 13:38           ` Jan Hudec
2007-07-08 13:49             ` Marco Costalba

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=20070705185426.GB3991@efreet.light.src \
    --to=bulb@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=mcostalba@gmail.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).