git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Dan Loewenherz <dloewenherz@gmail.com>
Cc: Andreas Ericsson <ae@op5.se>, takeshin <admirau@gmail.com>,
	git@vger.kernel.org
Subject: Re: update @version in file
Date: Wed, 13 May 2009 18:56:44 +0200	[thread overview]
Message-ID: <200905131856.46344.jnareb@gmail.com> (raw)
In-Reply-To: <20090513160415.GA4097@andros.launchmodem.com>

On Wed, 13 May 2009, Dan Loewenherz wrote:
> On 13/05/09 02:42 -0700, Jakub Narebski wrote:
> > Andreas Ericsson <ae@op5.se> writes:

> > > No, but see GIT-VERSION-GEN and "git help describe" for info on how to
> > > replace such version tags using a script when you cut a release of your
> > > project.
> 
> Couldn't Git be a little more friendly? 

No, Git cannot have that feature.

> You can choose to ignore an uncommitted file through the `git update-index 
> --assume-unchanged` command. But AFAIK, Git doesn't allow one to ignore 
> uncommitted _lines_ in tracked files. If this feature were implemented, a 
> post commit hook could write in the latest commit hash and git wouldn't care.

No, I am afraid it is not possible. Let me explain

1. Git doesn't touch files which didn't change during rewinding (going
   back in history, perhaps to start development of maintenance branch,
   or doing bisection of history to find commit which introduced a bug),
   and when switching branches. If keyword expansion was about *commit*
   information (like description/decoration e.g. 'v1.6.3-17-g35805ce',
   or author, or change date) then when switching branches (going to
   other commit, with other info) you would have to rewrite all files.
   This would very badly affect performance. Also, when committing you
   would have to rewrite all files.

2. If you wanted however to have *file* version (like in CVS), then it
   is impossible because Git doesn't store such info (well, beside
   blob id of a contents of a file, but that is not exactly a version
   number); moreover it doesn't make much sense to know such number.
   It is next to useless; it is changesets that matter. CVS has it
   because it evolved from file-based version control system, only
   cobbled together.
 
> Is this something that is worth pursuing?

You can write your own clear/smudge filters if you are stubborn
about having version info in files which are under version control
(and you can ask SCM at which version you are), rather than adding
version info on release (so the program can support --version option).
-- 
Jakub Narebski
Poland

  reply	other threads:[~2009-05-13 16:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-13  8:59 update @version in file takeshin
2009-05-13  9:11 ` Andreas Ericsson
2009-05-13  9:22   ` takeshin
2009-05-13  9:42   ` Jakub Narebski
2009-05-13 16:04     ` Dan Loewenherz
2009-05-13 16:56       ` Jakub Narebski [this message]
2009-05-13 17:05         ` Matthieu Moy
2009-05-13 17:38           ` Andreas Ericsson
2009-05-13 23:02           ` Jakub Narebski
2009-05-14  7:08             ` Matthieu Moy

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=200905131856.46344.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=admirau@gmail.com \
    --cc=ae@op5.se \
    --cc=dloewenherz@gmail.com \
    --cc=git@vger.kernel.org \
    /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).