cmd_annotate() puts "-c" in front of the user's arguments before calling cmd_blame(), so "--git-completion-helper" is no longer the lone argument that parse-options looks for. It falls through to the diff option parser, which answers it. So "git annotate --<TAB>" offers the options of "git diff" instead of annotate's own. There is no --porcelain, while "git blame --<TAB>" offers it. The "-c" is not needed: cmd_blame() already checks whether argv[0] is "annotate" and sets OUTPUT_ANNOTATE_COMPAT itself. It has done that since7ceacdffc5("blame -c" should be compatible with "annotate", 2008-09-05). argv[0] is always "annotate" here. git.c is the only caller of cmd_annotate(), and it strips "git-" (and ".exe" on Windows) from the command name first. Call cmd_blame() with the arguments as they are, and remove the strvec and its copy.9a48fc1da2(builtin/annotate: fix leaking args vector, 2024-09-30) added the copy, because cmd_blame() changes the array it is given. It is not needed anymore. Since1dd7c32daa(git: refactor builtin handling to use a `struct strvec`, 2024-11-20), handle_builtin() already gives every builtin its own copy of argv. Apart from the completion helpers, "git annotate" gives the same output and exit code as before. Signed-off-by: Tanga Joris <tangajoris@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 lines
279 B
C
17 lines
279 B
C
/*
|
|
* "git annotate" builtin alias
|
|
*
|
|
* Copyright (C) 2006 Ryan Anderson
|
|
*/
|
|
|
|
#include "git-compat-util.h"
|
|
#include "builtin.h"
|
|
|
|
int cmd_annotate(int argc,
|
|
const char **argv,
|
|
const char *prefix,
|
|
struct repository *repo)
|
|
{
|
|
return cmd_blame(argc, argv, prefix, repo);
|
|
}
|