Apply patch on server w/o git

7 messages, 4 authors, 2016-06-15 · open the first message on its own page

Apply patch on server w/o git

From: Joe Fiorini <hidden>
Date: 2016-06-15 22:44:25

I am trying to generate a diff patch on my local dev box.  I want to  
upload this patch to a server (running Windows Server 2008) and apply  
it to my staging code.  The catch is: I cannot install git on the  
server to accept the patch.  Therefore, I would like to use a generic  
patching tool (such as patch from the GnuWin32 tools).  I tried  
generating a unified diff with the following command:

git diff -U > diff.patch

and then tried to apply it using:

patch -u -i ..\other_dir\diff.patch

and I got the error:

"patch unexpectedly ends in middle of line" ... "Only garbage was  
found in the patch input"

It might be a problem with how I'm using patch, and if so, forgive  
me.  If not, then how can I generate a generic diff format from git so  
I can do what I want?

Thanks all!
Joe Fiorini

Re: Apply patch on server w/o git

From: Bryan Donlan <hidden>
Date: 2016-06-15 22:44:25

On Tue, Mar 25, 2008 at 2:25 PM, Joe Fiorini [off-list ref] wrote:
I am trying to generate a diff patch on my local dev box.  I want to
 upload this patch to a server (running Windows Server 2008) and apply
 it to my staging code.  The catch is: I cannot install git on the
 server to accept the patch.  Therefore, I would like to use a generic
 patching tool (such as patch from the GnuWin32 tools).  I tried
 generating a unified diff with the following command:

 git diff -U > diff.patch

 and then tried to apply it using:

 patch -u -i ..\other_dir\diff.patch

 and I got the error:

 "patch unexpectedly ends in middle of line" ... "Only garbage was
 found in the patch input"

 It might be a problem with how I'm using patch, and if so, forgive
 me.  If not, then how can I generate a generic diff format from git so
 I can do what I want?

 Thanks all!
 Joe Fiorini
Just a guess, but the gnuwin32 tools might not like unix line endings.
Try opening and re-saving in wordpad (or vim :set ff=dos, or $insert
your favorite method here).

Re: Apply patch on server w/o git

From: Joe Fiorini <hidden>
Date: 2016-06-15 22:44:25

I just tried it and no luck.  Anyone have any other ideas?

-Joe

On Mar 25, 2008, at 2:41 PM, Bryan Donlan wrote:
On Tue, Mar 25, 2008 at 2:25 PM, Joe Fiorini [off-list ref]  
wrote:
quoted
I am trying to generate a diff patch on my local dev box.  I want to
upload this patch to a server (running Windows Server 2008) and apply
it to my staging code.  The catch is: I cannot install git on the
server to accept the patch.  Therefore, I would like to use a generic
patching tool (such as patch from the GnuWin32 tools).  I tried
generating a unified diff with the following command:

git diff -U > diff.patch

and then tried to apply it using:

patch -u -i ..\other_dir\diff.patch

and I got the error:

"patch unexpectedly ends in middle of line" ... "Only garbage was
found in the patch input"

It might be a problem with how I'm using patch, and if so, forgive
me.  If not, then how can I generate a generic diff format from git  
so
I can do what I want?

Thanks all!
Joe Fiorini
Just a guess, but the gnuwin32 tools might not like unix line endings.
Try opening and re-saving in wordpad (or vim :set ff=dos, or $insert
your favorite method here).

Re: Apply patch on server w/o git

From: Jan Hudec <hidden>
Date: 2016-06-15 22:44:25

On Tue, Mar 25, 2008 at 14:41:04 -0400, Bryan Donlan wrote:
Just a guess, but the gnuwin32 tools might not like unix line endings.
Try opening and re-saving in wordpad (or vim :set ff=dos, or $insert
your favorite method here).
That won't actually work! The problem is, that:
 - The headers (+++/---/@@ lines) should have dos line endings (but does not
   matter too much).
 - The bodies must have the same line endings the actual code does.

Question is, what the code has (it could have been transfered by some method
that converted the line-endings or something).

Also trying to patch with ignoring whitespace could work (I believe I did
that the other way 'round -- applying windowsy newline-damaged patch on
unix). And if it does not, it's not the newlines problem.

-- 
						 Jan 'Bulb' Hudec [off-list ref]

Re: Apply patch on server w/o git

From: Robin Rosenberg <hidden>
Date: 2016-06-15 22:44:25

Den Tuesday 25 March 2008 19.25.58 skrev Joe Fiorini:
I am trying to generate a diff patch on my local dev box.  I want to
upload this patch to a server (running Windows Server 2008) and apply
it to my staging code.  The catch is: I cannot install git on the
server to accept the patch.  Therefore, I would like to use a generic
patching tool (such as patch from the GnuWin32 tools).  I tried
generating a unified diff with the following command:

git diff -U > diff.patch

and then tried to apply it using:

patch -u -i ..\other_dir\diff.patch
You can try git-apply instead of patch. It is a bit smarter (and not
outsmarting itself either).

-- robin

Re: Apply patch on server w/o git

From: Joe Fiorini <hidden>
Date: 2016-06-15 22:44:25

Thanks for all your replies.  Unfortunately, I cannot use git apply  
because I will not have access to git on the server where I'm doing  
the patch.  I will try Jan's suggestion of ignoring whitespace.

-Joe

On Mar 25, 2008, at 3:57 PM, Robin Rosenberg wrote:
Den Tuesday 25 March 2008 19.25.58 skrev Joe Fiorini:
quoted
I am trying to generate a diff patch on my local dev box.  I want to
upload this patch to a server (running Windows Server 2008) and apply
it to my staging code.  The catch is: I cannot install git on the
server to accept the patch.  Therefore, I would like to use a generic
patching tool (such as patch from the GnuWin32 tools).  I tried
generating a unified diff with the following command:

git diff -U > diff.patch

and then tried to apply it using:

patch -u -i ..\other_dir\diff.patch
You can try git-apply instead of patch. It is a bit smarter (and not
outsmarting itself either).

-- robin
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: Apply patch on server w/o git

From: Jan Hudec <hidden>
Date: 2016-06-15 22:44:26

On Tue, Mar 25, 2008 at 23:03:58 -0400, Joe Fiorini wrote:
Thanks for all your replies.  Unfortunately, I cannot use git apply  
because I will not have access to git on the server where I'm doing the 
patch.  I will try Jan's suggestion of ignoring whitespace.
By the way, why *can't* you use git there? There is win32 build of git
(http://code.google.com/p/msysgit/) and if you can't get the repository over
(but if you can get anything there, you should be able to get bundles there
too), you can still use git-apply, since it can work without a repository as
a pure patch replacement.

-- 
						 Jan 'Bulb' Hudec [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help