Re: [Qgit RFC] commit --amend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Mon, Jun 11, 2007 at 07:45:51 +0200, Marco Costalba wrote:
> On 6/11/07, Jan Hudec <bulb@xxxxxx> 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@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux