[PATCH 5/3], was Re: [PATCH 4/3] provide a nice @{...} syntax to always mean the current branch reflog

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Also bring the '@{...}' notation to git-log -g

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@xxxxxx>

---

 reflog-walk.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/reflog-walk.c b/reflog-walk.c
index 8262160..653ec95 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -165,6 +165,14 @@ void add_reflog_for_walk(struct reflog_walk_info *info,
 	if (item)
 		reflogs = item->util;
 	else {
+		if (*branch == '\0') {
+			unsigned char sha1[20];
+			const char *head = resolve_ref("HEAD", sha1, 0, NULL);
+			if (!head)
+				die ("No current branch");
+			free(branch);
+			branch = xstrdup(head);
+		}
 		reflogs = read_complete_reflog(branch);
 		if (!reflogs || reflogs->nr == 0)
 			die("No reflogs found for '%s'", branch);

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]