* tabs, git diff and git apply
@ 2020-11-28 9:29 martin rudalics
2020-11-28 9:39 ` Andreas Schwab
2020-11-28 14:40 ` Stefan Monnier
0 siblings, 2 replies; 20+ messages in thread
From: martin rudalics @ 2020-11-28 9:29 UTC (permalink / raw)
To: emacs-devel
Some three lines appearing in my window.c as
if (WINDOWP (w->contents))
cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data);
else
appear in *shell* after git diff as
+ if (WINDOWP (w->contents))
+ cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data);
+ else
Note the extra space after the "+" in the second line and the off-by-one
indentation. A subsequent git apply then complains about
/home/martin/temp/master..changes-2020-11-28.diff:3847: space before tab in indent.
cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data);
Now my sources contain many lines where text is preceded by exactly one
tab on its line but this is the only one that produces such a failure.
Does anyone have an explanation for that behavior?
Thanks in advance, martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 9:29 tabs, git diff and git apply martin rudalics
@ 2020-11-28 9:39 ` Andreas Schwab
2020-11-28 10:15 ` martin rudalics
2020-11-28 14:40 ` Stefan Monnier
1 sibling, 1 reply; 20+ messages in thread
From: Andreas Schwab @ 2020-11-28 9:39 UTC (permalink / raw)
To: martin rudalics; +Cc: emacs-devel
What does git status tell? How did you call git diff?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 9:39 ` Andreas Schwab
@ 2020-11-28 10:15 ` martin rudalics
2020-11-28 10:23 ` Andreas Schwab
0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2020-11-28 10:15 UTC (permalink / raw)
To: Andreas Schwab; +Cc: emacs-devel
> What does git status tell?
You probably mean git status after git apply. It just lists the changed
files and doesn't care about the whitespace problem.
But I didn't cite one line (to avoid confusions due to my German locale)
emitted by git apply:
warning: 1 Zeile fügt Whitespace-Fehler hinzu.
> How did you call git diff?
git diff master..changes | tee
where changes is the branch where my changes sit.
martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 10:15 ` martin rudalics
@ 2020-11-28 10:23 ` Andreas Schwab
2020-11-28 10:28 ` martin rudalics
0 siblings, 1 reply; 20+ messages in thread
From: Andreas Schwab @ 2020-11-28 10:23 UTC (permalink / raw)
To: martin rudalics; +Cc: emacs-devel
On Nov 28 2020, martin rudalics wrote:
>> What does git status tell?
>
> You probably mean git status after git apply.
No, before.
> It just lists the changed files and doesn't care about the whitespace
> problem.
This is not useful. Be precise. Don't leave anything out.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 10:23 ` Andreas Schwab
@ 2020-11-28 10:28 ` martin rudalics
2020-11-28 12:08 ` Andreas Schwab
2020-11-28 17:27 ` Alfred M. Szmidt
0 siblings, 2 replies; 20+ messages in thread
From: martin rudalics @ 2020-11-28 10:28 UTC (permalink / raw)
To: Andreas Schwab; +Cc: emacs-devel
>>> What does git status tell?
>>
>> You probably mean git status after git apply.
>
> No, before.
>
>> It just lists the changed files and doesn't care about the whitespace
>> problem.
>
> This is not useful. Be precise. Don't leave anything out.
The entire sequence is:
martin@restno:~/emacs-git/trunk$ git status
Auf Branch master
Ihr Branch ist auf demselben Stand wie 'origin/master'.
Unversionierte Dateien:
(benutzen Sie "git add <Datei>...", um die Änderungen zum Commit vorzumerken)
obj-gtk-2/
obj-gtk/
obj-lucid/
obj-motif/
obj-none/
obj-ns/
obj-opt/
obj-wo/
nichts zum Commit vorgemerkt, aber es gibt unversionierte Dateien
(benutzen Sie "git add" zum Versionieren)
martin@restno:~/emacs-git/trunk$ git apply /home/martin/temp/master..changes-2020-11-28.diff
/home/martin/temp/master..changes-2020-11-28.diff:3847: space before tab in indent.
cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data);
warning: 1 Zeile fügt Whitespace-Fehler hinzu.
martin@restno:~/emacs-git/trunk$ git status
Auf Branch master
Ihr Branch ist auf demselben Stand wie 'origin/master'.
Änderungen, die nicht zum Commit vorgemerkt sind:
(benutzen Sie "git add <Datei>...", um die Änderungen zum Commit vorzumerken)
(benutzen Sie "git checkout -- <Datei>...", um die Änderungen im Arbeitsverzeichnis zu verwerfen)
geändert: lisp/cus-start.el
geändert: lisp/face-remap.el
geändert: lisp/mouse.el
geändert: lisp/simple.el
geändert: lisp/window.el
geändert: src/alloc.c
geändert: src/buffer.c
geändert: src/buffer.h
geändert: src/data.c
geändert: src/dispextern.h
geändert: src/dispnew.c
geändert: src/eval.c
geändert: src/font.c
geändert: src/frame.c
geändert: src/frame.h
geändert: src/indent.c
geändert: src/keyboard.c
geändert: src/lisp.h
geändert: src/nsterm.m
geändert: src/w32fns.c
geändert: src/w32term.c
geändert: src/widget.c
geändert: src/window.c
geändert: src/window.h
geändert: src/xdisp.c
geändert: src/xfaces.c
geändert: src/xmenu.c
geändert: src/xterm.c
Unversionierte Dateien:
(benutzen Sie "git add <Datei>...", um die Änderungen zum Commit vorzumerken)
obj-gtk-2/
obj-gtk/
obj-lucid/
obj-motif/
obj-none/
obj-ns/
obj-opt/
obj-wo/
keine Änderungen zum Commit vorgemerkt (benutzen Sie "git add" und/oder "git commit -a")
martin@restno:~/emacs-git/trunk$
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 10:28 ` martin rudalics
@ 2020-11-28 12:08 ` Andreas Schwab
2020-11-28 12:45 ` martin rudalics
2020-11-28 17:27 ` Alfred M. Szmidt
1 sibling, 1 reply; 20+ messages in thread
From: Andreas Schwab @ 2020-11-28 12:08 UTC (permalink / raw)
To: martin rudalics; +Cc: emacs-devel
On Nov 28 2020, martin rudalics wrote:
> martin@restno:~/emacs-git/trunk$ git apply /home/martin/temp/master..changes-2020-11-28.diff
> /home/martin/temp/master..changes-2020-11-28.diff:3847: space before tab in indent.
> cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data);
> warning: 1 Zeile fügt Whitespace-Fehler hinzu.
So you are applying a patch with whitespace errors. What is the issue?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 12:08 ` Andreas Schwab
@ 2020-11-28 12:45 ` martin rudalics
2020-11-28 13:34 ` Andreas Schwab
0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2020-11-28 12:45 UTC (permalink / raw)
To: Andreas Schwab; +Cc: emacs-devel
> So you are applying a patch with whitespace errors. What is the issue?
That that "whitespace error" was introduced by git diff. The character
at the beginning of that line in window.c
cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data);
is described by Emacs as
position: 8315 of 341150 (2%), column: 0
character: TAB (displayed as TAB) (codepoint 9, #o11, #x9)
charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x09
script: latin
syntax: which means: whitespace
to input: type "C-x 8 RET 9" or "C-x 8 RET CHARACTER TABULATION"
buffer code: #x09
file code: #x09 (encoded by coding system undecided-unix)
display: no font available
Character code properties: customize what to show
old-name: CHARACTER TABULATION
general-category: Cc (Other, Control)
There are text properties here:
fontified t
Now where does the space produced by git diff come from so that in
+ cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data);
the character following the "+" is described by Emacs as
position: 163661 of 384033 (43%), column: 1
character: SPC (displayed as SPC) (codepoint 32, #o40, #x20)
charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x20
script: latin
syntax: which means: whitespace
category: .:Base, a:ASCII, l:Latin
to input: type "C-x 8 RET 20" or "C-x 8 RET SPACE"
buffer code: #x20
file code: #x20 (encoded by coding system utf-8-unix)
display: by this font (glyph code)
ftcrhb:-PfEd-DejaVu Sans Mono-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1 (#x03)
hardcoded face: nobreak-space
Character code properties: customize what to show
name: SPACE
general-category: Zs (Separator, Space)
decomposition: (32) (' ')
There are 2 overlays here:
From 163088 to 164494
diff--font-lock-syntax t
diff-mode syntax
evaporate t
modification-hooks (diff--overlay-auto-delete)
From 163088 to 164494
diff--font-lock-refined t
diff-mode fine
evaporate t
modification-hooks (diff--overlay-auto-delete)
There are text properties here:
face diff-added
fontified t
martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 12:45 ` martin rudalics
@ 2020-11-28 13:34 ` Andreas Schwab
2020-11-28 14:20 ` martin rudalics
0 siblings, 1 reply; 20+ messages in thread
From: Andreas Schwab @ 2020-11-28 13:34 UTC (permalink / raw)
To: martin rudalics; +Cc: emacs-devel
On Nov 28 2020, martin rudalics wrote:
>> So you are applying a patch with whitespace errors. What is the issue?
>
> That that "whitespace error" was introduced by git diff.
You didn't do any git diff in your entire sequence.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 10:28 ` martin rudalics
2020-11-28 12:08 ` Andreas Schwab
@ 2020-11-28 17:27 ` Alfred M. Szmidt
2020-11-28 18:23 ` martin rudalics
1 sibling, 1 reply; 20+ messages in thread
From: Alfred M. Szmidt @ 2020-11-28 17:27 UTC (permalink / raw)
To: martin rudalics; +Cc: schwab, emacs-devel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 354 bytes --]
martin@restno:~/emacs-git/trunk$ git apply /home/martin/temp/master..changes-2020-11-28.diff
/home/martin/temp/master..changes-2020-11-28.diff:3847: space before tab in indent.
cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data);
warning: 1 Zeile fügt Whitespace-Fehler hinzu.
How was master..changes-2020-11-28.diff created?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 17:27 ` Alfred M. Szmidt
@ 2020-11-28 18:23 ` martin rudalics
2020-11-28 18:52 ` Alfred M. Szmidt
0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2020-11-28 18:23 UTC (permalink / raw)
To: Alfred M. Szmidt; +Cc: schwab, emacs-devel
> How was master..changes-2020-11-28.diff created?
With
git diff master..changes | tee
where "changes" is the name of the branch that contains my changes. It
would be nice to add an option to warn me about uncommitted changes ...
martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 18:23 ` martin rudalics
@ 2020-11-28 18:52 ` Alfred M. Szmidt
2020-11-29 8:21 ` martin rudalics
0 siblings, 1 reply; 20+ messages in thread
From: Alfred M. Szmidt @ 2020-11-28 18:52 UTC (permalink / raw)
To: martin rudalics; +Cc: schwab, emacs-devel
> How was master..changes-2020-11-28.diff created?
With
git diff master..changes | tee
where "changes" is the name of the branch that contains my changes. It
would be nice to add an option to warn me about uncommitted changes ...
If you do that again, do you get the same type of diff? Does `git
diff` have a configuration that is doing context diffs?
This seems to be an issue with `git diff` rather than with emacs?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 18:52 ` Alfred M. Szmidt
@ 2020-11-29 8:21 ` martin rudalics
2020-11-29 9:13 ` Alfred M. Szmidt
0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2020-11-29 8:21 UTC (permalink / raw)
To: Alfred M. Szmidt; +Cc: schwab, emacs-devel
> If you do that again, do you get the same type of diff?
I get the same result.
> Does `git
> diff` have a configuration that is doing context diffs?
Sure. You just have to be able to understand the doc.
> This seems to be an issue with `git diff` rather than with emacs?
It's an issue with me or better with me and git. I'm only using Emacs to
run git commands from it.
martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-29 8:21 ` martin rudalics
@ 2020-11-29 9:13 ` Alfred M. Szmidt
2020-11-29 9:52 ` martin rudalics
2020-11-29 9:56 ` Yuri Khan
0 siblings, 2 replies; 20+ messages in thread
From: Alfred M. Szmidt @ 2020-11-29 9:13 UTC (permalink / raw)
To: martin rudalics; +Cc: schwab, emacs-devel
> If you do that again, do you get the same type of diff?
I get the same result.
> Does `git
> diff` have a configuration that is doing context diffs?
Sure. You just have to be able to understand the doc.
That is easy to verify, and you should be able to do
HOME=/tmp git diff
and see if the behaviour still is the same (if it doesn't work, just
running as a different user should). If it isn't, it is a
configuraiton setting that you have done -- reading the git-config man
page would be the next action to see where such a setting is set.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-29 9:13 ` Alfred M. Szmidt
@ 2020-11-29 9:52 ` martin rudalics
2020-11-29 9:56 ` Yuri Khan
1 sibling, 0 replies; 20+ messages in thread
From: martin rudalics @ 2020-11-29 9:52 UTC (permalink / raw)
To: Alfred M. Szmidt; +Cc: schwab, emacs-devel
> > If you do that again, do you get the same type of diff?
>
> I get the same result.
>
> > Does `git
> > diff` have a configuration that is doing context diffs?
>
> Sure. You just have to be able to understand the doc.
>
> That is easy to verify, and you should be able to do
>
> HOME=/tmp git diff
>
> and see if the behaviour still is the same (if it doesn't work, just
> running as a different user should). If it isn't, it is a
> configuraiton setting that you have done -- reading the git-config man
> page would be the next action to see where such a setting is set.
But that wasn't my problem. My problem was that I changed a file but
did not commit the change. So git diff picked up the pre-change file
contents and used them instead of the actual file contents. When I
looked at the diff output I was stumped by the fact that it claimed the
presence of a SPC character I couldn't find in that file. The rule is
to always run git status before git diff but I probably had forgotten it
this time.
martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-29 9:13 ` Alfred M. Szmidt
2020-11-29 9:52 ` martin rudalics
@ 2020-11-29 9:56 ` Yuri Khan
1 sibling, 0 replies; 20+ messages in thread
From: Yuri Khan @ 2020-11-29 9:56 UTC (permalink / raw)
To: Alfred M. Szmidt; +Cc: martin rudalics, Andreas Schwab, Emacs developers
On Sun, 29 Nov 2020 at 16:13, Alfred M. Szmidt <ams@gnu.org> wrote:
> > Does `git
> > diff` have a configuration that is doing context diffs?
>
> Sure. You just have to be able to understand the doc.
>
> That is easy to verify, and you should be able to do
>
> HOME=/tmp git diff
>
> and see if the behaviour still is the same (if it doesn't work, just
> running as a different user should). If it isn't, it is a
> configuraiton setting that you have done -- reading the git-config man
> page would be the next action to see where such a setting is set.
Don’t bother. Git diff always does a unified diff.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs, git diff and git apply
2020-11-28 9:29 tabs, git diff and git apply martin rudalics
2020-11-28 9:39 ` Andreas Schwab
@ 2020-11-28 14:40 ` Stefan Monnier
2020-11-28 15:45 ` martin rudalics
1 sibling, 1 reply; 20+ messages in thread
From: Stefan Monnier @ 2020-11-28 14:40 UTC (permalink / raw)
To: martin rudalics; +Cc: emacs-devel
> Some three lines appearing in my window.c as
>
> if (WINDOWP (w->contents))
> cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data);
> else
>
> appear in *shell* after git diff as
>
> + if (WINDOWP (w->contents))
> + cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data);
> + else
>
> Note the extra space after the "+" in the second line and the off-by-one
> indentation.
Any chance you're using non-unified diffs? These match the
"[-+ ] <LINE>" pattern, contrary to unified diffs which use "[-+ ]<LINE>".
IOW, maybe there's nothing wrong.
> A subsequent git apply then complains about
>
> /home/martin/temp/master..changes-2020-11-28.diff:3847: space before tab in indent.
> cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data);
Hard to tell without more info.
Have you tried it in an xterm rather than withing a *shell* buffer?
Stefan
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2020-11-29 9:56 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-28 9:29 tabs, git diff and git apply martin rudalics
2020-11-28 9:39 ` Andreas Schwab
2020-11-28 10:15 ` martin rudalics
2020-11-28 10:23 ` Andreas Schwab
2020-11-28 10:28 ` martin rudalics
2020-11-28 12:08 ` Andreas Schwab
2020-11-28 12:45 ` martin rudalics
2020-11-28 13:34 ` Andreas Schwab
2020-11-28 14:20 ` martin rudalics
2020-11-28 17:27 ` Alfred M. Szmidt
2020-11-28 18:23 ` martin rudalics
2020-11-28 18:52 ` Alfred M. Szmidt
2020-11-29 8:21 ` martin rudalics
2020-11-29 9:13 ` Alfred M. Szmidt
2020-11-29 9:52 ` martin rudalics
2020-11-29 9:56 ` Yuri Khan
2020-11-28 14:40 ` Stefan Monnier
2020-11-28 15:45 ` martin rudalics
2020-11-28 16:47 ` Stefan Monnier
2020-11-28 18:22 ` martin rudalics
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.