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

'git add --patch' no longer allows you to select files before selecting patches

From
ASAnthony Scian <ascian@auvik.com>
Date
Mar 13, 2017, 18:51 UTC
Message-ID
<DF55CDE6-E556-4C07-B661-0F5AA00D306E@auvik.com>

Similarly the patch sub-command in ‘git add —interactive’ goes immediately to selecting patches starting with the first file. Is there a git configuration that would being back the old behaviour? Why was this changed?

here is a sample interaction that shows the ‘r’ sub-command still retains the desired behaviour of asking what files to involve but the ‘p’ sub-command immediately assumes all files are important and starts stepping through all the patches…

:~$ brew list
... git ...
:~$ which git
/usr/local/bin/git
:~$ git version
git version 2.12.0
:~$ 
:~$  git add --interactive
           staged     unstaged path
  1:    unchanged       +43/-2 core/src/main/scala/com/company/npl/planner/TrAc.scala
  2:    unchanged        +4/-4 core/src/main/scala/com/company/npl/tools/AnFu.scala
  3:    unchanged      +59/-12 core/src/main/scala/com/company/npl/tools/CoFu.scala
  4:    unchanged        +7/-1 module/reports/src/main/scala/com/company/npl/reports/ReStCo.scala
  5:    unchanged      +10/-23 runtime/src/main/npl/migrationSchemas/schema_for_migration_to_W4.npl
  6:    unchanged        +5/-3 runtime/src/main/scala/com/company/npl/table/adapter/InPe.scala
  7:    unchanged      +39/-82 runtime/src/main/scala/com/company/npl/table/migrations/schema_for_W4.scala
  8:    unchanged       +14/-1 ui/modules/admin/app/assets/javascripts/defs/de_sub.js
*** Commands ***
  1: status	  2: update	  3: revert	  4: add untracked
  5: patch	  6: diff	  7: quit	  8: help
What now> r
           staged     unstaged path
  1:    unchanged       +43/-2 core/src/main/scala/com/company/npl/planner/TrAc.scala
  2:    unchanged        +4/-4 core/src/main/scala/com/company/npl/tools/AnFu.scala
  3:    unchanged      +59/-12 core/src/main/scala/com/company/npl/tools/CoFu.scala
  4:    unchanged        +7/-1 module/reports/src/main/scala/com/company/npl/reports/ReStCo.scala
  5:    unchanged      +10/-23 runtime/src/main/npl/migrationSchemas/schema_for_migration_to_W4.npl
  6:    unchanged        +5/-3 runtime/src/main/scala/com/company/npl/table/adapter/InPe.scala
  7:    unchanged      +39/-82 runtime/src/main/scala/com/company/npl/table/migrations/schema_for_W4.scala
  8:    unchanged       +14/-1 ui/modules/admin/app/assets/javascripts/defs/de_sub.js
Revert>> 5
           staged     unstaged path
  1:    unchanged       +43/-2 core/src/main/scala/com/company/npl/planner/TrAc.scala
  2:    unchanged        +4/-4 core/src/main/scala/com/company/npl/tools/AnFu.scala
  3:    unchanged      +59/-12 core/src/main/scala/com/company/npl/tools/CoFu.scala
  4:    unchanged        +7/-1 module/reports/src/main/scala/com/company/npl/reports/ReStCo.scala
* 5:    unchanged      +10/-23 runtime/src/main/npl/migrationSchemas/schema_for_migration_to_W4.npl
  6:    unchanged        +5/-3 runtime/src/main/scala/com/company/npl/table/adapter/InPe.scala
  7:    unchanged      +39/-82 runtime/src/main/scala/com/company/npl/table/migrations/schema_for_W4.scala
  8:    unchanged       +14/-1 ui/modules/admin/app/assets/javascripts/defs/de_sub.js
Revert>> 7
           staged     unstaged path
  1:    unchanged       +43/-2 core/src/main/scala/com/company/npl/planner/TrAc.scala
  2:    unchanged        +4/-4 core/src/main/scala/com/company/npl/tools/AnFu.scala
  3:    unchanged      +59/-12 core/src/main/scala/com/company/npl/tools/CoFu.scala
  4:    unchanged        +7/-1 module/reports/src/main/scala/com/company/npl/reports/ReStCo.scala
* 5:    unchanged      +10/-23 runtime/src/main/npl/migrationSchemas/schema_for_migration_to_W4.npl
  6:    unchanged        +5/-3 runtime/src/main/scala/com/company/npl/table/adapter/InPe.scala
* 7:    unchanged      +39/-82 runtime/src/main/scala/com/company/npl/table/migrations/schema_for_W4.scala
  8:    unchanged       +14/-1 ui/modules/admin/app/assets/javascripts/defs/de_sub.js
Revert>> 
reverted 2 paths
*** Commands ***
  1: status	  2: update	  3: revert	  4: add untracked
  5: patch	  6: diff	  7: quit	  8: help
What now> p
diff --git a/core/src/main/scala/com/company/npl/planner/TrAc.scala b/core/src/main/scala/com/company/npl/planner/TrAc.scala
index 938cdc2a1b..669dc5f95b 100644
--- a/core/src/main/scala/com/company/npl/planner/TrAc.scala
+++ b/core/src/main/scala/com/company/npl/planner/TrAc.scala
@@ -24,8 +24,7 @@ import com.company.npl.tools.CoFu
  */
 case class TrAc(action: View with Generator, when: View, exceptWhen: Option[View], required: Boolean) {
   private def mergeAction(rhs: TrAc): View with Generator = action match {
-    case Always | Never =>
-      rhs.action
+    case Always | Never => rhs.action
     case _ =>
       require(rhs.action == Always || rhs.action == Never)
       action
Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? q

*** Commands ***
  1: status	  2: update	  3: revert	  4: add untracked
  5: patch	  6: diff	  7: quit	  8: help
What now> q
Bye.
:~$
Next: Jeff King
Message 1 of 4 in “'git add --patch' no longer allows you to select files before selecting patches”
  1. Anthony ScianMar 13, 2017
  2. Jeff KingMar 13, 2017
  3. Junio C HamanoMar 13, 2017
  4. Junio C HamanoMar 13, 2017

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.