refs: pass NULL to resolve_ref_unsafe() if hash is not needed
This allows us to get rid of some write-only variables, among them seven SHA1 buffers. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
e691b027b6
commit
744c040b19
@ -17,9 +17,8 @@
|
||||
static char *get_default_remote(void)
|
||||
{
|
||||
char *dest = NULL, *ret;
|
||||
unsigned char sha1[20];
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
const char *refname = resolve_ref_unsafe("HEAD", 0, sha1, NULL);
|
||||
const char *refname = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
|
||||
|
||||
if (!refname)
|
||||
die(_("No such ref: %s"), "HEAD");
|
||||
@ -1089,8 +1088,7 @@ static const char *remote_submodule_branch(const char *path)
|
||||
return "master";
|
||||
|
||||
if (!strcmp(branch, ".")) {
|
||||
unsigned char sha1[20];
|
||||
const char *refname = resolve_ref_unsafe("HEAD", 0, sha1, NULL);
|
||||
const char *refname = resolve_ref_unsafe("HEAD", 0, NULL, NULL);
|
||||
|
||||
if (!refname)
|
||||
die(_("No such ref: %s"), "HEAD");
|
||||
|
Reference in New Issue
Block a user