delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to geda-user-bounces using -f |
X-Recipient: | geda-user AT delorie DOT com |
Message-ID: | <20140311220919.2214.qmail@stuge.se> |
Date: | Tue, 11 Mar 2014 23:09:19 +0100 |
From: | Peter Stuge <peter AT stuge DOT se> |
To: | geda-user AT delorie DOT com |
Subject: | Re: [geda-user] how to get the version nr (or similar) |
Mail-Followup-To: | geda-user AT delorie DOT com |
References: | <20140311151052 DOT 109D48020170 AT turkos DOT aspodata DOT se> |
MIME-Version: | 1.0 |
In-Reply-To: | <20140311151052.109D48020170@turkos.aspodata.se> |
Reply-To: | geda-user AT delorie DOT com |
Errors-To: | nobody AT delorie DOT com |
X-Mailing-List: | geda-user AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
karl AT aspodata DOT se wrote: > How can I identify if a given file is handled by git/cvs/svn/hg ? git ls-tree HEAD path/in/repo/with/file | \ awk '{if ("blob" == $2 && "file.c" == $4) exit(1);}' || echo is_handled > If I know that, how can I get the version number of the file ? git doesn't version files. $3 in the ls-tree line for the blob is the object id for the blob in HEAD corresponding to the file but that is a very low-level identifier which isn't too useful. As a side note, in git diff output and in patches: diff --git a/file.c b/file.c index e430679..c37fa54 100644 --- a/file.c +++ b/file.c ..the index line hashes are abbreviated old and new blob object ids. But for git, use either the commit or a tag. I use: git describe --tags ..to get a pretty identifier for tag or commit. The repo does need to have at least one tag for this to work nicely. If yours doesn't yet, then either use only the commit id or create a tag. The describe output format is $tag-$number_of_commits_since_tag-g$lastcommitid //Peter
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |