# Apply patch on server w/o git

7 messages from 2008-03-25 to 2008-03-29. Participants: Joe Fiorini, Bryan Donlan, Jan Hudec, Robin Rosenberg.
Thread: https://gitlist.dev/t/12858

## Joe Fiorini, 2008-03-25 18:25

Subject: Apply patch on server w/o git
Message-ID: <CA08AA77-A9EA-4490-B1BE-25E8B7402290@faithfulgeek.org>
URL: https://gitlist.dev/e/CA08AA77-A9EA-4490-B1BE-25E8B7402290%40faithfulgeek.org

```
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

```

## Bryan Donlan, 2008-03-25 18:41

Subject: Re: Apply patch on server w/o git
Message-ID: <3e8340490803251141x6d199d8ch8828b396da202d81@mail.gmail.com>
URL: https://gitlist.dev/e/3e8340490803251141x6d199d8ch8828b396da202d81%40mail.gmail.com
In-Reply-To: <CA08AA77-A9EA-4490-B1BE-25E8B7402290@faithfulgeek.org>

```
On Tue, Mar 25, 2008 at 2:25 PM, Joe Fiorini <joe@faithfulgeek.org> 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).

```

## Joe Fiorini, 2008-03-25 19:23

Subject: Re: Apply patch on server w/o git
Message-ID: <09409F50-D3C4-4290-AF94-C8985E7A52C8@faithfulgeek.org>
URL: https://gitlist.dev/e/09409F50-D3C4-4290-AF94-C8985E7A52C8%40faithfulgeek.org
In-Reply-To: <3e8340490803251141x6d199d8ch8828b396da202d81@mail.gmail.com>

```
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 <joe@faithfulgeek.org>  
> 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).

```

## Jan Hudec, 2008-03-25 19:46

Subject: Re: Apply patch on server w/o git
Message-ID: <20080325194631.GD4857@efreet.light.src>
URL: https://gitlist.dev/e/20080325194631.GD4857%40efreet.light.src
In-Reply-To: <3e8340490803251141x6d199d8ch8828b396da202d81@mail.gmail.com>

```
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 <bulb@ucw.cz>

```

## Robin Rosenberg, 2008-03-25 19:57

Subject: Re: Apply patch on server w/o git
Message-ID: <200803252057.38326.robin.rosenberg.lists@dewire.com>
URL: https://gitlist.dev/e/200803252057.38326.robin.rosenberg.lists%40dewire.com
In-Reply-To: <CA08AA77-A9EA-4490-B1BE-25E8B7402290@faithfulgeek.org>

```
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

```

## Joe Fiorini, 2008-03-26 03:03

Subject: Re: Apply patch on server w/o git
Message-ID: <323B72DF-3387-40ED-8235-213A9FAD6CDD@faithfulgeek.org>
URL: https://gitlist.dev/e/323B72DF-3387-40ED-8235-213A9FAD6CDD%40faithfulgeek.org
In-Reply-To: <200803252057.38326.robin.rosenberg.lists@dewire.com>

```
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:
>> 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

```

## Jan Hudec, 2008-03-29 18:46

Subject: Re: Apply patch on server w/o git
Message-ID: <20080329184606.GB4920@efreet.light.src>
URL: https://gitlist.dev/e/20080329184606.GB4920%40efreet.light.src
In-Reply-To: <323B72DF-3387-40ED-8235-213A9FAD6CDD@faithfulgeek.org>

```
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 <bulb@ucw.cz>

```
