зеркало из https://github.com/microsoft/git.git
Merge branch 'ma/sha1-is-a-hash'
Retire more names with "sha1" in it. * ma/sha1-is-a-hash: hash-lookup: rename from sha1-lookup sha1-lookup: rename `sha1_pos()` as `hash_pos()` object-file.c: rename from sha1-file.c object-name.c: rename from sha1-name.c
This commit is contained in:
Коммит
8b327f1784
6
Makefile
6
Makefile
|
@ -901,6 +901,7 @@ LIB_OBJS += gettext.o
|
||||||
LIB_OBJS += gpg-interface.o
|
LIB_OBJS += gpg-interface.o
|
||||||
LIB_OBJS += graph.o
|
LIB_OBJS += graph.o
|
||||||
LIB_OBJS += grep.o
|
LIB_OBJS += grep.o
|
||||||
|
LIB_OBJS += hash-lookup.o
|
||||||
LIB_OBJS += hashmap.o
|
LIB_OBJS += hashmap.o
|
||||||
LIB_OBJS += help.o
|
LIB_OBJS += help.o
|
||||||
LIB_OBJS += hex.o
|
LIB_OBJS += hex.o
|
||||||
|
@ -937,6 +938,8 @@ LIB_OBJS += notes-cache.o
|
||||||
LIB_OBJS += notes-merge.o
|
LIB_OBJS += notes-merge.o
|
||||||
LIB_OBJS += notes-utils.o
|
LIB_OBJS += notes-utils.o
|
||||||
LIB_OBJS += notes.o
|
LIB_OBJS += notes.o
|
||||||
|
LIB_OBJS += object-file.o
|
||||||
|
LIB_OBJS += object-name.o
|
||||||
LIB_OBJS += object.o
|
LIB_OBJS += object.o
|
||||||
LIB_OBJS += oid-array.o
|
LIB_OBJS += oid-array.o
|
||||||
LIB_OBJS += oidmap.o
|
LIB_OBJS += oidmap.o
|
||||||
|
@ -993,9 +996,6 @@ LIB_OBJS += sequencer.o
|
||||||
LIB_OBJS += serve.o
|
LIB_OBJS += serve.o
|
||||||
LIB_OBJS += server-info.o
|
LIB_OBJS += server-info.o
|
||||||
LIB_OBJS += setup.o
|
LIB_OBJS += setup.o
|
||||||
LIB_OBJS += sha1-file.o
|
|
||||||
LIB_OBJS += sha1-lookup.o
|
|
||||||
LIB_OBJS += sha1-name.o
|
|
||||||
LIB_OBJS += shallow.o
|
LIB_OBJS += shallow.o
|
||||||
LIB_OBJS += sideband.o
|
LIB_OBJS += sideband.o
|
||||||
LIB_OBJS += sigchain.o
|
LIB_OBJS += sigchain.o
|
||||||
|
|
2
bisect.c
2
bisect.c
|
@ -6,7 +6,7 @@
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
#include "list-objects.h"
|
#include "list-objects.h"
|
||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
#include "run-command.h"
|
#include "run-command.h"
|
||||||
#include "log-tree.h"
|
#include "log-tree.h"
|
||||||
#include "bisect.h"
|
#include "bisect.h"
|
||||||
|
|
|
@ -1641,7 +1641,7 @@ static void read_idx_option(struct pack_idx_option *opts, const char *pack_name)
|
||||||
/*
|
/*
|
||||||
* Get rid of the idx file as we do not need it anymore.
|
* Get rid of the idx file as we do not need it anymore.
|
||||||
* NEEDSWORK: extract this bit from free_pack_by_name() in
|
* NEEDSWORK: extract this bit from free_pack_by_name() in
|
||||||
* sha1-file.c, perhaps? It shouldn't matter very much as we
|
* object-file.c, perhaps? It shouldn't matter very much as we
|
||||||
* know we haven't installed this pack (hence we never have
|
* know we haven't installed this pack (hence we never have
|
||||||
* read anything from it).
|
* read anything from it).
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
#include "prio-queue.h"
|
#include "prio-queue.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
#include "commit-slab.h"
|
#include "commit-slab.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -408,7 +408,7 @@ static const char *get_exact_ref_match(const struct object *o)
|
||||||
tip_table.sorted = 1;
|
tip_table.sorted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
found = sha1_pos(o->oid.hash, tip_table.table, tip_table.nr,
|
found = hash_pos(o->oid.hash, tip_table.table, tip_table.nr,
|
||||||
nth_tip_table_ent);
|
nth_tip_table_ent);
|
||||||
if (0 <= found)
|
if (0 <= found)
|
||||||
return tip_table.table[found].refname;
|
return tip_table.table[found].refname;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
#include "revision.h"
|
#include "revision.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
#include "commit-graph.h"
|
#include "commit-graph.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
|
@ -1043,7 +1043,7 @@ static int write_graph_chunk_data(struct hashfile *f,
|
||||||
if (!parent)
|
if (!parent)
|
||||||
edge_value = GRAPH_PARENT_NONE;
|
edge_value = GRAPH_PARENT_NONE;
|
||||||
else {
|
else {
|
||||||
edge_value = sha1_pos(parent->item->object.oid.hash,
|
edge_value = hash_pos(parent->item->object.oid.hash,
|
||||||
ctx->commits.list,
|
ctx->commits.list,
|
||||||
ctx->commits.nr,
|
ctx->commits.nr,
|
||||||
commit_to_sha1);
|
commit_to_sha1);
|
||||||
|
@ -1074,7 +1074,7 @@ static int write_graph_chunk_data(struct hashfile *f,
|
||||||
else if (parent->next)
|
else if (parent->next)
|
||||||
edge_value = GRAPH_EXTRA_EDGES_NEEDED | num_extra_edges;
|
edge_value = GRAPH_EXTRA_EDGES_NEEDED | num_extra_edges;
|
||||||
else {
|
else {
|
||||||
edge_value = sha1_pos(parent->item->object.oid.hash,
|
edge_value = hash_pos(parent->item->object.oid.hash,
|
||||||
ctx->commits.list,
|
ctx->commits.list,
|
||||||
ctx->commits.nr,
|
ctx->commits.nr,
|
||||||
commit_to_sha1);
|
commit_to_sha1);
|
||||||
|
@ -1143,7 +1143,7 @@ static int write_graph_chunk_extra_edges(struct hashfile *f,
|
||||||
|
|
||||||
/* Since num_parents > 2, this initializer is safe. */
|
/* Since num_parents > 2, this initializer is safe. */
|
||||||
for (parent = (*list)->parents->next; parent; parent = parent->next) {
|
for (parent = (*list)->parents->next; parent; parent = parent->next) {
|
||||||
int edge_value = sha1_pos(parent->item->object.oid.hash,
|
int edge_value = hash_pos(parent->item->object.oid.hash,
|
||||||
ctx->commits.list,
|
ctx->commits.list,
|
||||||
ctx->commits.nr,
|
ctx->commits.nr,
|
||||||
commit_to_sha1);
|
commit_to_sha1);
|
||||||
|
|
4
commit.c
4
commit.c
|
@ -14,7 +14,7 @@
|
||||||
#include "mergesort.h"
|
#include "mergesort.h"
|
||||||
#include "commit-slab.h"
|
#include "commit-slab.h"
|
||||||
#include "prio-queue.h"
|
#include "prio-queue.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
#include "wt-status.h"
|
#include "wt-status.h"
|
||||||
#include "advice.h"
|
#include "advice.h"
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
|
@ -113,7 +113,7 @@ static const unsigned char *commit_graft_sha1_access(size_t index, void *table)
|
||||||
|
|
||||||
int commit_graft_pos(struct repository *r, const unsigned char *sha1)
|
int commit_graft_pos(struct repository *r, const unsigned char *sha1)
|
||||||
{
|
{
|
||||||
return sha1_pos(sha1, r->parsed_objects->grafts,
|
return hash_pos(sha1, r->parsed_objects->grafts,
|
||||||
r->parsed_objects->grafts_nr,
|
r->parsed_objects->grafts_nr,
|
||||||
commit_graft_sha1_access);
|
commit_graft_sha1_access);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
|
|
||||||
static uint32_t take2(const unsigned char *sha1)
|
static uint32_t take2(const unsigned char *hash)
|
||||||
{
|
{
|
||||||
return ((sha1[0] << 8) | sha1[1]);
|
return ((hash[0] << 8) | hash[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -47,11 +47,11 @@ static uint32_t take2(const unsigned char *sha1)
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* The table should contain "nr" elements.
|
* The table should contain "nr" elements.
|
||||||
* The sha1 of element i (between 0 and nr - 1) should be returned
|
* The hash of element i (between 0 and nr - 1) should be returned
|
||||||
* by "fn(i, table)".
|
* by "fn(i, table)".
|
||||||
*/
|
*/
|
||||||
int sha1_pos(const unsigned char *hash, void *table, size_t nr,
|
int hash_pos(const unsigned char *hash, void *table, size_t nr,
|
||||||
sha1_access_fn fn)
|
hash_access_fn fn)
|
||||||
{
|
{
|
||||||
size_t hi = nr;
|
size_t hi = nr;
|
||||||
size_t lo = 0;
|
size_t lo = 0;
|
||||||
|
@ -74,7 +74,7 @@ int sha1_pos(const unsigned char *hash, void *table, size_t nr,
|
||||||
if (lov != hiv) {
|
if (lov != hiv) {
|
||||||
/*
|
/*
|
||||||
* At this point miv could be equal
|
* At this point miv could be equal
|
||||||
* to hiv (but sha1 could still be higher);
|
* to hiv (but hash could still be higher);
|
||||||
* the invariant of (mi < hi) should be
|
* the invariant of (mi < hi) should be
|
||||||
* kept.
|
* kept.
|
||||||
*/
|
*/
|
||||||
|
@ -100,17 +100,17 @@ int sha1_pos(const unsigned char *hash, void *table, size_t nr,
|
||||||
return index_pos_to_insert_pos(lo);
|
return index_pos_to_insert_pos(lo);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bsearch_hash(const unsigned char *sha1, const uint32_t *fanout_nbo,
|
int bsearch_hash(const unsigned char *hash, const uint32_t *fanout_nbo,
|
||||||
const unsigned char *table, size_t stride, uint32_t *result)
|
const unsigned char *table, size_t stride, uint32_t *result)
|
||||||
{
|
{
|
||||||
uint32_t hi, lo;
|
uint32_t hi, lo;
|
||||||
|
|
||||||
hi = ntohl(fanout_nbo[*sha1]);
|
hi = ntohl(fanout_nbo[*hash]);
|
||||||
lo = ((*sha1 == 0x0) ? 0 : ntohl(fanout_nbo[*sha1 - 1]));
|
lo = ((*hash == 0x0) ? 0 : ntohl(fanout_nbo[*hash - 1]));
|
||||||
|
|
||||||
while (lo < hi) {
|
while (lo < hi) {
|
||||||
unsigned mi = lo + (hi - lo) / 2;
|
unsigned mi = lo + (hi - lo) / 2;
|
||||||
int cmp = hashcmp(table + mi * stride, sha1);
|
int cmp = hashcmp(table + mi * stride, hash);
|
||||||
|
|
||||||
if (!cmp) {
|
if (!cmp) {
|
||||||
if (result)
|
if (result)
|
|
@ -1,20 +1,20 @@
|
||||||
#ifndef SHA1_LOOKUP_H
|
#ifndef HASH_LOOKUP_H
|
||||||
#define SHA1_LOOKUP_H
|
#define HASH_LOOKUP_H
|
||||||
|
|
||||||
typedef const unsigned char *sha1_access_fn(size_t index, void *table);
|
typedef const unsigned char *hash_access_fn(size_t index, void *table);
|
||||||
|
|
||||||
int sha1_pos(const unsigned char *sha1,
|
int hash_pos(const unsigned char *hash,
|
||||||
void *table,
|
void *table,
|
||||||
size_t nr,
|
size_t nr,
|
||||||
sha1_access_fn fn);
|
hash_access_fn fn);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Searches for sha1 in table, using the given fanout table to determine the
|
* Searches for hash in table, using the given fanout table to determine the
|
||||||
* interval to search, then using binary search. Returns 1 if found, 0 if not.
|
* interval to search, then using binary search. Returns 1 if found, 0 if not.
|
||||||
*
|
*
|
||||||
* Takes the following parameters:
|
* Takes the following parameters:
|
||||||
*
|
*
|
||||||
* - sha1: the hash to search for
|
* - hash: the hash to search for
|
||||||
* - fanout_nbo: a 256-element array of NETWORK-order 32-bit integers; the
|
* - fanout_nbo: a 256-element array of NETWORK-order 32-bit integers; the
|
||||||
* integer at position i represents the number of elements in table whose
|
* integer at position i represents the number of elements in table whose
|
||||||
* first byte is less than or equal to i
|
* first byte is less than or equal to i
|
||||||
|
@ -23,10 +23,10 @@ int sha1_pos(const unsigned char *sha1,
|
||||||
* GIT_MAX_RAWSZ or greater)
|
* GIT_MAX_RAWSZ or greater)
|
||||||
* - result: if not NULL, this function stores the element index of the
|
* - result: if not NULL, this function stores the element index of the
|
||||||
* position found (if the search is successful) or the index of the least
|
* position found (if the search is successful) or the index of the least
|
||||||
* element that is greater than sha1 (if the search is not successful)
|
* element that is greater than hash (if the search is not successful)
|
||||||
*
|
*
|
||||||
* This function does not verify the validity of the fanout table.
|
* This function does not verify the validity of the fanout table.
|
||||||
*/
|
*/
|
||||||
int bsearch_hash(const unsigned char *sha1, const uint32_t *fanout_nbo,
|
int bsearch_hash(const unsigned char *hash, const uint32_t *fanout_nbo,
|
||||||
const unsigned char *table, size_t stride, uint32_t *result);
|
const unsigned char *table, size_t stride, uint32_t *result);
|
||||||
#endif
|
#endif
|
|
@ -21,7 +21,7 @@
|
||||||
* in the traversal (until we mark it SEEN). This is a way to
|
* in the traversal (until we mark it SEEN). This is a way to
|
||||||
* let us silently de-dup calls to show() in the caller. This
|
* let us silently de-dup calls to show() in the caller. This
|
||||||
* is subtly different from the "revision.h:SHOWN" and the
|
* is subtly different from the "revision.h:SHOWN" and the
|
||||||
* "sha1-name.c:ONELINE_SEEN" bits. And also different from
|
* "object-name.c:ONELINE_SEEN" bits. And also different from
|
||||||
* the non-de-dup usage in pack-bitmap.c
|
* the non-de-dup usage in pack-bitmap.c
|
||||||
*/
|
*/
|
||||||
#define FILTER_SHOWN_BUT_REVISIT (1<<21)
|
#define FILTER_SHOWN_BUT_REVISIT (1<<21)
|
||||||
|
|
2
midx.c
2
midx.c
|
@ -5,7 +5,7 @@
|
||||||
#include "lockfile.h"
|
#include "lockfile.h"
|
||||||
#include "packfile.h"
|
#include "packfile.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
#include "midx.h"
|
#include "midx.h"
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
#include "trace2.h"
|
#include "trace2.h"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) Linus Torvalds, 2005
|
* Copyright (C) Linus Torvalds, 2005
|
||||||
*
|
*
|
||||||
* This handles basic git sha1 object files - packing, unpacking,
|
* This handles basic git object files - packing, unpacking,
|
||||||
* creation etc.
|
* creation etc.
|
||||||
*/
|
*/
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
#include "tree-walk.h"
|
#include "tree-walk.h"
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
#include "pack-revindex.h"
|
#include "pack-revindex.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
#include "bulk-checkin.h"
|
#include "bulk-checkin.h"
|
||||||
#include "repository.h"
|
#include "repository.h"
|
||||||
#include "replace-object.h"
|
#include "replace-object.h"
|
||||||
|
@ -508,9 +508,9 @@ static int alt_odb_usable(struct raw_object_store *o,
|
||||||
* LF separated. Its base points at a statically allocated buffer that
|
* LF separated. Its base points at a statically allocated buffer that
|
||||||
* contains "/the/directory/corresponding/to/.git/objects/...", while
|
* contains "/the/directory/corresponding/to/.git/objects/...", while
|
||||||
* its name points just after the slash at the end of ".git/objects/"
|
* its name points just after the slash at the end of ".git/objects/"
|
||||||
* in the example above, and has enough space to hold 40-byte hex
|
* in the example above, and has enough space to hold all hex characters
|
||||||
* SHA1, an extra slash for the first level indirection, and the
|
* of the object ID, an extra slash for the first level indirection, and
|
||||||
* terminating NUL.
|
* the terminating NUL.
|
||||||
*/
|
*/
|
||||||
static void read_info_alternates(struct repository *r,
|
static void read_info_alternates(struct repository *r,
|
||||||
const char *relative_base,
|
const char *relative_base,
|
|
@ -85,7 +85,7 @@ static void update_candidates(struct disambiguate_state *ds, const struct object
|
||||||
/* otherwise, current can be discarded and candidate is still good */
|
/* otherwise, current can be discarded and candidate is still good */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int match_sha(unsigned, const unsigned char *, const unsigned char *);
|
static int match_hash(unsigned, const unsigned char *, const unsigned char *);
|
||||||
|
|
||||||
static void find_short_object_filename(struct disambiguate_state *ds)
|
static void find_short_object_filename(struct disambiguate_state *ds)
|
||||||
{
|
{
|
||||||
|
@ -102,7 +102,7 @@ static void find_short_object_filename(struct disambiguate_state *ds)
|
||||||
while (!ds->ambiguous && pos < loose_objects->nr) {
|
while (!ds->ambiguous && pos < loose_objects->nr) {
|
||||||
const struct object_id *oid;
|
const struct object_id *oid;
|
||||||
oid = loose_objects->oid + pos;
|
oid = loose_objects->oid + pos;
|
||||||
if (!match_sha(ds->len, ds->bin_pfx.hash, oid->hash))
|
if (!match_hash(ds->len, ds->bin_pfx.hash, oid->hash))
|
||||||
break;
|
break;
|
||||||
update_candidates(ds, oid);
|
update_candidates(ds, oid);
|
||||||
pos++;
|
pos++;
|
||||||
|
@ -110,7 +110,7 @@ static void find_short_object_filename(struct disambiguate_state *ds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int match_sha(unsigned len, const unsigned char *a, const unsigned char *b)
|
static int match_hash(unsigned len, const unsigned char *a, const unsigned char *b)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
if (*a != *b)
|
if (*a != *b)
|
||||||
|
@ -145,7 +145,7 @@ static void unique_in_midx(struct multi_pack_index *m,
|
||||||
for (i = first; i < num && !ds->ambiguous; i++) {
|
for (i = first; i < num && !ds->ambiguous; i++) {
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
current = nth_midxed_object_oid(&oid, m, i);
|
current = nth_midxed_object_oid(&oid, m, i);
|
||||||
if (!match_sha(ds->len, ds->bin_pfx.hash, current->hash))
|
if (!match_hash(ds->len, ds->bin_pfx.hash, current->hash))
|
||||||
break;
|
break;
|
||||||
update_candidates(ds, current);
|
update_candidates(ds, current);
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ static void unique_in_pack(struct packed_git *p,
|
||||||
for (i = first; i < num && !ds->ambiguous; i++) {
|
for (i = first; i < num && !ds->ambiguous; i++) {
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
nth_packed_object_id(&oid, p, i);
|
nth_packed_object_id(&oid, p, i);
|
||||||
if (!match_sha(ds->len, ds->bin_pfx.hash, oid.hash))
|
if (!match_hash(ds->len, ds->bin_pfx.hash, oid.hash))
|
||||||
break;
|
break;
|
||||||
update_candidates(ds, &oid);
|
update_candidates(ds, &oid);
|
||||||
}
|
}
|
||||||
|
@ -483,7 +483,7 @@ static enum get_oid_result get_short_oid(struct repository *r,
|
||||||
if (!quietly && (status == SHORT_NAME_AMBIGUOUS)) {
|
if (!quietly && (status == SHORT_NAME_AMBIGUOUS)) {
|
||||||
struct oid_array collect = OID_ARRAY_INIT;
|
struct oid_array collect = OID_ARRAY_INIT;
|
||||||
|
|
||||||
error(_("short SHA1 %s is ambiguous"), ds.hex_pfx);
|
error(_("short object ID %s is ambiguous"), ds.hex_pfx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We may still have ambiguity if we simply saw a series of
|
* We may still have ambiguity if we simply saw a series of
|
||||||
|
@ -1811,7 +1811,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
/*
|
/*
|
||||||
* sha1:path --> object name of path in ent sha1
|
* tree:path --> object name of path in tree
|
||||||
* :path -> object name of absolute path in index
|
* :path -> object name of absolute path in index
|
||||||
* :./path -> object name of path relative to cwd in index
|
* :./path -> object name of path relative to cwd in index
|
||||||
* :[0-3]:path -> object name of path in index at stage
|
* :[0-3]:path -> object name of path in index at stage
|
||||||
|
@ -1949,6 +1949,6 @@ enum get_oid_result get_oid_with_context(struct repository *repo,
|
||||||
struct object_context *oc)
|
struct object_context *oc)
|
||||||
{
|
{
|
||||||
if (flags & GET_OID_FOLLOW_SYMLINKS && flags & GET_OID_ONLY_TO_DIE)
|
if (flags & GET_OID_FOLLOW_SYMLINKS && flags & GET_OID_ONLY_TO_DIE)
|
||||||
BUG("incompatible flags for get_sha1_with_context");
|
BUG("incompatible flags for get_oid_with_context");
|
||||||
return get_oid_with_context_1(repo, str, flags, NULL, oid, oc);
|
return get_oid_with_context_1(repo, str, flags, NULL, oid, oc);
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "oid-array.h"
|
#include "oid-array.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
|
|
||||||
void oid_array_append(struct oid_array *array, const struct object_id *oid)
|
void oid_array_append(struct oid_array *array, const struct object_id *oid)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ static const unsigned char *sha1_access(size_t index, void *table)
|
||||||
int oid_array_lookup(struct oid_array *array, const struct object_id *oid)
|
int oid_array_lookup(struct oid_array *array, const struct object_id *oid)
|
||||||
{
|
{
|
||||||
oid_array_sort(array);
|
oid_array_sort(array);
|
||||||
return sha1_pos(oid->hash, array->oid, array->nr, sha1_access);
|
return hash_pos(oid->hash, array->oid, array->nr, sha1_access);
|
||||||
}
|
}
|
||||||
|
|
||||||
void oid_array_clear(struct oid_array *array)
|
void oid_array_clear(struct oid_array *array)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "pack-revindex.h"
|
#include "pack-revindex.h"
|
||||||
#include "pack.h"
|
#include "pack.h"
|
||||||
#include "pack-bitmap.h"
|
#include "pack-bitmap.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
#include "pack-objects.h"
|
#include "pack-objects.h"
|
||||||
#include "commit-reach.h"
|
#include "commit-reach.h"
|
||||||
#include "prio-queue.h"
|
#include "prio-queue.h"
|
||||||
|
@ -626,7 +626,7 @@ static void write_selected_commits_v1(struct hashfile *f,
|
||||||
struct bitmapped_commit *stored = &writer.selected[i];
|
struct bitmapped_commit *stored = &writer.selected[i];
|
||||||
|
|
||||||
int commit_pos =
|
int commit_pos =
|
||||||
sha1_pos(stored->commit->object.oid.hash, index, index_nr, sha1_access);
|
hash_pos(stored->commit->object.oid.hash, index, index_nr, sha1_access);
|
||||||
|
|
||||||
if (commit_pos < 0)
|
if (commit_pos < 0)
|
||||||
BUG("trying to write commit not in index");
|
BUG("trying to write commit not in index");
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "packfile.h"
|
#include "packfile.h"
|
||||||
#include "delta.h"
|
#include "delta.h"
|
||||||
#include "streaming.h"
|
#include "streaming.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "diff.h"
|
#include "diff.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
#include "patch-ids.h"
|
#include "patch-ids.h"
|
||||||
|
|
||||||
static int patch_id_defined(struct commit *commit)
|
static int patch_id_defined(struct commit *commit)
|
||||||
|
|
4
rerere.c
4
rerere.c
|
@ -10,7 +10,7 @@
|
||||||
#include "attr.h"
|
#include "attr.h"
|
||||||
#include "pathspec.h"
|
#include "pathspec.h"
|
||||||
#include "object-store.h"
|
#include "object-store.h"
|
||||||
#include "sha1-lookup.h"
|
#include "hash-lookup.h"
|
||||||
|
|
||||||
#define RESOLVED 0
|
#define RESOLVED 0
|
||||||
#define PUNTED 1
|
#define PUNTED 1
|
||||||
|
@ -147,7 +147,7 @@ static struct rerere_dir *find_rerere_dir(const char *hex)
|
||||||
|
|
||||||
if (get_sha1_hex(hex, hash))
|
if (get_sha1_hex(hex, hash))
|
||||||
return NULL; /* BUG */
|
return NULL; /* BUG */
|
||||||
pos = sha1_pos(hash, rerere_dir, rerere_dir_nr, rerere_dir_hash);
|
pos = hash_pos(hash, rerere_dir, rerere_dir_nr, rerere_dir_hash);
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
rr_dir = xmalloc(sizeof(*rr_dir));
|
rr_dir = xmalloc(sizeof(*rr_dir));
|
||||||
hashcpy(rr_dir->hash, hash);
|
hashcpy(rr_dir->hash, hash);
|
||||||
|
|
|
@ -5,7 +5,7 @@ starting with `#` are ignored. The key and value are separated by whitespace
|
||||||
(specifically, those whitespace in the default `$IFS`). The key consists only
|
(specifically, those whitespace in the default `$IFS`). The key consists only
|
||||||
of shell identifier characters, and the value consists of a hash algorithm,
|
of shell identifier characters, and the value consists of a hash algorithm,
|
||||||
colon, and value. The hash algorithm also consists only of shell identifier
|
colon, and value. The hash algorithm also consists only of shell identifier
|
||||||
characters; it should match the value in sha1-file.c.
|
characters; it should match the value in object-file.c.
|
||||||
|
|
||||||
For example, the following lines map the key "rawsz" to "20" if SHA-1 is in use
|
For example, the following lines map the key "rawsz" to "20" if SHA-1 is in use
|
||||||
and to "32" if SHA-256 is in use:
|
and to "32" if SHA-256 is in use:
|
||||||
|
|
|
@ -48,7 +48,7 @@ test_expect_success 'blob and tree' '
|
||||||
|
|
||||||
test_expect_success 'warn ambiguity when no candidate matches type hint' '
|
test_expect_success 'warn ambiguity when no candidate matches type hint' '
|
||||||
test_must_fail git rev-parse --verify 000000000^{commit} 2>actual &&
|
test_must_fail git rev-parse --verify 000000000^{commit} 2>actual &&
|
||||||
test_i18ngrep "short SHA1 000000000 is ambiguous" actual
|
test_i18ngrep "short object ID 000000000 is ambiguous" actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'disambiguate tree-ish' '
|
test_expect_success 'disambiguate tree-ish' '
|
||||||
|
|
Загрузка…
Ссылка в новой задаче