1443
1444
static int handle_dotdot_1(const char *arg, char *dotdot,
1445
struct rev_info *revs, int flags,
1446
- int cant_be_filename)
1446
+ int cant_be_filename,
1447
+ struct object_context *a_oc,
1448
+ struct object_context *b_oc)
1449
{
1450
const char *a_name, *b_name;
1451
struct object_id a_oid, b_oid;
1452
struct object *a_obj, *b_obj;
1451
- struct object_context a_oc, b_oc;
1453
unsigned int a_flags, b_flags;
1454
int symmetric = 0;
1455
unsigned int flags_exclude = flags ^ (UNINTERESTING | BOTTOM);
1455
- unsigned int oc_flags = GET_SHA1_COMMITTISH;
1456
+ unsigned int oc_flags = GET_SHA1_COMMITTISH | GET_SHA1_RECORD_PATH;
1457
1458
a_name = arg;
1459
if (!*a_name)
1467
if (!*b_name)
1468
b_name = "HEAD";
1469
1469
- if (get_sha1_with_context(a_name, oc_flags, a_oid.hash, &a_oc) ||
1470
- get_sha1_with_context(b_name, oc_flags, b_oid.hash, &b_oc))
1470
+ if (get_sha1_with_context(a_name, oc_flags, a_oid.hash, a_oc) ||
1471
+ get_sha1_with_context(b_name, oc_flags, b_oid.hash, b_oc))
1472
return -1;
1473
1474
if (!cant_be_filename) {
1510
b_obj->flags |= b_flags;
1511
add_rev_cmdline(revs, a_obj, a_name, REV_CMD_LEFT, a_flags);
1512
add_rev_cmdline(revs, b_obj, b_name, REV_CMD_RIGHT, b_flags);
1512
- add_pending_object_with_mode(revs, a_obj, a_name, a_oc.mode);
1513
- add_pending_object_with_mode(revs, b_obj, b_name, b_oc.mode);
1513
+ add_pending_object_with_path(revs, a_obj, a_name, a_oc->mode, a_oc->path);
1514
+ add_pending_object_with_path(revs, b_obj, b_name, b_oc->mode, b_oc->path);
1515
return 0;
1516
}
1517
1519
struct rev_info *revs, int flags,
1520
int cant_be_filename)
1521
{
1522
+ struct object_context a_oc, b_oc;
1523
char *dotdot = strstr(arg, "..");
1524
int ret;
1525
1526
if (!dotdot)
1527
return -1;
1528
1529
+ memset(&a_oc, 0, sizeof(a_oc));
1530
+ memset(&b_oc, 0, sizeof(b_oc));
1531
+
1532
*dotdot = '\0';
1528
- ret = handle_dotdot_1(arg, dotdot, revs, flags, cant_be_filename);
1533
+ ret = handle_dotdot_1(arg, dotdot, revs, flags, cant_be_filename,
1534
+ &a_oc, &b_oc);
1535
*dotdot = '.';
1536
1537
+ free(a_oc.path);
1538
+ free(b_oc.path);
1539
+
1540
return ret;
1541
}
1542
1549
int local_flags;
1550
const char *arg = arg_;
1551
int cant_be_filename = revarg_opt & REVARG_CANNOT_BE_FILENAME;
1543
- unsigned get_sha1_flags = 0;
1552
+ unsigned get_sha1_flags = GET_SHA1_RECORD_PATH;
1553
1554
flags = flags & UNINTERESTING ? flags | BOTTOM : flags & ~BOTTOM;
1555
1600
}
1601
1602
if (revarg_opt & REVARG_COMMITTISH)
1594
- get_sha1_flags = GET_SHA1_COMMITTISH;
1603
+ get_sha1_flags |= GET_SHA1_COMMITTISH;
1604
1605
if (get_sha1_with_context(arg, get_sha1_flags, sha1, &oc))
1606
return revs->ignore_missing ? 0 : -1;
1608
verify_non_filename(revs->prefix, arg);
1609
object = get_reference(revs, arg, sha1, flags ^ local_flags);
1610
add_rev_cmdline(revs, object, arg_, REV_CMD_REV, flags ^ local_flags);
1602
- add_pending_object_with_mode(revs, object, arg, oc.mode);
1611
+ add_pending_object_with_path(revs, object, arg, oc.mode, oc.path);
1612
+ free(oc.path);
1613
return 0;
1614
}
1615