[KyOSS Discuss] Hoping to get some help with a git patch

Chris Rockwell chris at chrisrockwell.com
Tue Nov 5 17:29:58 EST 2013


I'm finding that it may be caused by the huge differences in the files -
although the function def's are the same, there are so many other
differences that git's fuzzy search isn't doing too well with it.  I'm
looking into "3-way merges" now


On Tue, Nov 5, 2013 at 5:09 PM, alan blount <alan at zeroasterisk.com> wrote:

> Sorry - "not it" - I've only rarely used patch files, and never had any
> issues with them.
>
> Thanks,
> -alan
>
>
> On Tue, Nov 5, 2013 at 3:01 PM, Chris Rockwell <chris at chrisrockwell.com>wrote:
>
>> I'm trying to backport a patch from Drupal 8 to 7 and having issues with
>> one hunk, can someone shed some light on this for me? My first attempt was
>> to change the line number from 1730 to 1820 and 1737 to 1827 , which is
>> where "function _form_test_checkboxes_zero_no_redirect(..)" is in Drupal 7,
>> no dice though.  I'm confused by the error as it is "error: while searching
>> for", when that function definition, exactly the same, exists.  BTW: I know
>> that I can add the function in, git diff, change the patch, and do a pull
>> request, but I'd like to also know why it's doing this.
>>
>> The error:
>> ================================================================
>> error: while searching for:
>> function _form_test_checkboxes_zero_no_redirect($form, &$form_state) {
>>   $form_state['redirect'] = FALSE;
>> }
>>
>> error: patch failed: modules/simpletest/tests/form_test.module:1730
>> error: modules/simpletest/tests/form_test.module: patch does not apply
>> =================================================================
>>
>> The relevant portion of patch
>>
>>
>> =================================================================================
>> @@ -1730,3 +1737,18 @@ function form_test_checkboxes_zero($form,
>> &$form_state, $json = TRUE) {
>>  function _form_test_checkboxes_zero_no_redirect($form, &$form_state) {
>>    $form_state['redirect'] = FALSE;
>>  }
>> +
>> +/**
>> + * Builds a form to test the required attribute.
>> + */
>> +function form_test_required_attribute($form, &$form_state) {
>> +  foreach (array('textfield', 'textarea', 'password') as $type) {
>> +    $form[$type] = array(
>> +      '#type' => $type,
>> +      '#required' => TRUE,
>> +      '#title' => $type,
>> +    );
>> +  }
>> +
>> +  return $form;
>> +}
>>
>> ==================================================================================
>>
>>
>> The code in Drupal 7, starting at line #1792
>>
>>
>>
>> ==================================================================================
>> function form_test_checkboxes_zero($form, &$form_state, $json = TRUE) {
>>   $form['checkbox_off'] = array(
>>     '#type' => 'checkboxes',
>>     '#options' => array('foo', 'bar', 'baz'),
>>   );
>>   $form['checkbox_zero_default'] = array(
>>     '#type' => 'checkboxes',
>>     '#options' => array('foo', 'bar', 'baz'),
>>     '#default_value' => array(0),
>>   );
>>   $form['checkbox_string_zero_default'] = array(
>>     '#type' => 'checkboxes',
>>     '#options' => array('foo', 'bar', 'baz'),
>>     '#default_value' => array('0'),
>>   );
>>   $form['submit'] = array(
>>     '#type' => 'submit',
>>     '#value' => 'Save',
>>   );
>>   if ($json) {
>>     $form['#submit'][] = '_form_test_checkbox_submit';
>>   }
>>   else {
>>     $form['#submit'][] = '_form_test_checkboxes_zero_no_redirect';
>>   }
>>   return $form;
>> }
>>
>> function _form_test_checkboxes_zero_no_redirect($form, &$form_state) {
>> //[NOTE ADDED: this is line 1820)
>>   $form_state['redirect'] = FALSE;
>> }
>>
>>
>> ==================================================================================
>>
>>
>> --
>> Chris Rockwell
>>
>> _______________________________________________
>> KyOSS-Discuss mailing list
>> KyOSS-Discuss at kyoss.org
>> Subscribe by sending email to kyoss-discuss-subscribe at kyoss.org
>> Unsubscribe by sending email (from the address you wish to unsubscribe)
>> to kyoss-discuss-unsubscribe at kyoss.org
>> Difficulty unsubscribing? Check your email headers for originally-to
>> address in case you are forwarding your mail.
>> More options at http://kyoss.org/cgi-bin/mailman/listinfo/kyoss-discuss
>>
>
>
> _______________________________________________
> KyOSS-Discuss mailing list
> KyOSS-Discuss at kyoss.org
> Subscribe by sending email to kyoss-discuss-subscribe at kyoss.org
> Unsubscribe by sending email (from the address you wish to unsubscribe) to
> kyoss-discuss-unsubscribe at kyoss.org
> Difficulty unsubscribing? Check your email headers for originally-to
> address in case you are forwarding your mail.
> More options at http://kyoss.org/cgi-bin/mailman/listinfo/kyoss-discuss
>



-- 
Chris Rockwell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kyoss.org/pipermail/kyoss-discuss/attachments/20131105/b0f6e680/attachment-0001.html>


More information about the KyOSS-Discuss mailing list