summaryrefslogtreecommitdiff
path: root/builtin-checkout.c
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2009-01-17 17:09:54 +0100
committerJunio C Hamano <gitster@pobox.com>2009-01-17 18:37:02 -0800
commita884d0cb71463c28d0329c593dce1ef9758f6177 (patch)
treec684355d77afba751051ee99463b7824104b7683 /builtin-checkout.c
parentae5a6c3684c378bc32c1f6ecc0e6dc45300c14c1 (diff)
downloadgit-a884d0cb71463c28d0329c593dce1ef9758f6177.tar.gz
sha1_name: tweak @{-N} lookup
Have the lookup only look at "interesting" checkouts, meaning those that tell you "Already on ..." don't count even though they also cause a reflog entry. Let interpret_nth_last_branch() return the number of characters parsed, so that git-checkout can verify that the branch spec was @{-N}, not @{-1}^2 or something like that. (The latter will be added later.) Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-checkout.c')
-rw-r--r--builtin-checkout.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin-checkout.c b/builtin-checkout.c
index a3b69d6b94..dc1de06279 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -361,8 +361,10 @@ struct branch_info {
static void setup_branch_path(struct branch_info *branch)
{
struct strbuf buf = STRBUF_INIT;
+ int ret;
- if (!interpret_nth_last_branch(branch->name, &buf)) {
+ if ((ret = interpret_nth_last_branch(branch->name, &buf))
+ && ret == strlen(branch->name)) {
branch->name = xstrdup(buf.buf);
strbuf_splice(&buf, 0, 0, "refs/heads/", 11);
} else {