Skip to content

Commit 9060863

Browse files
committed
add: use advise function to display hints
Use the advise function in advice.c to display hints to the users, as it provides a neat and a standard format for hint messages, i.e: the text is colored in yellow and the line starts by the word "hint:". Signed-off-by: Heba Waly <[email protected]>
1 parent 0a76bd7 commit 9060863

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

builtin/add.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ static int add_files(struct dir_struct *dir, int flags)
390390
fprintf(stderr, _(ignore_error));
391391
for (i = 0; i < dir->ignored_nr; i++)
392392
fprintf(stderr, "%s\n", dir->ignored[i]->name);
393-
fprintf(stderr, _("Use -f if you really want to add them.\n"));
393+
advise(_("Use -f if you really want to add them.\n"));
394394
exit_status = 1;
395395
}
396396

@@ -480,7 +480,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
480480

481481
if (require_pathspec && pathspec.nr == 0) {
482482
fprintf(stderr, _("Nothing specified, nothing added.\n"));
483-
fprintf(stderr, _("Maybe you wanted to say 'git add .'?\n"));
483+
advise( _("Maybe you wanted to say 'git add .'?\n"));
484484
return 0;
485485
}
486486

t/t3700-add.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ test_expect_success 'git add --dry-run of an existing file output' "
326326
cat >expect.err <<\EOF
327327
The following paths are ignored by one of your .gitignore files:
328328
ignored-file
329-
Use -f if you really want to add them.
329+
hint: Use -f if you really want to add them.
330330
EOF
331331
cat >expect.out <<\EOF
332332
add 'track-this'

0 commit comments

Comments
 (0)