Web lists-archives.com

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




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.
:~$