Re: [PATCH] diff.c: Fix whitespace issues due to a mismerge(?)
Junio C Hamanowrites: > Thanks for spotting. > > I do not think you have to worry about any bug in Git-the-program > with this merge. If you try to reproduce the merge yourself (which > by the way is easy to do, with "M=4af9a7d344 && git checkout $M^ && > git merge $M^2"), you'll see that quite a lot of changes made to > "builtin/apply.c" had to be hand-ported to the corresponding lines > that are now in "apply.c" at the top-level, because in the meantime > 13b5af22 ("apply: move libified code from builtin/apply.c to > apply.{c,h}", 2016-04-22) moved things around while the merged side > branch has been cooking. > > It is very likely that manual killing and yanking in Emacs > introduced the screw-up. I did your patch manually by hand and saw that a few hunks are still left whitespace-broken by your patch, so I committed this one instead. Thanks. -- >8 -- From: Junio C Hamano Date: Mon, 8 May 2017 19:30:24 -0700 Subject: [PATCH] apply.c: fix whitespace-only mismerge 4af9a7d3 ("Merge branch 'bc/object-id'", 2016-09-19) involved merging a lot of changes made to builtin/apply.c on the side branch manually to apply.c as an intervening commit 13b5af22 ("apply: move libified code from builtin/apply.c to apply.{c,h}", 2016-04-22) moved a lot of the lines changed on the side branch to a different file apply.c at the top-level, requiring manual patching of it. Apparently, the maintainer screwed up and made the code indent in a funny way while doing so. Reported-by: Stefan Beller Signed-off-by: Junio C Hamano --- apply.c | 338 1 file changed, 169 insertions(+), 169 deletions(-) diff --git a/apply.c b/apply.c index 0e2caeab9c..acebd1cb49 100644 --- a/apply.c +++ b/apply.c @@ -4091,181 +4091,181 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list) res = write_locked_index(, , COMMIT_LOCK); discard_index(); -if (res) -return error(_("could not write temporary index to %s"), - state->fake_ancestor); + if (res) + return error(_("could not write temporary index to %s"), +state->fake_ancestor); -return 0; - } + return 0; +} - static void stat_patch_list(struct apply_state *state, struct patch *patch) - { -int files, adds, dels; +static void stat_patch_list(struct apply_state *state, struct patch *patch) +{ + int files, adds, dels; -for (files = adds = dels = 0 ; patch ; patch = patch->next) { -files++; -adds += patch->lines_added; -dels += patch->lines_deleted; -show_stats(state, patch); -} + for (files = adds = dels = 0 ; patch ; patch = patch->next) { + files++; + adds += patch->lines_added; + dels += patch->lines_deleted; + show_stats(state, patch); + } -print_stat_summary(stdout, files, adds, dels); - } + print_stat_summary(stdout, files, adds, dels); +} - static void numstat_patch_list(struct apply_state *state, - struct patch *patch) - { -for ( ; patch; patch = patch->next) { -const char *name; -name = patch->new_name ? patch->new_name : patch->old_name; -if (patch->is_binary) -printf("-\t-\t"); -else -printf("%d\t%d\t", patch->lines_added, patch->lines_deleted); -write_name_quoted(name, stdout, state->line_termination); -} - } - - static void show_file_mode_name(const char *newdelete, unsigned int mode, const char *name) - { -if (mode) -printf(" %s mode %06o %s\n", newdelete, mode, name); -else -printf(" %s %s\n", newdelete, name); - } - - static void show_mode_change(struct patch *p, int show_name) - { -if (p->old_mode && p->new_mode && p->old_mode != p->new_mode) { -if (show_name) -printf(" mode change %06o => %06o %s\n", - p->old_mode, p->new_mode, p->new_name); -else -printf(" mode change %06o => %06o\n", - p->old_mode, p->new_mode); -} - } - - static void show_rename_copy(struct patch *p) - { -const char *renamecopy = p->is_rename ? "rename" : "copy"; -const char *old, *new; - -/* Find common prefix */ -old = p->old_name; -new = p->new_name; -while (1) { -const char *slash_old, *slash_new; -slash_old = strchr(old, '/'); -slash_new = strchr(new, '/'); -if (!slash_old || -!slash_new || -
Re: [PATCH] diff.c: Fix whitespace issues due to a mismerge(?)
Stefan Bellerwrites: > It looks like all these lines were introduced by one of the conflict chunks > in 4af9a7d344 (Merge branch 'bc/object-id', 2016-09-19). Viewing that > commit in gitk, the indentation seems fine, i.e. there is just one > whitespace in front of the lines, as you would expect from a formatted > patch. > > Signed-off-by: Stefan Beller > --- > > Junio, > I do not think it is worth to apply this patch on its own, > but maybe it is worth to investigate your setup? (Assuming it is > git that did the merge, we may have a bug in whitespacing and > merge conflicts.) Thanks for spotting. I do not think you have to worry about any bug in Git-the-program with this merge. If you try to reproduce the merge yourself (which by the way is easy to do, with "M=4af9a7d344 && git checkout $M^ && git merge $M^2"), you'll see that quite a lot of changes made to "builtin/apply.c" had to be hand-ported to the corresponding lines that are now in "apply.c" at the top-level, because in the meantime 13b5af22 ("apply: move libified code from builtin/apply.c to apply.{c,h}", 2016-04-22) moved things around while the merged side branch has been cooking. It is very likely that manual killing and yanking in Emacs introduced the screw-up.
[PATCH] diff.c: Fix whitespace issues due to a mismerge(?)
Re-indent lines, as they were off by one. When a line was not indented (as you would expect from function defintions) we had a stray whitespace preceding the line. Indented lines have a stray white space after the indentation by tabs, before the actual text, i.e. if (...) ... It looks like all these lines were introduced by one of the conflict chunks in 4af9a7d344 (Merge branch 'bc/object-id', 2016-09-19). Viewing that commit in gitk, the indentation seems fine, i.e. there is just one whitespace in front of the lines, as you would expect from a formatted patch. Signed-off-by: Stefan Beller--- Junio, I do not think it is worth to apply this patch on its own, but maybe it is worth to investigate your setup? (Assuming it is git that did the merge, we may have a bug in whitespacing and merge conflicts.) Thanks, Stefan apply.c | 310 1 file changed, 155 insertions(+), 155 deletions(-) diff --git a/apply.c b/apply.c index e6dbab26ad..be340991d7 100644 --- a/apply.c +++ b/apply.c @@ -4098,172 +4098,172 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list) return 0; } - static void stat_patch_list(struct apply_state *state, struct patch *patch) - { -int files, adds, dels; - -for (files = adds = dels = 0 ; patch ; patch = patch->next) { -files++; -adds += patch->lines_added; -dels += patch->lines_deleted; -show_stats(state, patch); -} - -print_stat_summary(stdout, files, adds, dels); - } +static void stat_patch_list(struct apply_state *state, struct patch *patch) +{ + int files, adds, dels; - static void numstat_patch_list(struct apply_state *state, + for (files = adds = dels = 0 ; patch ; patch = patch->next) { + files++; + adds += patch->lines_added; + dels += patch->lines_deleted; + show_stats(state, patch); + } + + print_stat_summary(stdout, files, adds, dels); +} + +static void numstat_patch_list(struct apply_state *state, struct patch *patch) - { -for ( ; patch; patch = patch->next) { -const char *name; -name = patch->new_name ? patch->new_name : patch->old_name; -if (patch->is_binary) -printf("-\t-\t"); -else -printf("%d\t%d\t", patch->lines_added, patch->lines_deleted); -write_name_quoted(name, stdout, state->line_termination); -} - } +{ + for ( ; patch; patch = patch->next) { + const char *name; + name = patch->new_name ? patch->new_name : patch->old_name; + if (patch->is_binary) + printf("-\t-\t"); + else + printf("%d\t%d\t", patch->lines_added, patch->lines_deleted); + write_name_quoted(name, stdout, state->line_termination); + } +} - static void show_file_mode_name(const char *newdelete, unsigned int mode, const char *name) - { -if (mode) -printf(" %s mode %06o %s\n", newdelete, mode, name); +static void show_file_mode_name(const char *newdelete, unsigned int mode, const char *name) +{ + if (mode) + printf(" %s mode %06o %s\n", newdelete, mode, name); else -printf(" %s %s\n", newdelete, name); - } + printf(" %s %s\n", newdelete, name); +} - static void show_mode_change(struct patch *p, int show_name) - { -if (p->old_mode && p->new_mode && p->old_mode != p->new_mode) { -if (show_name) -printf(" mode change %06o => %06o %s\n", +static void show_mode_change(struct patch *p, int show_name) +{ + if (p->old_mode && p->new_mode && p->old_mode != p->new_mode) { + if (show_name) + printf(" mode change %06o => %06o %s\n", p->old_mode, p->new_mode, p->new_name); -else -printf(" mode change %06o => %06o\n", - p->old_mode, p->new_mode); -} - } + else + printf(" mode change %06o => %06o\n", + p->old_mode, p->new_mode); + } +} - static void show_rename_copy(struct patch *p) - { -const char *renamecopy = p->is_rename ? "rename" : "copy"; -const char *old, *new; - -/* Find common prefix */ -old = p->old_name; -new = p->new_name; -while (1) { -const char *slash_old, *slash_new; -slash_old = strchr(old, '/'); -slash_new = strchr(new, '/'); -if (!slash_old || -!slash_new || -slash_old - old != slash_new