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

Re: [PATCH 0/3] Fixing volatile HEAD in push.default = current

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
May 23, 2013, 07:55 UTC
Message-ID
<CALkWK0mfGWA3aBntQQU5fkCJDPx+MUOScvMRJjS+JzjNucFzPw@mail.gmail.com>
In-Reply-To
<7vppwjj5ws.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 6 quoted lines
>     I have "largedir" I want to get rid of, but there is a directory
>     I want to save, "largedir/precious", in it, so I do
>
>         cp -R largedir/precious precious
>
>     and then run 'rm -rf largedir' in another terminal in parallel.

I would argue that there is something to "fix", but that fix involves making the cp a purely atomic operation which is super-complicated, and totally not worth it. Would you _not_ like the above example to work? Then how can you say that there's nothing to be fixed?

Consider a slightly different example: I rename a file while having an
active file handle open in a process that's reading the file.  Will
the rename fail or will the fread() in the process fail?  Nope, both
work fine.  Replace "rename" with "remove", and we still have the same
answer.  Ofcourse there are no guarantees: I can start up another
process to overwrite the sectors corresponding to that file's data
with zeros; unless the complete file is there in the kernel buffer, a
read() will eventually end up slurping in the zeros (or fail?), right?
 It's just that it works in practice.

Yet another example: I have a terminal pointing to a directory, and I remove that directory in another terminal. When I switch back to the original terminal, I can't cd .., because getcwd() fails. This has annoyed me endlessly in practice, and I would really like to fix this if I can.

Don't accept the way things are, and assume that there's nothing to be "fixed". In my opinion, if something about a piece of software annoys you, there is always something to fix. It just depends on what _can_ be fixed in a reasonable amount of time with a good engineering solution. There's no need to go to the other extreme: I'm not interested in rewriting the whole operating system in Haskell and providing theoretical guarantees for everything.

Coming back to our push example, I don't see why you think HEAD is special: I could even say git push master and expect it to race with an update-ref. But nobody is complaining about that: if someone does complain, I would seriously consider copying master to PUSH_HEAD early (and push that). With HEAD, however, someone is complaining (namely, me): pushing usually means that I've finished working on that branch, and want to switch to another branch and continue working. Why should I have to wait for the push to complete? I've hit this bug several times (from terminal as well as Magit), and this patch fixes the problem for me in practice.

That said, I agree that my patch does not guarantee anything (and I will modify my commit message to clarify this). I'm just expressing my opinion on the issue of "fixing problems".

Previous: Junio C HamanoNext: Andreas Krey
Message 13 of 17 in “Fixing volatile HEAD in push.default = current”
  1. 0/3 Fixing volatile HEAD in push.default = currentRamkumar Ramachandra, May 21, 2013
  2. 1/3 push: factor out the detached HEAD error messageRamkumar Ramachandra, May 21, 2013
  3. 2/3 push: fail early with detached HEAD and currentRamkumar Ramachandra, May 21, 2013
  4. 3/3 push: don't push the volatile HEAD with currentRamkumar Ramachandra, May 21, 2013
  5. Junio C HamanoMay 21, 2013
  6. Ramkumar RamachandraMay 21, 2013
  7. Junio C HamanoMay 21, 2013
  8. Junio C HamanoMay 21, 2013
  9. Ramkumar RamachandraMay 21, 2013
  10. Junio C HamanoMay 22, 2013
  11. Ramkumar RamachandraMay 22, 2013
  12. Junio C HamanoMay 22, 2013
  13. Ramkumar RamachandraMay 23, 2013
  14. Andreas KreyMay 23, 2013
  15. Junio C HamanoMay 23, 2013
  16. Andreas KreyMay 23, 2013
  17. Junio C HamanoMay 23, 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.