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

Re: [Bug] %[a|c]d placeholder does not respect --date= option in combination with git archive

From
Jeff King <peff@peff.net>
Date
Mar 3, 2011, 15:10 UTC
Message-ID
<20110303151019.GC1074@sigill.intra.peff.net>
In-Reply-To
<4D6F5FA8.5030105@gmx.de>
On Thu, Mar 03, 2011 at 10:30:16AM +0100, Dietmar Winkler wrote:
Show 13 quoted lines
> In my file I have the place holder $Format:%ad$ and in .git/config the
> setting log.date = short is present.
> [...]
> Now if I run on the same repo
> 	git archive --format=zip HEAD -o out.zip
> and check the place holder in the exported zip file it is actually
> replaced with:
> 
> Thu, 3 Mar 2011 10:06:43 +0100
> 
> and not
> 
> 2011-03-03

I am not sure that this is a bug. The log.date parameter is about the log command, not necessarily other format substitutions. If it were any other date format, I would say the right answer is that you should be using one of the format-specific date specifiers. But annoyingly, there is no such specifier for "short". Which means there is no way to actually get the output that you want.

I remember at some point discussing extending the specifier syntax to allow things like "%(ad,date=short)", but it was never implemented. I think that would be the cleanest way to do what you want.

The second cleanest would be adding an archive.date variable. Which is much simpler, obviously. But I think making "log.date" start applying to archive substitutions is going to surprise some people and possibly break their setups.

-Peff
Previous: Dietmar WinklerNext: Dietmar Winkler
Message 2 of 15 in “[Bug] %[a|c]d placeholder does not respect --date= option in combination with git archive”
  1. Dietmar WinklerMar 3, 2011
  2. Jeff KingMar 3, 2011
  3. Dietmar WinklerMar 4, 2011
  4. Jeff KingMar 5, 2011
  5. 1/2 pretty.c: give format_person_part the whole placeholderJeff King, Mar 5, 2011
  6. 2/2 pretty.c: allow date formats in user format stringsJeff King, Mar 5, 2011
  7. Fwd: [PATCH 2/2] pretty.c: allow date formats in user format stringsWill Palmer, Mar 6, 2011
  8. Jeff KingMar 7, 2011
  9. Will PalmerMar 7, 2011
  10. Will PalmerMar 7, 2011
  11. Jeff KingMar 7, 2011
  12. Will PalmerMar 8, 2011
  13. Junio C HamanoMar 9, 2011
  14. Jeff KingMar 10, 2011
  15. Dietmar WinklerMar 11, 2011

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.