Merge branch 'tr/previous-branch'
authorJunio C Hamano <gitster@pobox.com>
Wed, 28 Jan 2009 23:00:27 +0000 (15:00 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Jan 2009 23:00:27 +0000 (15:00 -0800)
* tr/previous-branch:
t1505: remove debugging cruft
Simplify parsing branch switching events in reflog
Introduce for_each_recent_reflog_ent().
interpret_nth_last_branch(): plug small memleak
Fix reflog parsing for a malformed branch switching entry
Fix parsing of @{-1}@{1}
interpret_nth_last_branch(): avoid traversing the reflog twice
checkout: implement "-" abbreviation, add docs and tests
sha1_name: support @{-N} syntax in get_sha1()
sha1_name: tweak @{-N} lookup
checkout: implement "@{-N}" shortcut name for N-th last branch

Conflicts:
sha1_name.c

1  2 
builtin-checkout.c
cache.h
sha1_name.c
Simple merge
diff --cc cache.h
Simple merge
diff --cc sha1_name.c
index 722fc35a6d98e1c260c6e14738ad3b2d41d924aa,7d95bbb27ae7485525d89281fb79f8f1fbc3da51..5d0ac0263d04d7ec72a3b7dec4aaf47aec80da5e
@@@ -307,10 -332,10 +332,10 @@@ static int get_sha1_basic(const char *s
        if (len == 40 && !get_sha1_hex(str, sha1))
                return 0;
  
-       /* basic@{time or number} format to query ref-log */
+       /* basic@{time or number or -number} format to query ref-log */
        reflog_len = at = 0;
 -      if (str[len-1] == '}') {
 +      if (len && str[len-1] == '}') {
-               for (at = 0; at < len - 1; at++) {
+               for (at = len-2; at >= 0; at--) {
                        if (str[at] == '@' && str[at+1] == '{') {
                                reflog_len = (len-1) - (at+2);
                                len = at;