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

Re: git push to a non-bare repository

From
Theodore Tso <tytso@mit.edu>
Date
Mar 19, 2007, 03:21 UTC
Message-ID
<20070319032130.GF11371@thunk.org>
In-Reply-To
<20070319025603.GG20658@spearce.org>
On Sun, Mar 18, 2007 at 10:56:03PM -0400, Shawn O. Pearce wrote:
Show 5 quoted lines
> The reflog does update if the log file exists during a push (err,
> actually during receive-pack).  Or if core.logAllRefUpdates is set
> to true.  Now this isn't the default in a bare repository, but it
> should be the default in a repository with a working directory.
> So the case we are talking about should be seeing the reflog update.

So I dug a little more deeply, and the problem is that the reflog for master was getting updated, but not the reflog for HEAD, and that's what "git reflog" was showing --- hence my confusion.

What are the rules for when HEAD's reflog should get updated, and is this documented anywhere in the man pages?

						- Ted
Script started on Sun 18 Mar 2007 11:11:59 PM EDT
Top-level shell (parent script)
Using ssh-agent pid 7679
<tytso@candygram> {/home/tytso/talks/dscm/git}  
1% cp -r test1 test2 ; cd test2
<tytso@candygram> {/home/tytso/talks/dscm/git/test2}  
2% (cd r2; git-config core.logallrefupdates)
true
<tytso@candygram> {/home/tytso/talks/dscm/git/test2}  
3% cat r2/.git/refs/heads/master
f2e3cc0bb64c8c94b89ba07bfbdd1653584586f2
<tytso@candygram> {/home/tytso/talks/dscm/git/test2}  
4% cat r2/.git/logs/HEAD
0000000000000000000000000000000000000000 f2e3cc0bb64c8c94b89ba07bfbdd1653584586f2 Theodore Ts'o <tytso@mit.edu> 1174266825 -0400
<tytso@candygram> {/home/tytso/talks/dscm/git/test2}  
5% cat r2/.git/logs/refs/heads/master
0000000000000000000000000000000000000000 f2e3cc0bb64c8c94b89ba07bfbdd1653584586f2 Theodore Ts'o <tytso@mit.edu> 1174266825 -0400
<tytso@candygram> {/home/tytso/talks/dscm/git/test2}  
6% (cd r1 ; git push ../r2)
updating 'refs/heads/master'
  from f2e3cc0bb64c8c94b89ba07bfbdd1653584586f2
  to   37508dc11dbe274d021124057fd2d027f6ce9d17
Generating pack...
Done counting 5 objects.
Result has 3 objects.
Deltifying 3 objects.
 100% (3/3) done
Writing 3 objects.
 100% (3/3) done
Total 3 (delta 2), reused 0 (delta 0)
Unpacking 3 objects
  100% (3/3) done
refs/heads/master: f2e3cc0bb64c8c94b89ba07bfbdd1653584586f2 -> 37508dc11dbe274d021124057fd2d027f6ce9d17
<tytso@candygram> {/home/tytso/talks/dscm/git/test2}  
7% cd r2
<tytso@candygram> {/home/tytso/talks/dscm/git/test2/r2}  [master]
8% cat .git/refs/heads/master
37508dc11dbe274d021124057fd2d027f6ce9d17
<tytso@candygram> {/home/tytso/talks/dscm/git/test2/r2}  [master]
9% cat .git/logs/HEAD
0000000000000000000000000000000000000000 f2e3cc0bb64c8c94b89ba07bfbdd1653584586f2 Theodore Ts'o <tytso@mit.edu> 1174266825 -0400
<tytso@candygram> {/home/tytso/talks/dscm/git/test2/r2}  [master]
10% cat .git/logs/refs/heads/master
0000000000000000000000000000000000000000 f2e3cc0bb64c8c94b89ba07bfbdd1653584586f2 Theodore Ts'o <tytso@mit.edu> 1174266825 -0400
f2e3cc0bb64c8c94b89ba07bfbdd1653584586f2 37508dc11dbe274d021124057fd2d027f6ce9d17 Theodore Ts'o <tytso@mit.edu> 1174274004 -0400	push
<tytso@candygram> {/home/tytso/talks/dscm/git/test2/r2}  [master]
11% git reflog
37508dc... HEAD@{0}: 
<tytso@candygram> {/home/tytso/talks/dscm/git/test2/r2}  [master]
13% git version
git version 1.5.0.5.425.g9cec6-dirty
<tytso@candygram> {/home/tytso/talks/dscm/git/test2/r2}  [master]
14% exit
Script done on Sun 18 Mar 2007 11:14:28 PM EDT
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 11 of 27 in “git push to a non-bare repository”
  1. Matthieu MoyMar 18, 2007
  2. Junio C HamanoMar 18, 2007
  3. Sam VilainMar 18, 2007
  4. Jakub NarebskiMar 18, 2007
  5. Junio C HamanoMar 18, 2007
  6. Theodore TsoMar 19, 2007
  7. Junio C HamanoMar 19, 2007
  8. Shawn O. PearceMar 19, 2007
  9. Theodore TsoMar 19, 2007
  10. Shawn O. PearceMar 19, 2007
  11. Theodore TsoMar 19, 2007
  12. Shawn O. PearceMar 19, 2007
  13. Nicolas PitreMar 19, 2007
  14. Theodore TsoMar 19, 2007
  15. Junio C HamanoMar 19, 2007
  16. Nicolas PitreMar 19, 2007
  17. Nicolas PitreMar 19, 2007
  18. Sam VilainMar 19, 2007
  19. Junio C HamanoMar 20, 2007
  20. Junio C HamanoMar 20, 2007
  21. Theodore TsoMar 19, 2007
  22. Shawn O. PearceMar 19, 2007
  23. Junio C HamanoMar 19, 2007
  24. Matthieu MoyMar 19, 2007
  25. Jakub NarebskiMar 19, 2007
  26. Neil SchemenauerMar 21, 2007
  27. Sergio CallegariMar 19, 2007

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.