git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Evgen Druzhynin <evgen.druzhynin@gmail.com>
To: git@vger.kernel.org
Cc: Evgen Druzhynin <evgen.druzhynin@gmail.com>
Subject: [PATCH] Added ability to scip patch hunk with an empty filename.
Date: Mon,  6 Jul 2015 20:16:14 +0300	[thread overview]
Message-ID: <1436202974-7624-2-git-send-email-evgen.druzhynin@gmail.com> (raw)
In-Reply-To: <1436202974-7624-1-git-send-email-evgen.druzhynin@gmail.com>

---
 builtin/apply.c | 16 +++++-----------
 po/bg.po        | 15 ---------------
 po/ca.po        | 15 ---------------
 po/de.po        | 15 ---------------
 po/fr.po        | 15 ---------------
 po/git.pot      | 11 -----------
 po/it.po        | 11 -----------
 po/pt_PT.po     |  7 -------
 po/ru.po        | 12 ------------
 po/sv.po        | 16 ----------------
 po/vi.po        | 12 ------------
 po/zh_CN.po     | 11 -----------
 12 files changed, 5 insertions(+), 151 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index 54aba4e..e4481b4 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1488,17 +1488,11 @@ static int find_header(const char *line, unsigned long size, int *hdrsize, struc
 			int git_hdr_len = parse_git_header(line, len, size, patch);
 			if (git_hdr_len <= len)
 				continue;
-			if (!patch->old_name && !patch->new_name) {
-				if (!patch->def_name)
-					die(Q_("git diff header lacks filename information when removing "
-					       "%d leading pathname component (line %d)",
-					       "git diff header lacks filename information when removing "
-					       "%d leading pathname components (line %d)",
-					       p_value),
-					    p_value, linenr);
-				patch->old_name = xstrdup(patch->def_name);
-				patch->new_name = xstrdup(patch->def_name);
-			}
+
+			/* pass this hunk if the filename length is zero */
+			if (!patch->old_name && !patch->new_name) 
+				return -1;				
+			
 			if (!patch->is_delete && !patch->new_name)
 				die("git diff header lacks filename information "
 				    "(line %d)", linenr);
diff --git a/po/bg.po b/po/bg.po
index 171f813..f2cc286 100644
--- a/po/bg.po
+++ b/po/bg.po
@@ -2373,21 +2373,6 @@ msgstr "при повторното преброяване бе получен 
 msgid "patch fragment without header at line %d: %.*s"
 msgstr "част от кръпка без заглавна част на ред %d: %.*s"
 
-#: builtin/apply.c:1493
-#, c-format
-msgid ""
-"git diff header lacks filename information when removing %d leading pathname "
-"component (line %d)"
-msgid_plural ""
-"git diff header lacks filename information when removing %d leading pathname "
-"components (line %d)"
-msgstr[0] ""
-"След съкращаването на %d-та част от компонентите на пътя, в заглавната част "
-"на „git diff“ липсва информация за име на файл (ред: %d)"
-msgstr[1] ""
-"След съкращаването на първите %d части от компонентите на пътя, в заглавната "
-"част на „git diff“ липсва информация за име на файл (ред: %d)"
-
 #: builtin/apply.c:1656
 msgid "new file depends on old contents"
 msgstr "новият файл зависи от старото съдържание на файла"
diff --git a/po/ca.po b/po/ca.po
index c733483..c893285 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -2216,21 +2216,6 @@ msgstr "recompte: línia inesperada: %.*s"
 msgid "patch fragment without header at line %d: %.*s"
 msgstr "fragment de pedaç sense capçalera a la línia %d: %.*s"
 
-#: builtin/apply.c:1493
-#, c-format
-msgid ""
-"git diff header lacks filename information when removing %d leading pathname "
-"component (line %d)"
-msgid_plural ""
-"git diff header lacks filename information when removing %d leading pathname "
-"components (line %d)"
-msgstr[0] ""
-"a la capçalera de git diff li manca informació de nom de fitxer en eliminar "
-"%d component de nom de camí inicial (línia %d)"
-msgstr[1] ""
-"a la capçalera de git diff li manca informació de nom de fitxer en eliminar "
-"%d components de nom de camí inicial (línia %d)"
-
 #: builtin/apply.c:1656
 msgid "new file depends on old contents"
 msgstr "el fitxer nou depèn dels continguts antics"
diff --git a/po/de.po b/po/de.po
index 7d603c2..ea6b555 100644
--- a/po/de.po
+++ b/po/de.po
@@ -2257,21 +2257,6 @@ msgstr "recount: unerwartete Zeile: %.*s"
 msgid "patch fragment without header at line %d: %.*s"
 msgstr "Patch-Fragment ohne Kopfbereich bei Zeile %d: %.*s"
 
-#: builtin/apply.c:1493
-#, c-format
-msgid ""
-"git diff header lacks filename information when removing %d leading pathname "
-"component (line %d)"
-msgid_plural ""
-"git diff header lacks filename information when removing %d leading pathname "
-"components (line %d)"
-msgstr[0] ""
-"Dem Kopfbereich von \"git diff\" fehlen Informationen zum Dateinamen, wenn "
-"%d vorangestellter Teil des Pfades entfernt wird (Zeile %d)"
-msgstr[1] ""
-"Dem Kopfbereich von \"git diff\" fehlen Informationen zum Dateinamen, wenn "
-"%d vorangestellte Teile des Pfades entfernt werden (Zeile %d)"
-
 #: builtin/apply.c:1656
 msgid "new file depends on old contents"
 msgstr "neue Datei hängt von alten Inhalten ab"
diff --git a/po/fr.po b/po/fr.po
index 00bfefd..b376631 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -2301,21 +2301,6 @@ msgstr "recomptage : ligne inattendue : %.*s"
 msgid "patch fragment without header at line %d: %.*s"
 msgstr "fragment de patch sans en-tête à la ligne %d : %.*s"
 
-#: builtin/apply.c:1493
-#, c-format
-msgid ""
-"git diff header lacks filename information when removing %d leading pathname "
-"component (line %d)"
-msgid_plural ""
-"git diff header lacks filename information when removing %d leading pathname "
-"components (line %d)"
-msgstr[0] ""
-"information de nom de fichier manquante dans l'en-tête de git diff lors de "
-"la suppression de %d composant de préfixe de chemin (ligne %d)"
-msgstr[1] ""
-"information de nom de fichier manquante dans l'en-tête de git diff lors de "
-"la suppression de %d composants de préfixe de chemin (ligne %d)"
-
 #: builtin/apply.c:1656
 msgid "new file depends on old contents"
 msgstr "le nouveau fichier dépend de contenus anciens"
diff --git a/po/git.pot b/po/git.pot
index c94a955..f1433e9 100644
--- a/po/git.pot
+++ b/po/git.pot
@@ -2093,17 +2093,6 @@ msgstr ""
 msgid "patch fragment without header at line %d: %.*s"
 msgstr ""
 
-#: builtin/apply.c:1493
-#, c-format
-msgid ""
-"git diff header lacks filename information when removing %d leading pathname "
-"component (line %d)"
-msgid_plural ""
-"git diff header lacks filename information when removing %d leading pathname "
-"components (line %d)"
-msgstr[0] ""
-msgstr[1] ""
-
 #: builtin/apply.c:1656
 msgid "new file depends on old contents"
 msgstr ""
diff --git a/po/it.po b/po/it.po
index 9080219..6314bcb 100644
--- a/po/it.po
+++ b/po/it.po
@@ -1042,17 +1042,6 @@ msgstr "recount: riga inattesa: %.*s"
 msgid "patch fragment without header at line %d: %.*s"
 msgstr "frammento di patch senza intestazione alla riga %d: %.*s"
 
-#: builtin/apply.c:1468
-#, c-format
-msgid ""
-"git diff header lacks filename information when removing %d leading pathname "
-"component (line %d)"
-msgid_plural ""
-"git diff header lacks filename information when removing %d leading pathname "
-"components (line %d)"
-msgstr[0] ""
-msgstr[1] ""
-
 #: builtin/apply.c:1628
 msgid "new file depends on old contents"
 msgstr "il nuovo file dipende da contenuti precedenti"
diff --git a/po/pt_PT.po b/po/pt_PT.po
index 689ad1b..7cfba0d 100644
--- a/po/pt_PT.po
+++ b/po/pt_PT.po
@@ -1025,13 +1025,6 @@ msgstr ""
 msgid "patch fragment without header at line %d: %.*s"
 msgstr ""
 
-#: builtin/apply.c:1461
-#, c-format
-msgid "git diff header lacks filename information when removing %d leading pathname component (line %d)"
-msgid_plural "git diff header lacks filename information when removing %d leading pathname components (line %d)"
-msgstr[0] ""
-msgstr[1] ""
-
 #: builtin/apply.c:1621
 msgid "new file depends on old contents"
 msgstr ""
diff --git a/po/ru.po b/po/ru.po
index 4356ae9..a796889 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -2114,18 +2114,6 @@ msgstr "recount: не ожидаемая строка: %.*s"
 msgid "patch fragment without header at line %d: %.*s"
 msgstr "фрагмент изменений без заголовка на строке %d: %.*s"
 
-#: builtin/apply.c:1493
-#, c-format
-msgid ""
-"git diff header lacks filename information when removing %d leading pathname"
-" component (line %d)"
-msgid_plural ""
-"git diff header lacks filename information when removing %d leading pathname"
-" components (line %d)"
-msgstr[0] "заголовок git diff не нашел информацию об имени файла при удалении %d ведущего компонента пути к файлу (строка %d)"
-msgstr[1] "заголовок git diff не нашел информацию об имени файла при удалении %d ведущих компонент пути к файлу (строка %d)"
-msgstr[2] "заголовок git diff не нашел информацию об имени файла при удалении %d ведущих компонент пути к файлу (строка %d)"
-
 #: builtin/apply.c:1656
 msgid "new file depends on old contents"
 msgstr "новый файл зависит от старого содержимого"
diff --git a/po/sv.po b/po/sv.po
index e4b70d6..5b2d24d 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -2184,22 +2184,6 @@ msgstr "recount: förväntade rad: %.*s"
 msgid "patch fragment without header at line %d: %.*s"
 msgstr "patch-fragment utan huvud på rad %d: %.*s"
 
-#: builtin/apply.c:1493
-#, c-format
-msgid ""
-"git diff header lacks filename information when removing %d leading pathname "
-"component (line %d)"
-msgid_plural ""
-"git diff header lacks filename information when removing %d leading pathname "
-"components (line %d)"
-msgstr[0] ""
-"git-diff-huvudet saknar filnamnsinformation när %d ledande sökvägskomponent\n"
-"tas bort (rad %d)"
-msgstr[1] ""
-"git-diff-huvudet saknar filnamnsinformation när %d ledande "
-"sökvägskomponenter\n"
-"tas bort (rad %d)"
-
 #: builtin/apply.c:1656
 msgid "new file depends on old contents"
 msgstr "ny fil beror på gammalt innehåll"
diff --git a/po/vi.po b/po/vi.po
index 956be5a..ba1ecf5 100644
--- a/po/vi.po
+++ b/po/vi.po
@@ -2212,18 +2212,6 @@ msgstr "chi tiết: dòng không cần: %.*s"
 msgid "patch fragment without header at line %d: %.*s"
 msgstr "miếng vá phân mảnh mà không có phần đầu tại dòng %d: %.*s"
 
-#: builtin/apply.c:1493
-#, c-format
-msgid ""
-"git diff header lacks filename information when removing %d leading pathname "
-"component (line %d)"
-msgid_plural ""
-"git diff header lacks filename information when removing %d leading pathname "
-"components (line %d)"
-msgstr[0] ""
-"phần đầu diff cho git  thiếu thông tin tên tập tin khi gỡ bỏ đi %d trong "
-"thành phần dẫn đầu tên của đường dẫn (dòng %d)"
-
 #: builtin/apply.c:1656
 msgid "new file depends on old contents"
 msgstr "tập tin mới phụ thuộc vào nội dung cũ"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index dd2948c..b65b97a 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -2197,17 +2197,6 @@ msgstr "recount:意外的行:%.*s"
 msgid "patch fragment without header at line %d: %.*s"
 msgstr "第 %d 行的补丁片段没有头信息:%.*s"
 
-#: builtin/apply.c:1493
-#, c-format
-msgid ""
-"git diff header lacks filename information when removing %d leading pathname "
-"component (line %d)"
-msgid_plural ""
-"git diff header lacks filename information when removing %d leading pathname "
-"components (line %d)"
-msgstr[0] "当移除 %d 个前导路径后 git diff 头缺乏文件名信息(第 %d 行)"
-msgstr[1] "当移除 %d 个前导路径后 git diff 头缺乏文件名信息(第 %d 行)"
-
 #: builtin/apply.c:1656
 msgid "new file depends on old contents"
 msgstr "新文件依赖旧内容"
-- 
1.9.1

  reply	other threads:[~2015-07-06 17:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 17:16 [PATCH] Git doesn't allow to apply a patch with empty filenames Evgen Druzhynin
2015-07-06 17:16 ` Evgen Druzhynin [this message]
2015-07-06 18:36   ` [PATCH] Added ability to scip patch hunk with an empty filename Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436202974-7624-2-git-send-email-evgen.druzhynin@gmail.com \
    --to=evgen.druzhynin@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).