author | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 25 Mar 2007 09:10:14 +0000 (11:10 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 25 Mar 2007 09:10:14 +0000 (11:10 +0200) |
Makefile | patch | blob | history | |
SITES | patch | blob | history | |
TODO | patch | blob | history | |
tig.c | patch | blob | history | |
tigrc.5.txt | patch | blob | history |
diff --git a/Makefile b/Makefile
index 9d8c57ba761983a8f8b11cae0df8ea22b4d07fc4..0052abd39095f1b3d7098557160af96a8a2f3898 100644 (file)
--- a/Makefile
+++ b/Makefile
docdir = $(prefix)/share/doc
# DESTDIR=
-LDLIBS = -lcurses
+LDLIBS = -lcurses -liconv
CFLAGS = -Wall -O2
DFLAGS = -g -DDEBUG -Werror
PROGS = tig
index 500b9770772df2b5e8fccf28746176044f12c192..3b4e90daebf28283bcac5a83842177bdb96291d9 100644 (file)
--- a/SITES
+++ b/SITES
- - Homepage: http://jonas.nitro.dk/tig[]
+ - Homepage: http://jonas.nitro.dk/tig/[]
- Manual: http://jonas.nitro.dk/tig/manual.html[]
- - Releases: http://jonas.nitro.dk/tig/releases[]
- - Git URL: http://jonas.nitro.dk/tig/tig.git[] or
- git://repo.or.cz/tig.git
- - Gitweb: http://repo.or.cz/?p=tig.git;a=summary[]
+ - Releases: http://jonas.nitro.dk/tig/releases/[]
+ - Git URL: git://repo.or.cz/tig.git (mirror) or
+ http://jonas.nitro.dk/tig/tig.git[] (master)
+ - Gitweb: http://repo.or.cz/w/tig.git[]
index f36da733e21ab36b252fce1b9dfe1a8817e5e081..f176427272e846508fc2cfd52b732b4e5f9c32f9 100644 (file)
--- a/TODO
+++ b/TODO
are both -1, then leaveok is set. The two routines getsyx and setsyx
are designed to be used by a library routine, which manipulates
curses windows but does not want to change the current position of the
- program’s cursor. The library routine would call getsyx at the
+ program cursor. The library routine would call getsyx at the
beginning, do its manipulation of its own windows, do a wnoutrefresh on
its windows, call setsyx, and then call doupdate.
heads and from which tags the commit is reachable, and perhaps which tag is
the latest among the ones reachable from that commit, as part of the commit
detail information you display on the lower pane (log/diff view).
+
+ - Use autoconf to check for iconv in libc and how it is declared (the
+ 2nd argument is 'const' on FreeBSD / Mac OS X). Maybe also check for
+ the AsciiDoc and XmlTo document tools.
+
+ - The autoconf check could also be used to determine whether it is a
+ newer git so that git-config will be used instead of git-repo-config.
index 1983375ca03a517a6d1408b2488c8814cc4d5a31..8deab13773e0646d6269c71077103e10e79574b8 100644 (file)
--- a/tig.c
+++ b/tig.c
#define SCALE_SPLIT_VIEW(height) ((height) * 2 / 3)
#define TIG_LS_REMOTE \
- "git ls-remote . 2>/dev/null"
+ "git ls-remote $(git rev-parse --git-dir) 2>/dev/null"
#define TIG_DIFF_CMD \
"git show --root --patch-with-stat --find-copies-harder -B -C %s 2>/dev/null"
char *name; /* Ref name; tag or head names are shortened. */
char id[SIZEOF_REV]; /* Commit SHA1 ID */
unsigned int tag:1; /* Is it a tag? */
+ unsigned int remote:1; /* Is it a remote ref? */
unsigned int next:1; /* For ref lists: are there more refs? */
};
if (opt_request == REQ_VIEW_MAIN)
/* XXX: This is vulnerable to the user overriding
* options required for the main view parser. */
- string_copy(opt_cmd, "git log --stat --pretty=raw");
+ string_copy(opt_cmd, "git log --pretty=raw");
else
string_copy(opt_cmd, "git");
buf_size = strlen(opt_cmd);
die("command too long");
opt_cmd[buf_size] = 0;
-
}
if (*opt_encoding && strcasecmp(opt_encoding, "UTF-8"))
LINE(MAIN_COMMIT, "", COLOR_DEFAULT, COLOR_DEFAULT, 0), \
LINE(MAIN_DELIM, "", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
LINE(MAIN_TAG, "", COLOR_MAGENTA, COLOR_DEFAULT, A_BOLD), \
+LINE(MAIN_REMOTE, "", COLOR_YELLOW, COLOR_DEFAULT, A_BOLD), \
LINE(MAIN_REF, "", COLOR_CYAN, COLOR_DEFAULT, A_BOLD), \
LINE(TREE_DIR, "", COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), \
LINE(TREE_FILE, "", COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL)
size_t ret;
- ret = iconv(opt_iconv, (const char **) &inbuf, &inlen, &outbuf, &outlen);
+ ret = iconv(opt_iconv, &inbuf, &inlen, &outbuf, &outlen);
if (ret != (size_t) -1) {
line = out_buffer;
linelen = strlen(out_buffer);
char *ref = NULL;
FILE *pipe;
- if (!string_format(refbuf, "git describe %s", commit_id))
+ if (!string_format(refbuf, "git describe %s 2>/dev/null", commit_id))
return TRUE;
pipe = popen(refbuf, "r");
do {
struct ref *ref = refs[refpos];
- char *fmt = ref->tag ? "%s[%s]" : "%s%s";
+ char *fmt = ref->tag ? "%s[%s]" :
+ ref->remote ? "%s<%s>" : "%s%s";
if (!string_format_from(buf, &bufpos, fmt, sep, ref->name))
return;
@@ -2978,6 +2980,8 @@ main_draw(struct view *view, struct line *line, unsigned int lineno, bool select
;
else if (commit->refs[i]->tag)
wattrset(view->win, get_line_attr(LINE_MAIN_TAG));
+ else if (commit->refs[i]->remote)
+ wattrset(view->win, get_line_attr(LINE_MAIN_REMOTE));
else
wattrset(view->win, get_line_attr(LINE_MAIN_REF));
waddstr(view->win, "[");
case LINE_AUTHOR:
{
+ /* Parse author lines where the name may be empty:
+ * author <email@address.tld> 1138474660 +0100
+ */
char *ident = line + STRING_SIZE("author ");
- char *end = strchr(ident, '<');
+ char *nameend = strchr(ident, '<');
+ char *emailend = strchr(ident, '>');
- if (!commit)
+ if (!commit || !nameend || !emailend)
break;
update_rev_graph(graph);
graph = graph->next;
- if (end) {
- char *email = end + 1;
-
- for (; end > ident && isspace(end[-1]); end--) ;
-
- if (end == ident && *email) {
- ident = email;
- end = strchr(ident, '>');
- for (; end > ident && isspace(end[-1]); end--) ;
- }
- *end = 0;
+ *nameend = *emailend = 0;
+ ident = chomp_string(ident);
+ if (!*ident) {
+ ident = chomp_string(nameend + 1);
+ if (!*ident)
+ ident = "Unknown";
}
- /* End is NULL or ident meaning there's no author. */
- if (end <= ident)
- ident = "Unknown";
-
string_copy(commit->author, ident);
/* Parse epoch and timezone */
- if (end) {
- char *secs = strchr(end + 1, '>');
- char *zone;
- time_t time;
-
- if (!secs || secs[1] != ' ')
- break;
+ if (emailend[1] == ' ') {
+ char *secs = emailend + 2;
+ char *zone = strchr(secs, ' ');
+ time_t time = (time_t) atol(secs);
- secs += 2;
- time = (time_t) atol(secs);
- zone = strchr(secs, ' ');
if (zone && strlen(zone) == STRING_SIZE(" +0700")) {
long tz;
time -= tz;
}
+
gmtime_r(&time, &commit->time);
}
break;
{
struct ref *ref;
bool tag = FALSE;
+ bool remote = FALSE;
if (!strncmp(name, "refs/tags/", STRING_SIZE("refs/tags/"))) {
/* Commits referenced by tags has "^{}" appended. */
namelen -= STRING_SIZE("refs/tags/");
name += STRING_SIZE("refs/tags/");
+ } else if (!strncmp(name, "refs/remotes/", STRING_SIZE("refs/remotes/"))) {
+ remote = TRUE;
+ namelen -= STRING_SIZE("refs/remotes/");
+ name += STRING_SIZE("refs/remotes/");
+
} else if (!strncmp(name, "refs/heads/", STRING_SIZE("refs/heads/"))) {
namelen -= STRING_SIZE("refs/heads/");
name += STRING_SIZE("refs/heads/");
strncpy(ref->name, name, namelen);
ref->name[namelen] = 0;
ref->tag = tag;
+ ref->remote = remote;
string_copy(ref->id, id);
return OK;
diff --git a/tigrc.5.txt b/tigrc.5.txt
index 1b1df676c65f2e3fbee7d480f3ab65a6ed91faf7..a3bee01f13defe78ab7cd48f3207f536b25a1e44 100644 (file)
--- a/tigrc.5.txt
+++ b/tigrc.5.txt
delimiting long author names and labels for tag and branch references.
*main-date*, *main-author*, *main-commit*, *main-delim*, *main-tag*,
-*main-ref*
+*main-ref*, *main-remote*
--