Thread (14 messages) flat view 14 messages, 2 authors, 2016-06-15
STALE3747d

[PATCH 5/6] Warn use of "origin" when remotes/origin/HEAD is dangling

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:07
Subsystem: the rest · Maintainer: Linus Torvalds

The previous one squelched the diagnositic message we used to issue every
time we enumerated the refs and noticed a dangling ref.  This adds the
warning back to the place where the user actually attempts to use it.

Signed-off-by: Junio C Hamano <redacted>
---
 sha1_name.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/sha1_name.c b/sha1_name.c
index 5d0ac02..3bd2ef0 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -268,16 +268,18 @@ int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref)
 		char fullref[PATH_MAX];
 		unsigned char sha1_from_ref[20];
 		unsigned char *this_result;
+		int flag;
 
 		this_result = refs_found ? sha1_from_ref : sha1;
 		mksnpath(fullref, sizeof(fullref), *p, len, str);
-		r = resolve_ref(fullref, this_result, 1, NULL);
+		r = resolve_ref(fullref, this_result, 1, &flag);
 		if (r) {
 			if (!refs_found++)
 				*ref = xstrdup(r);
 			if (!warn_ambiguous_refs)
 				break;
-		}
+		} else if (flag & REF_ISSYMREF)
+			warning("ignoring dangling symref %s.", fullref);
 	}
 	free(last_branch);
 	return refs_found;
-- 
1.6.2.rc0.28.g2593d
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help