git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Fwd: git-gui / Warning: "No newline at end of file”

From
Pat Thoyts <patthoyts@users.sourceforge.net>
Date
Jan 9, 2013, 14:49 UTC
Message-ID
<87vcb6bee5.fsf@fox.patthoyts.tk>
In-Reply-To
<7vzk0qw8ts.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
>Tobias Preuss <tobias.preuss@googlemail.com> writes:
>
>> Hello. I never got a response. Did my email pass the distribution
>> list? Best, Tobias
>
>Pat?
>

I did have a brief look at this but I don't have a solution at the moment. The "\ No newline at end of file" is emitted by git at we don't appear to handle it well in the lib/diff.tcl apply_range_or_line function.

Show 30 quoted lines
>> ---------- Forwarded message ----------
>> From: Tobias Preuss <tobias.preuss@googlemail.com>
>> Date: Tue, Nov 13, 2012 at 9:26 PM
>> Subject: git-gui / Warning: "No newline at end of file”
>> To: git <git@vger.kernel.org>
>>
>>
>> Hello.
>> I noticed a problem when working with git-gui which might be a bug.
>> The issue only affects you when you are visually trying to stage
>> changes line by line. Here are the steps to reproduce the problem:
>>
>> 1. Initialize a new repository.
>> 2. Create a file with three lines of content each with the word
>> "Hello". Do not put a new line at the end of the file.
>> 3. Add and commit the file.
>> 4. Edit the same file putting words inbetween the three lines.
>> 5. Open git-gui and try to stage the changes line by line.
>>
>> The editor will append the warning "No newline at end of file” to the
>> end of the diff. When you are trying to stage a line an error occurs.
>> The problem is also illustrated in a question on Stackoverflow [1].
>>
>> Please let me know if you need more information or if I should send
>> this problem to some other mailing list.
>> Thank you, Tobias
>>
>> ____________
>> [1] http://stackoverflow.com/questions/13223868/how-to-stage-line-by-line-in-git-gui-although-no-newline-at-end-of-file-warnin
>
-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD
Previous: Tobias PreussNext: Heiko Voigt
Message 3 of 5 in “git-gui / Warning: "No newline at end of file””
  1. Tobias PreussNov 13, 2012
  2. Fwd: git-gui / Warning: "No newline at end of file”Tobias Preuss, Jan 3, 2013
  3. Pat ThoytsJan 9, 2013
  4. git-gui: allow "\ No newline at end of file" for linewise stagingHeiko Voigt, May 9, 2013
  5. Tobias PreussMay 10, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.