refs: make rev-parse --quiet actually quiet
When a reflog is deleted, e.g. when "git stash" clears its stashes, "git rev-parse --verify --quiet" dies: fatal: Log for refs/stash is empty. The reason is that the get_sha1() code path does not allow us to suppress this message. Pass the flags bitfield through get_sha1_with_context() so that read_ref_at() can suppress the message. Use get_sha1_with_context1() instead of get_sha1() in rev-parse so that the --quiet flag is honored. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
2892dfeec3
commit
c41a87dd80
@ -723,6 +723,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
|
||||
char nth_desc[256];
|
||||
char *ref;
|
||||
int base = 0;
|
||||
unsigned int flags = 0;
|
||||
|
||||
if (ac == 0) {
|
||||
static const char *fake_av[2];
|
||||
@ -749,7 +750,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
|
||||
/* Ah, that is a date spec... */
|
||||
unsigned long at;
|
||||
at = approxidate(reflog_base);
|
||||
read_ref_at(ref, at, -1, sha1, NULL,
|
||||
read_ref_at(ref, flags, at, -1, sha1, NULL,
|
||||
NULL, NULL, &base);
|
||||
}
|
||||
}
|
||||
@ -760,7 +761,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
|
||||
unsigned long timestamp;
|
||||
int tz;
|
||||
|
||||
if (read_ref_at(ref, 0, base+i, sha1, &logmsg,
|
||||
if (read_ref_at(ref, flags, 0, base+i, sha1, &logmsg,
|
||||
×tamp, &tz, NULL)) {
|
||||
reflog = i;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user