git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Commiting unchanged tree
@ 2010-09-18  8:15 Maaartin
  2010-09-18  9:30 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 2+ messages in thread
From: Maaartin @ 2010-09-18  8:15 UTC (permalink / raw)
  To: git

I thought that calling

git commit --amend -m "A message"

twice in a row should lead to an error saying "nothing to commit (working 
directory clean)", but it doesn't. Or at least, the result of the second commit 
should be the same as the result of the first one, but I keep getting a 
different hash each time

# git commit --amend -m "A message"
[master b8cf1c2] A message
# git commit --amend -m "A message"
[master 6c8ea30] A message
# git commit --amend -m "A message"
[master be318b3] A message

I wonder if everything is fine with my repo since I was doing some funny 
rebasing and filtering and I'm quite new to git.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Commiting unchanged tree
  2010-09-18  8:15 Commiting unchanged tree Maaartin
@ 2010-09-18  9:30 ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 2+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-09-18  9:30 UTC (permalink / raw)
  To: Maaartin; +Cc: git

On Sat, Sep 18, 2010 at 08:15, Maaartin <grajcar1@seznam.cz> wrote:
> I thought that calling
>
> git commit --amend -m "A message"
>
> twice in a row should lead to an error saying "nothing to commit (working
> directory clean)", but it doesn't. Or at least, the result of the second commit
> should be the same as the result of the first one, but I keep getting a
> different hash each time
>
> # git commit --amend -m "A message"
> [master b8cf1c2] A message
> # git commit --amend -m "A message"
> [master 6c8ea30] A message
> # git commit --amend -m "A message"
> [master be318b3] A message
>
> I wonder if everything is fine with my repo since I was doing some funny
> rebasing and filtering and I'm quite new to git.

This is expected behavior. You're telling Git to amend the latest
commit with a new commit message (which happens to be equivalent to
the old one), and your sha1 keeps changing because the `commiter` time
entry in the commit changes every time you commit (well, with a
granularity of 1 second):

    v foo (master) $ git commit --amend -m"blah"; GIT_PAGER=cat git
show --pretty=raw
    [master 9cc96c7] blah
     0 files changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 blah
    commit 9cc96c71ae30f94afaf891be58671a0adf89cedb
    tree c4bf67b477e5e7470266b4227a664f7b175c9d4a
    author Ævar Arnfjörð Bjarmason <avarab@gmail.com> 1284802065 +0000
    committer Ævar Arnfjörð Bjarmason <avarab@gmail.com> 1284802096 +0000

        blah

    diff --git a/blah b/blah
    new file mode 100644
    index 0000000..e69de29
    v foo (master) $ git commit --amend -m"blah"; GIT_PAGER=cat git
show --pretty=raw
    [master bc71b18] blah
     0 files changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 blah
    commit bc71b18ae254b33e895ee840825bf357baa40e00
    tree c4bf67b477e5e7470266b4227a664f7b175c9d4a
    author Ævar Arnfjörð Bjarmason <avarab@gmail.com> 1284802065 +0000
    committer Ævar Arnfjörð Bjarmason <avarab@gmail.com> 1284802097 +0000

        blah

    diff --git a/blah b/blah
    new file mode 100644
    index 0000000..e69de29
    v foo (master) $

Note the difference between 1284802096 and 1284802097 there.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-18  9:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-18  8:15 Commiting unchanged tree Maaartin
2010-09-18  9:30 ` Ævar Arnfjörð Bjarmason

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).