git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Implementing $Date$ substitution - problem with git status

From
Peter Krefting <peter@softwolves.pp.se>
Date
Aug 10, 2009, 04:41 UTC
Message-ID
<alpine.DEB.2.00.0908100535150.17908@ds9.cixit.se>
In-Reply-To
<200908092252.58363.j6t@kdbg.org>
Johannes Sixt:
> The clean filter is applied before 'git diff' generates the diff. Since you
> have unstaged changes (I take [...] to mean this), you see a new date on
> every invocation.

Sorry for being unclear; no, the $Date$ line is the only change that shows up. I removed the surrounding context because I didn't want to publish them.

On another machine, there is another file that exhibits the same problem.
> After 'git add .htaccess' subsequent 'git diff' should not show any changes.
But then I need to check it in again, and I'd like to avoid that, if possible.

Is it possible to have a filter run on "commit" instead of "add"? (Or is "commit" just moving changes from the index to the repository, making that impossible?)

Show 6 quoted lines
>> Doing "git reset --hard" or "git checkout master filename" does not 
>> help, the file is still believed to be modified by git.
>
> Now, that's an entirely different problem, and I think that there is a 
> bug. I have observed this as well with my own clean filter sometimes, but 
> not always. I haven't found a recipe that reliably exhibits the problem.
It seems to be triggered by using my date script and doing
   git add file
   git commit file
   git reset --hard file

the last command gives me a local copy with the keyword expanded, but marked dirty.

Is it possible to have "git add" expand the keyword (both the Git-internal "ident", i.e "$Id$", and my "$Date$")? Would duplicating the "clean" filter as a "smudge" one accomplish that?

-- 
\\// Peter - http://www.softwolves.pp.se/
Previous: Johannes SixtNext: Peter Krefting
Message 3 of 8 in “Implementing $Date$ substitution - problem with git status”
  1. Peter KreftingAug 9, 2009
  2. Johannes SixtAug 9, 2009
  3. Peter KreftingAug 10, 2009
  4. Peter KreftingAug 12, 2009
  5. Problems with filters and git status - reproduction stepsPeter Krefting, Aug 12, 2009
  6. Michael J GruberAug 12, 2009
  7. Peter KreftingAug 12, 2009
  8. Implementing $Date$ substitution - solution using pre-commitPeter Krefting, Aug 13, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.