git - How do I change paths in a unified patch? -
i have git repository in made changes folder structure. moved in ./_test_html
directory root ./
of repository , continued working.
now wanted revert changes had made before directory change, realized not normal revert because files affected no longer present in current branch, created patch file , changed paths in file ./subdir
./
make references correct again, git apply gives me error:
patch failed, patch not apply errors.
see below (parts) of old , adjusted patch file , git output. doing wrong , there command/tool use instead of manually editing patch file?
old file
--- _test_html/mobile/css/sf.css | 53 ++++++++++++++-- _test_html/mobile/images/logo_temp_x.png | bin 17636 -> 19362 bytes _test_html/mobile/js/secretflirt.js | 16 ++++- _test_html/mobile/templates/footer.tpl.php | 7 ++- _test_html/mobile/templates/header.tpl.php | 90 ++++++++++++++++++++++++++- _test_html/mobile/templates/ingelogd.tpl.php | 40 +----------- 6 files changed, 157 insertions(+), 49 deletions(-) diff --git a/_test_html/mobile/css/sf.css b/_test_html/mobile/css/sf.css index 0d5f317..63a3b9d 100644 --- a/_test_html/mobile/css/sf.css +++ b/_test_html/mobile/css/sf.css @@ -66,7 +66,7 @@ h2, .ui-collapsible-heading{margin:0;font-size:16px;} .ui-collapsible-heading span.ui-btn{right:6px;} -.ui-field-contain{ border-bottom-width: 0px!important; 0px; padding: 0px; +.ui-field-contain{ border-bottom-width: 0px!important; padding: 0px; margin: 3px 3px 0px 0px; width: 100%;} input.ui-input-text, .ui-input-search{background:#fff;color:#333;margin: 2px 2px 2px 0px; width: 100%;height: 2.1em;} textarea.ui-input-text {background:#fff;color:#333;margin-bottom: 5px; margin-left: 0px;margin-right: 5px;width: 100%; min-height:150px;} @@ -648,7 +648,7 @@ label.ui-input-text, label.ui-select{color:#333;font-size:100%;font-weight:norma .ui-body-c .ui-footer .ui-link{color:#c8c8c8;font-size:110%;font-weight:bold;} .ui-body-c .ui-footer .ui-link.last{color:#2489ce;} .ui-body-c .ui-footer .ui-link:hover{color:#fff;} -label.error, {display:block;margin-left: 10px;margin-top: 5px;text-shadow: 1px 1px 5px white; +label.error {display:block;margin-left: 10px;margin-top: 5px;text-shadow: 1px 1px 5px white; color: red; font-size: 1.1em;}
new file
--- mobile/css/sf.css | 53 ++++++++++++++-- mobile/images/logo_temp_x.png | bin 17636 -> 19362 bytes mobile/js/secretflirt.js | 16 ++++- mobile/templates/footer.tpl.php | 7 ++- mobile/templates/header.tpl.php | 90 ++++++++++++++++++++++++++- mobile/templates/ingelogd.tpl.php | 40 +----------- 6 files changed, 157 insertions(+), 49 deletions(-) diff --git a/mobile/css/sf.css b/mobile/css/sf.css index 0d5f317..63a3b9d 100644 --- a/mobile/css/sf.css +++ b/mobile/css/sf.css @@ -66,7 +66,7 @@ h2, .ui-collapsible-heading{margin:0;font-size:16px;} .ui-collapsible-heading span.ui-btn{right:6px;} -.ui-field-contain{ border-bottom-width: 0px!important; 0px; padding: 0px; +.ui-field-contain{ border-bottom-width: 0px!important; padding: 0px; margin: 3px 3px 0px 0px; width: 100%;} input.ui-input-text, .ui-input-search{background:#fff;color:#333;margin: 2px 2px 2px 0px; width: 100%;height: 2.1em;} textarea.ui-input-text {background:#fff;color:#333;margin-bottom: 5px; margin-left: 0px;margin-right: 5px;width: 100%; min-height:150px;} @@ -648,7 +648,7 @@ label.ui-input-text, label.ui-select{color:#333;font-size:100%;font-weight:norma .ui-body-c .ui-footer .ui-link{color:#c8c8c8;font-size:110%;font-weight:bold;} .ui-body-c .ui-footer .ui-link.last{color:#2489ce;} .ui-body-c .ui-footer .ui-link:hover{color:#fff;} -label.error, {display:block;margin-left: 10px;margin-top: 5px;text-shadow: 1px 1px 5px white; +label.error {display:block;margin-left: 10px;margin-top: 5px;text-shadow: 1px 1px 5px white; color: red; font-size: 1.1em;}
git apply output
$ git apply patch2.diff patch2.diff:101: trailing whitespace. min-height:400px patch2.diff:843: trailing whitespace. } patch2.diff:846: trailing whitespace. }); patch2.diff:873: trailing whitespace. <div class="panel-content"> patch2.diff:874: trailing whitespace. error: patch failed: mobile/css/sf.css:66 error: mobile/css/sf.css: patch not apply error: patch applies 'mobile/images/logo_temp_x.png' (ebe43e4cce1686add4f ad9bf64f0fc261010a6b5), not match current contents. error: mobile/images/logo_temp_x.png: patch not apply error: patch failed: mobile/js/secretflirt.js:1518 error: mobile/js/secretflirt.js: patch not apply error: patch failed: mobile/templates/footer.tpl.php:1 error: mobile/templates/footer.tpl.php: patch not apply error: patch failed: mobile/templates/header.tpl.php:1 error: mobile/templates/header.tpl.php: patch not apply error: patch failed: mobile/templates/ingelogd.tpl.php:28 error: mobile/templates/ingelogd.tpl.php: patch not apply warning: console font doesn't support unicode. if experience s trange characters in output, consider switching truetype font such l ucida console!
you can try apply original patch using patch
in dry mode:
patch -p2 --dry-run -i patch2.diff
-p2
means first 2 components stripped, a/_test_html/
.
if no errors occurred run again without --dry-run
.
Comments
Post a Comment