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

Re: [Census] So who uses git?

From
Nicolas Pitre <nico@cam.org>
Date
Feb 1, 2006, 17:18 UTC
Message-ID
<Pine.LNX.4.64.0602011125370.5397@localhost.localdomain>
In-Reply-To
<7v4q3jlgw2.fsf@assigned-by-dhcp.cox.net>
On Tue, 31 Jan 2006, Junio C Hamano wrote:
Show 15 quoted lines
> This "I thought I was only checking in the two-liner I did as
> the last step but you committed the whole thing, stupid git!"
> confusion feels to be a parallel of "I thought I was only
> checking in the files I specified on the command line but you
> also committed the files I earlier git-add'ed, stupid git!"
> confusion.
> 
> Taken together with your "during a partially conflicted merge"
> example, it feels to me that the simplest safety valve would be
> to refuse "git commit paths..." if the index does not exactly
> match HEAD.  Not just mentioned paths but anywhere.
> 
> People who do not like this can set in their config file some
> flag, say, 'core.index = understood', to get the current
> behaviour.

I'd avoid hidden config options that magically change behaviors and semantics like that as much as possible. _This_ would pave the way to even greater confusion and prevent the git user base from converging on a unified semantics knowledge. Better add a command line option which has the vertue of being visible, and name it such that it make the intention explicit whether the previous index state is preserved or not, something like --current-index or the like.

Show 19 quoted lines
> The reason I am bringing this up is because of this command
> sequence:
> 
> 	# start from a clean tree, after 'git reset --hard'
>         $ create a-new-file
>         $ git add a-new-file
>         $ edit existing-file
>         $ edit another-file
>         $ git commit existing-file
> 
> There is no question we do not commit "another-file" and we do
> commit changes to the "existing-file" as a whole.  What should
> we do to "a-new-file", and how do we explain why we do so to
> novices?
> 
> We can argue it either way.  We could say we shouldn't because
> "commit" argument does not mention it.  We could say we should
> because the user already told that he wants to add that file to
> git.  Either makes sort-of sense from what the end user did.

It is much more intuitive to expect that, if you specify path arguments to commit, then only those paths are considered, and even if you didn't do a git add on some of them. If nothing is specified then the current index (the default, including a-new-file) is considered.

Show 5 quoted lines
> I think a file "cvs add"ed is committed if whole subdirectory
> commit (similar to our "commit -a") is done or the file is
> explicitly specified on the "cvs commit" command line, and that
> may match people's expectations.  That's an argument for not
> committing "a-new-file".
Exact.
Show 9 quoted lines
> But to be consistent with that, this should not commit anything:
> 
>         # the same clean tree.
> 	$ create a-new-file
>         $ git add a-new-file
>         $ git commit
> 
> Which is counterintuitive to me by now (because I played too
> long with git).

IMHO this should commit a_new_file simply because you added it to the index and a commit without any argument should commit the whole (refreshed) index.

> We could make "git commit" without paths to mean the current
> "-a" behaviour, which would match CVS behaviour more closely.
Exact.
> However, it would make commit after a merge conflict resolution
> in a dirty working tree _very_ dangerous -- it may give more
> familiar feel to CVS people, but it is not an improvement for
> git people at all.  I would rather not.

For that case, (assuming that -a would be the default) maybe something meaning the opposite of -a could be specified on the commit argument list like I suggested earlier. And maybe it should always be the default when committing a merge (in which case the -a would override that and refresh everything and not only the merged files plus those specified on the command line).

So to resume:
 - a non-merge commit without any argument would imply -a.
 - a non-merge commit with path arguments implies _only_ those paths, 
   regardless if they were previously "git add"ed or not.
 - a non-merge commit with, say, --no-auto or --current-index or 
   whatever would preserve the current behavior, with or without 
   additional paths.
 - a merge commit would imply that --no-auto behavior automatically.
 - a merge commit could override the --no-auto with an explicit -a.

This might look complicated when presented like that, but I think that the default behavior of each (non-merge vs merge) commit would more closely fit most people's expectations. The merge commit create a shift in semantics of course, but committing a merge is already something a bit more involved anyway and at that point git users should have gained a bit more experience with the index concept and the default merge behavior is probably what most people will expect at that point as well.

