2

The first line of patches always has this kind of code:

diff --git a/i18nviews.inc b/i18nviews.inc

or

diff --git a/plugins/views_plugin_localization.inc b/plugins/views_plugin_localization.in

What does the a and b stand for?

2 Answers 2

3

A' and the 'B' are prefixes to differentiate source and destination.

You can change the prefixes with

--src-prefix=<prefix>
Show the given source prefix instead of "a/".

--dst-prefix=<prefix>
Show the given destination prefix instead of "b/".

From http://git-scm.com/docs/git-format-patch

0

As a rule of thumb, just consider a/ to refer to the "old" file (with filename indicated following the a/), and b/ to refer to the 'new file (with filename indicated following the b/).

As an illustration, consider the patch attached to comment nr 15 in issue nr 1632898, which looks like so:

--- a/panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
+++ b/panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
@@ -137,7 +137,10 @@ class panels_renderer_ipe extends panels_renderer_editor {
   function render_pane_content(&$pane) {
     $content = parent::render_pane_content($pane);
     // Ensure that empty panes have some content.
-    if (empty($content) || empty($content->content)) {
+    if (empty($content) || !is_object($content) || empty($content->content)) {
+      if (!is_object($content)) {
+        $content = new StdClass();
+      }
       // Get the administrative title.
       $content_type = ctools_get_content_type($pane->type);
       $title = ctools_content_admin_title($content_type, $pane->subtype, $pane->configuration, $this->display->context);

In regular English you could say "Remove that 1 line from a/ (indicated with '-', located at line 141 in a/) and insert again these 4 lines fromb/` (indicated with '+', starting from line 141)".

Some more details about the -137,7 +137,10 part of this patch example: if you'd browse the a/ (old) file, this is how these 7 lines look like, starting from line 137,

class panels_renderer_ipe extends panels_renderer_editor {
   function render_pane_content(&$pane) {
     $content = parent::render_pane_content($pane);
     // Ensure that empty panes have some content.
     if (empty($content) || empty($content->content)) {
       // Get the administrative title.
       $content_type = ctools_get_content_type($pane->type);
       $title = ctools_content_admin_title($content_type, $pane->subtype, $pane->configuration, $this->display->context);

So to know what the content of a/ actually looks like (by just looking at the patch), ignore the lines with a "+", and replace any "-" with a blank.

And if you'd browse the b/ (new) file, this is how these 10 lines look like, starting from line 137:

class panels_renderer_ipe extends panels_renderer_editor {
   function render_pane_content(&$pane) {
     $content = parent::render_pane_content($pane);
     // Ensure that empty panes have some content.
    if (empty($content) || !is_object($content) || empty($content->content)) {
      if (!is_object($content)) {
        $content = new StdClass();
      }
       // Get the administrative title.
       $content_type = ctools_get_content_type($pane->type);
       $title = ctools_content_admin_title($content_type, $pane->subtype, $pane->configuration, $this->display->context);

So to know what the content of b/ actually looks like (by just looking at the patch), ignore the lines with a "-", and replace any "+" with a blank.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.