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

Bug in "git show"?

From
Stefan Beller <stefanbeller@googlemail.com>
Date
Jul 15, 2013, 11:25 UTC
Message-ID
<51E3DC47.70107@googlemail.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,

so I wanted to write a script using some git commands, but the output of the git commands is not as expected. I am using

git --version git version 1.8.3.2.804.g0da7a53 (current origin/master at git://github.com/gitster/git.git)

The command I am trying to use is git --no-pager show --format="%ad" <commit>

Expected output: sb@sb:~/OSS/git$ git show --format="%ad" 0da7a53^ Fri Jul 12 12:04:19 2013 -0700

sb@sb:~/OSS/git$ git show --format="%ad" 0da7a53^^ Fri Jul 12 12:04:17 2013 -0700

sb@sb:~/OSS/git$ git show --format="%ad" 0da7a53^^^ Fri Jul 12 12:04:16 2013 -0700

sb@sb:~/OSS/git$ git show --format="%ad" 0da7a53^^^^ Fri Jul 12 12:04:14 2013 -0700

sb@sb:~/OSS/git$ git show --format="%ad" 0da7a53^^^^^ Fri Jul 12 12:04:12 2013 -0700

sb@sb:~/OSS/git$ git show --format="%ad" 0da7a53^^^^^^ Fri Jul 12 12:04:10 2013 -0700

sb@sb:~/OSS/git$ git show --format="%ad" 0da7a53^^^^^^^ Fri Jul 12 12:04:09 2013 -0700

sb@sb:~/OSS/git$ git show --format="%ad" 0da7a53^^^^^^^^ Fri Jul 12 12:04:07 2013 -0700

However I sometimes also get: sb@sb:~/OSS/git$ git show --format="%ad" 0da7a53 Fri Jul 12 10:49:34 2013 -0700

diff --git a/Documentation/RelNotes/1.8.4.txt
b/Documentation/RelNotes/1.8.4.txt
index 0e50df8..4250e5a 100644
- --- a/Documentation/RelNotes/1.8.4.txt
+++ b/Documentation/RelNotes/1.8.4.txt
@@ -79,6 +79,13 @@ Foreign interfaces, subsystems and ports.

 UI, Workflows & Features

+ * "gitweb" learned to optionally place extra links that point at the
+   levels higher than the Gitweb pages themselves in the breadcrumbs,
+   so that it can be used as part of a larger installation.
+
+ * "git log --format=" now honors i18n.logoutputencoding configuration
+   variable.
+
  * The "push.default=simple" mode of "git push" has been updated to
    behave like "current" without requiring a remote tracking
    information, when you push to a remote that is different from where


sb@sb:~/OSS/git$ git show --format="%ad" 0da7a53^^^^^^^^
Fri Jul 12 12:04:07 2013 -0700

diff --cc t/t5505-remote.sh
index ee5d65d,8d0f3e3..8f6e392
- --- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@@ -61,25 -62,25 +61,25 @@@ test_expect_success C_LOCALE_OUTPUT 're
  '

  test_expect_success 'add another remote' '
 -(
 -      cd test &&
 -      git remote add -f second ../two &&
 -      tokens_match "origin second" "$(git remote)" &&
 -      check_tracking_branch second master side another &&
 -      git for-each-ref "--format=%(refname)" refs/remotes |
 -      sed -e "/^refs\/remotes\/origin\//d" \
 -          -e "/^refs\/remotes\/second\//d" >actual &&
 -      >expect &&




So at some commits, also the diff is shown, which should not happen
if you're using --format="%ad" to my understanding.

So far it seems to be deterministic here. (Each commit either always
behaves correctly or incorrectly). Initially I suspected it being
different for merges or no-merges, but I gut the unexpected behavior
for both merge and non-merge commits.

Can somebody confirm this behavior or has any idea, whether I am doing
something wrong here?

Thanks,
Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQIcBAEBAgAGBQJR49xHAAoJEJQCPTzLflhqiFcP/0S5M71urjn1Fh5Cz2950wBl
cs6+r9wKF5366wv3Ombfh0KrOPQCE7Yv1GWk2r2L008BWrz0wgnsl1xnMnAT00dH
1WzmupWExxwXHAueDisq2qL4dubFrnVxKWvpwxBd3JBbsWNXeTGl5o6dl69zaXdx
JHzIHvw1/vrxoCLaflitjcQezuFITOVVoNsYawK12gznjxujONm0sej5TBFUw784
K5KTJNJqxzUf9+Z+88hg2oif7kJlugTIqtH5sRMVwXrkpc12f+HcwROg0srE5ITc
8WpK0s7xgZokUCohMhUXlLAOYJwAZju+K1LExkrQ9T32oP4iAKsJpqcRLAAX6Ig7
OeaWUQ2WX2CfYDExjuV6h+FXAU0qT87iv3PgeZWAnmgDQPUwFboIxuF1Nrpq/FOY
Ioe2YOsFOdhmuDjCHEfu0aVNOeejHS8LEkC1IUI/+PzDlEJC/b17SwEdrD4aVCPj
RZhz2zI8ZxYHP9ITvMDs1VQRP6jMSAwEtAWg7ac7ypETToOIAxRp2j9Rrjayt8A5
/TZ++wMh7G4Tm/D9+iutQnqzE8E8eiT6i7LgAcDSA3g6oq7/hUzupKU2lc+znO2J
wxiwdqYBHWtw1Jc8eaZAJC/NMfxbRzOSCx4lJbO+tpXP0pR/OPIg2f2wUXcAh3zH
JC9GdEUVIwN34j2ueoZ8
=G6Oc
-----END PGP SIGNATURE-----
Next: Matthieu Moy
Message 1 of 43 in “Bug in "git show"?”
  1. Stefan BellerJul 15, 2013
  2. Matthieu MoyJul 15, 2013
  3. Stefan BellerJul 15, 2013
  4. 0/5 Make "git show -s" easier to discover for usersMatthieu Moy, Jul 15, 2013
  5. 1/5 diff: allow --no-patch as synonym for -sMatthieu Moy, Jul 15, 2013
  6. 2/5 diff: allow --patch to override -s/--no-patchMatthieu Moy, Jul 15, 2013
  7. Junio C HamanoJul 15, 2013
  8. Matthieu MoyJul 15, 2013
  9. Junio C HamanoJul 15, 2013
  10. 0/5 Make "git show -s" easier to discover for usersMatthieu Moy, Jul 15, 2013
  11. 1/5 diff: allow --no-patch as synonym for -sMatthieu Moy, Jul 15, 2013
  12. Jonathan NiederJul 15, 2013
  13. 0/6 Make "git show -s" easier to discover for usersMatthieu Moy, Jul 15, 2013
  14. 1/6 t4000-diff-format.sh: modernize styleMatthieu Moy, Jul 15, 2013
  15. Jonathan NiederJul 15, 2013
  16. 2/6 diff: allow --no-patch as synonym for -sMatthieu Moy, Jul 15, 2013
  17. 3/6 diff: allow --patch & cie to override -s/--no-patchMatthieu Moy, Jul 15, 2013
  18. Jonathan NiederJul 15, 2013
  19. Matthieu MoyJul 15, 2013
  20. Jonathan NiederJul 15, 2013
  21. 0/6 Make "git show -s" easier to discover for usersMatthieu Moy, Jul 16, 2013
  22. 1/6 t4000-diff-format.sh: modernize styleMatthieu Moy, Jul 16, 2013
  23. 2/6 diff: allow --no-patch as synonym for -sMatthieu Moy, Jul 16, 2013
  24. 3/6 diff: allow --patch & cie to override -s/--no-patchMatthieu Moy, Jul 16, 2013
  25. 4/6 Documentation/git-show.txt: include common diff options, like git-log.txtMatthieu Moy, Jul 16, 2013
  26. 5/6 Documentation: move description of -s, --no-patch to diff-options.txtMatthieu Moy, Jul 16, 2013
  27. 6/6 Documentation/git-log.txt: capitalize section namesMatthieu Moy, Jul 16, 2013
  28. Jonathan NiederJul 16, 2013
  29. Stefan BellerJul 16, 2013
  30. Junio C HamanoJul 18, 2013
  31. 4/6 Documentation/git-show.txt: include common diff options, like git-log.txtMatthieu Moy, Jul 15, 2013
  32. 5/6 Documentation: move description of -s, --no-patch to diff-options.txtMatthieu Moy, Jul 15, 2013
  33. 6/6 Documentation/git-log.txt: capitalize section namesMatthieu Moy, Jul 15, 2013
  34. Jonathan NiederJul 15, 2013
  35. 2/5 diff: allow --patch & cie to override -s/--no-patchMatthieu Moy, Jul 15, 2013
  36. 3/5 Documentation/git-show.txt: include common diff options, like git-log.txtMatthieu Moy, Jul 15, 2013
  37. 4/5 Documentation: move description of -s, --no-patch to diff-options.txtMatthieu Moy, Jul 15, 2013
  38. 5/5 Documentation/git-log.txt: capitalize section namesMatthieu Moy, Jul 15, 2013
  39. 3/5 Documentation/git-show.txt: include common diff options, like git-log.txtMatthieu Moy, Jul 15, 2013
  40. Junio C HamanoJul 15, 2013
  41. Junio C HamanoJul 15, 2013
  42. 4/5 Documentation: move description of -s, --no-patch to diff-options.txtMatthieu Moy, Jul 15, 2013
  43. 5/5 Documentation/git-log.txt: capitalize section namesMatthieu Moy, Jul 15, 2013

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.