git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Mike Coleman <tutufan@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: suggested feature: someone mails me a blob, git please tell me what it is
Date: Sat, 17 Feb 2007 01:10:16 -0500	[thread overview]
Message-ID: <20070217061016.GA27813@spearce.org> (raw)
In-Reply-To: <3c6c07c20702160823j316c52f4pe4cf5ca8a882e194@mail.gmail.com>

Mike Coleman <tutufan@gmail.com> wrote:
> Here's a suggestion for a git feature, if git doesn't already have it.
> Since git generally doesn't use RCS-style keyword cookies (like
> "$Id$"), it'd be nice to have some other way to identify an installed
> file.  Perhaps you'd want to know exactly what rev a user is running,
> for example.
> 
> It seems like it should be fairly easy, given a blob (the file), for
> git to describe what it knows about it.  For example, it could provide
> a list of commits that it's a part of, etc.  It'd be *really* nice if
> only the output of the sha1sum command on the blob were needed.  (I
> can't recall exactly how git's blob SHA1's are computed--maybe this
> isn't feasible.)

Rather than embedding something like "$Id$" on a per-file basis
use the output of git-describe in your build process to insert the
string into your executable file(s), and then provide a way to let
the user extract it, or insert it with a unique enough pattern that
you can grep for it in the output of `strings`.

This is what git does itself.  We replace GIT_VERSION in git.c
with the output of git-describe during compile time (C preprocessor
macro).  The value can be printed by the user with `git version`.
We also embed it into some Perl scripts.

git-gui does the same thing, but is a Tcl/Tk script.

-- 
Shawn.

  parent reply	other threads:[~2007-02-17  6:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16 16:23 suggested feature: someone mails me a blob, git please tell me what it is Mike Coleman
2007-02-16 16:48 ` Nicolas Pitre
2007-02-16 17:14 ` Matthieu Moy
2007-02-16 17:37   ` Linus Torvalds
2007-02-17  6:10 ` Shawn O. Pearce [this message]
2007-02-17 21:40   ` Andy Parkins

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=20070217061016.GA27813@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=tutufan@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).