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

Case when I can not unstage the hunk

From
KKES <kes-kes@yandex.ru>
Date
Oct 15, 2018, 12:33 UTC
Message-ID
<9994851539606820@myt5-f9d71769b752.qloud-c.yandex.net>

Hi. Here is log:

git reset HEAD -p /home/kes/s/public/v2/js/contact_us.js
diff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js
index e05be6d0..d429d291 100644
--- a/public/v2/js/contact_us.js
+++ b/public/v2/js/contact_us.js
@@ -1,7 +1,19 @@
+
+
+function captchaProcess( form ) {
+      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )
+        .attr( 'id' ).match( /\d+$/ );
+      if( id ){ id =  id[0] } else { id = 0 }
+      grecaptcha.reset( Number( id ) );
+      grecaptcha.execute( Number( id ) );
+      // When .execute is done this will trigger callback
+      // which is specified on g-recaptcha div element via data-callback attr
+}
+
+
 // FORM VALIDATION
-var validator;
 $(function(){
-  validator =  $('#contact_us-form').validate({
+  $('#contact_us-form').validate({
     rules: {
       name: {
         required: true,
Unstage this hunk [y,n,q,a,d,j,J,g,/,s,e,?]? s
Split into 3 hunks.
@@ -1 +1,14 @@
+
+
+function captchaProcess( form ) {
+      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )
+        .attr( 'id' ).match( /\d+$/ );
+      if( id ){ id =  id[0] } else { id = 0 }
+      grecaptcha.reset( Number( id ) );
+      grecaptcha.execute( Number( id ) );
+      // When .execute is done this will trigger callback
+      // which is specified on g-recaptcha div element via data-callback attr
+}
+
+
 // FORM VALIDATION
Unstage this hunk [y,n,q,a,d,j,J,g,/,e,?]? n
@@ -1,3 +14,2 @@
 // FORM VALIDATION
-var validator;
 $(function(){
Unstage this hunk [y,n,q,a,d,K,j,J,g,/,e,?]? y
@@ -3,5 +15,5 @@
 $(function(){
-  validator =  $('#contact_us-form').validate({
+  $('#contact_us-form').validate({
     rules: {
       name: {
         required: true,
Unstage this hunk [y,n,q,a,d,K,j,J,g,/,e,?]? y
@@ -47,12 +59,7 @@ $(function(){
       $(element).removeClass("error_inp");
     },
     submitHandler: function(form) {
-      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )
-        .attr( 'id' ).match( /\d+$/ );
-      if( id ){ id =  id[0] } else { id = 0 }
-      grecaptcha.execute( Number( id ) );
-      // When .execute is done this will trigger callback
-      // which is specified on g-recaptcha div element via data-callback attr
+      captchaProcess( form );
     }
   });
 });
Unstage this hunk [y,n,q,a,d,K,g,/,e,?]? n
error: patch failed: public/v2/js/contact_us.js:1
error: public/v2/js/contact_us.js: patch does not apply
diff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js
index e05be6d0..d429d291 100644
--- a/public/v2/js/contact_us.js
+++ b/public/v2/js/contact_us.js
@@ -1,7 +1,6 @@
 // FORM VALIDATION
-var validator;
 $(function(){
-  validator =  $('#contact_us-form').validate({
+  $('#contact_us-form').validate({
     rules: {
       name: {
         required: true,



DETAILS:

git diff -b -w --ignore-blank-lines /home/kes/s/public/v2/js/contact_us.js
diff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js
index d429d291..bd1f4ddd 100644
--- a/public/v2/js/contact_us.js
+++ b/public/v2/js/contact_us.js
@@ -1,10 +1,24 @@
 
+function show_validator_errors( xhr, validator ) {
+  if( xhr.status == 404 ) { return }
+
+  var res =  xhr.responseJSON;
+  // TODO: Display responseText if there is no responseJSON
+  if( !res ) { return };
+
+  var errors =  {};
+  // convert server response into validator format
+  for( var error in res.error.info ) {
+    errors[error] =  res.error.info[ error ][ 1 ] || 'Error';
+  }
+  validator.showErrors( errors );
+}
+
 
 function captchaProcess( form ) {
       var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )
         .attr( 'id' ).match( /\d+$/ );
       if( id ){ id =  id[0] } else { id = 0 }
-      grecaptcha.reset( Number( id ) );
       grecaptcha.execute( Number( id ) );
       // When .execute is done this will trigger callback
       // which is specified on g-recaptcha div element via data-callback attr








git diff -b -w --ignore-blank-lines --staged /home/kes/s/public/v2/js/contact_us.js
diff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js
index e05be6d0..d429d291 100644
--- a/public/v2/js/contact_us.js
+++ b/public/v2/js/contact_us.js
@@ -1,7 +1,19 @@
+
+
+function captchaProcess( form ) {
+      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )
+        .attr( 'id' ).match( /\d+$/ );
+      if( id ){ id =  id[0] } else { id = 0 }
+      grecaptcha.reset( Number( id ) );
+      grecaptcha.execute( Number( id ) );
+      // When .execute is done this will trigger callback
+      // which is specified on g-recaptcha div element via data-callback attr
+}
+
+
 // FORM VALIDATION
-var validator;
 $(function(){
-  validator =  $('#contact_us-form').validate({
+  $('#contact_us-form').validate({
     rules: {
       name: {
         required: true,
Message 1 of 1 in “Case when I can not unstage the hunk”
  1. KESOct 15, 2018

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.