[fpc-pascal] Re: [Semi-OT] How to get remote Git revision number (or last update date) using FPC+git executable

Reinier Olislagers reinierolislagers at gmail.com
Thu Aug 4 13:48:48 CEST 2011


On 4-8-2011 13:39, Graeme wrote:
> On 4 August 2011 12:58, Reinier Olislagers wrote:
>>
>> 1. The program checks for the current git revision "number" (a hex
>> string in fact) of the local copy.
> I believe you are referring to the SHA1 value.
I think you believe correctly ;)
> 
>> How do I find out, using FreePascal and a git executable:
>> 1. (Preferably - so I can match behaviour between the git and svn parts
>> of the program) the remote git revision
>> 2. If the local copy needs updating, i.e. the remote copy is newer.
> 
> Why check for it first, why not just do a 'git pull origin' and be done with it.
I'd like to, but the program as used for svn currently shows current
local revision and only updates if there are differences with a remote
revision.
If possible, I'd like to keep behaviour the same for git...
But I agree, it might be simpler just to do a pull..
> 
> But, if you really want to inspect the HEAD revision's SHA1 value of a
> remote repository, you can use the following command:
> 
>   $ git ls-remote origin HEAD
Exactly what I needed, thanks. I knew it must be possible, but just
couldn't find it.

Dankie,
Reinier



More information about the fpc-pascal mailing list