Skip to content

Commit

Permalink
merge: fix swapped "up to date" message components
Browse files Browse the repository at this point in the history
The rewrite of git-merge from shell to C in 1c7b76b (Build in merge,
2008-07-07) accidentally transformed the message:

    Already up-to-date. (nothing to squash)

to:

    (nothing to squash)Already up-to-date.

due to reversed printf() arguments. This problem has gone unnoticed
despite being touched over the years by 7f87aff (Teach/Fix pull/fetch
-q/-v options, 2008-11-15) and bacec47 (i18n: git-merge basic
messages, 2011-02-22), and tangentially by bef4830 (i18n: merge: mark
messages for translation, 2016-06-17) and 7560f54 (treewide: correct
several "up-to-date" to "up to date", 2017-08-23).

Fix it by restoring the message to its intended order. While at it, help
translators out by avoiding "sentence Lego".

[es: rewrote commit message]

Co-authored-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
2 people authored and gitster committed May 3, 2021
1 parent 80cde95 commit ad9322d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions builtin/merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,14 @@ static void restore_state(const struct object_id *head,
}

/* This is called when no merge was necessary. */
static void finish_up_to_date(const char *msg)
static void finish_up_to_date(void)
{
if (verbosity >= 0)
printf("%s%s\n", squash ? _(" (nothing to squash)") : "", msg);
if (verbosity >= 0) {
if (squash)
puts(_("Already up to date. (nothing to squash)"));
else
puts(_("Already up to date."));
}
remove_merge_branch_state(the_repository);
}

Expand Down Expand Up @@ -1522,7 +1526,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
* If head can reach all the merge then we are up to date.
* but first the most common case of merging one remote.
*/
finish_up_to_date(_("Already up to date."));
finish_up_to_date();
goto done;
} else if (fast_forward != FF_NO && !remoteheads->next &&
!common->next &&
Expand Down Expand Up @@ -1610,7 +1614,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
}
}
if (up_to_date) {
finish_up_to_date(_("Already up to date."));
finish_up_to_date();
goto done;
}
}
Expand Down

0 comments on commit ad9322d

Please sign in to comment.