Nicolas
Previous: Linus TorvaldsNext: Junio C Hamano
Message 58 of 105 in “LCA06 Cogito/GIT workshop - (Re: git-whatchanged: exit out early on errors)”
  1. Martin LanghoffJan 26, 2006
  2. Linus TorvaldsJan 28, 2006
  3. Martin LanghoffJan 28, 2006
  4. Linus TorvaldsJan 28, 2006
  5. Junio C HamanoJan 28, 2006
  6. Fredrik KuivinenJan 29, 2006
  7. Junio C HamanoJan 29, 2006
  8. Keith PackardJan 28, 2006
  9. [Census] So who uses git?Junio C Hamano, Jan 28, 2006
  10. Morten WelinderJan 29, 2006
  11. Junio C HamanoJan 29, 2006
  12. Morten WelinderJan 29, 2006
  13. Junio C HamanoJan 29, 2006
  14. Keith PackardJan 29, 2006
  15. Radoslaw SzkodzinskiJan 29, 2006
  16. Greg KHJan 29, 2006
  17. Radoslaw SzkodzinskiJan 31, 2006
  18. Radoslaw SzkodzinskiJan 31, 2006
  19. Junio C HamanoJan 31, 2006
  20. Radoslaw SzkodzinskiJan 31, 2006
  21. Alex RiesenJan 30, 2006
  22. Linus TorvaldsJan 31, 2006
  23. J. Bruce FieldsJan 31, 2006
  24. Alex RiesenJan 31, 2006
  25. Dave JonesJan 29, 2006
  26. Daniel BarkalowJan 29, 2006
  27. Martin LanghoffJan 29, 2006
  28. Mike McCormackJan 30, 2006
  29. Carl BaldwinJan 30, 2006
  30. Johannes SchindelinJan 31, 2006
  31. Carl BaldwinJan 31, 2006
  32. Johannes SchindelinJan 31, 2006
  33. Linus TorvaldsJan 31, 2006
  34. J. Bruce FieldsJan 31, 2006
  35. Junio C HamanoJan 31, 2006
  36. Jon LoeligerJan 31, 2006
  37. Junio C HamanoJan 31, 2006
  38. J. Bruce FieldsJan 31, 2006
  39. Keith PackardJan 31, 2006
  40. Linus TorvaldsJan 31, 2006
  41. Joel BeckerJan 31, 2006
  42. Johannes SchindelinFeb 1, 2006
  43. Sam RavnborgJan 31, 2006
  44. Junio C HamanoJan 31, 2006
  45. H. Peter AnvinFeb 1, 2006
  46. Daniel BarkalowJan 31, 2006
  47. Petr BaudisJan 31, 2006
  48. Junio C HamanoJan 31, 2006
  49. Linus TorvaldsFeb 1, 2006
  50. Junio C HamanoFeb 1, 2006
  51. Daniel BarkalowFeb 1, 2006
  52. Junio C HamanoFeb 1, 2006
  53. Carl WorthFeb 1, 2006
  54. Junio C HamanoFeb 1, 2006
  55. Randal L. SchwartzFeb 1, 2006
  56. Junio C HamanoFeb 1, 2006
  57. Linus TorvaldsFeb 1, 2006
  58. Nicolas PitreFeb 1, 2006
  59. Junio C HamanoFeb 1, 2006
  60. Linus TorvaldsFeb 1, 2006
  61. Nicolas PitreFeb 1, 2006
  62. Junio C HamanoFeb 1, 2006
  63. Nicolas PitreFeb 1, 2006
  64. Junio C HamanoFeb 1, 2006
  65. Andreas EricssonFeb 2, 2006
  66. Linus TorvaldsFeb 1, 2006
  67. Two ideas for improving git's user interfaceCarl Worth, Feb 1, 2006
  68. Junio C HamanoFeb 2, 2006
  69. Carl WorthFeb 2, 2006
  70. Junio C HamanoFeb 2, 2006
  71. Carl WorthFeb 3, 2006
  72. Linus TorvaldsFeb 2, 2006
  73. Linus TorvaldsFeb 2, 2006
  74. Alan ChandlerFeb 4, 2006
  75. Junio C HamanoFeb 4, 2006
  76. Alan ChandlerFeb 4, 2006
  77. Carl WorthFeb 4, 2006
  78. Linus TorvaldsFeb 4, 2006
  79. Carl WorthFeb 6, 2006
  80. Florian WeimerFeb 2, 2006
  81. Carl BaldwinFeb 2, 2006
  82. Daniel BarkalowFeb 1, 2006
  83. Joel BeckerFeb 1, 2006
  84. H. Peter AnvinFeb 1, 2006
  85. J. Bruce FieldsJan 31, 2006
  86. Linus TorvaldsFeb 1, 2006
  87. Linus TorvaldsFeb 1, 2006
  88. "Assume unchanged" gitJunio C Hamano, Feb 9, 2006
  89. "Assume unchanged" git: do not set CE_VALID with --refreshJunio C Hamano, Feb 9, 2006
  90. ls-files: debugging aid for CE_VALID changes.Junio C Hamano, Feb 9, 2006
  91. Junio C HamanoFeb 1, 2006
  92. Linus TorvaldsFeb 1, 2006
  93. Junio C HamanoFeb 1, 2006
  94. Jason RiedyFeb 1, 2006
  95. Julian PhillipsFeb 1, 2006
  96. Linus TorvaldsFeb 1, 2006
  97. Chuck LeverFeb 6, 2006
  98. Martin LanghoffFeb 1, 2006
  99. Linus TorvaldsFeb 1, 2006
  100. H. Peter AnvinFeb 1, 2006
  101. Alex RiesenFeb 1, 2006
  102. Linus TorvaldsFeb 1, 2006
  103. Alex RiesenFeb 2, 2006
  104. Linus TorvaldsFeb 1, 2006
  105. Junio C HamanoFeb 1, 2006

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.