aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-06 14:53:10 -0700
committerJunio C Hamano <gitster@pobox.com>2016-10-06 14:53:10 -0700
commit66c22ba6fbe0724ecce3d82611ff0ec5c2b0255f (patch)
tree8829eb1f019a57f5bdd3743d081e0751f38340c9 /builtin
parent0cf36115dce7438a0eafad54a81cc57175e8fb54 (diff)
parent5b33cb1fd733f581da07ae8afa7e9547eafd248e (diff)
downloadgit-66c22ba6fbe0724ecce3d82611ff0ec5c2b0255f.tar.gz
git-66c22ba6fbe0724ecce3d82611ff0ec5c2b0255f.tar.xz
Merge branch 'jk/ambiguous-short-object-names'
When given an abbreviated object name that is not (or more realistically, "no longer") unique, we gave a fatal error "ambiguous argument". This error is now accompanied by hints that lists the objects that begins with the given prefix. During the course of development of this new feature, numerous minor bugs were uncovered and corrected, the most notable one of which is that we gave "short SHA1 xxxx is ambiguous." twice without good reason. * jk/ambiguous-short-object-names: get_short_sha1: make default disambiguation configurable get_short_sha1: list ambiguous objects on error for_each_abbrev: drop duplicate objects sha1_array: let callbacks interrupt iteration get_short_sha1: mark ambiguity error for translation get_short_sha1: NUL-terminate hex prefix get_short_sha1: refactor init of disambiguation code get_short_sha1: parse tags when looking for treeish get_sha1: propagate flags to child functions get_sha1: avoid repeating ourselves via ONLY_TO_DIE get_sha1: detect buggy calls with multiple disambiguators
Diffstat (limited to 'builtin')
-rw-r--r--builtin/cat-file.c3
-rw-r--r--builtin/receive-pack.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 94e67ebb7..cca97a86c 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -401,11 +401,12 @@ struct object_cb_data {
struct expand_data *expand;
};
-static void batch_object_cb(const unsigned char sha1[20], void *vdata)
+static int batch_object_cb(const unsigned char sha1[20], void *vdata)
{
struct object_cb_data *data = vdata;
hashcpy(data->expand->oid.hash, sha1);
batch_object_write(NULL, data->opt, data->expand);
+ return 0;
}
static int batch_loose_object(const unsigned char *sha1,
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 896b16f2c..f7cd18025 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -268,9 +268,10 @@ static int show_ref_cb(const char *path_full, const struct object_id *oid,
return 0;
}
-static void show_one_alternate_sha1(const unsigned char sha1[20], void *unused)
+static int show_one_alternate_sha1(const unsigned char sha1[20], void *unused)
{
show_ref(".have", sha1);
+ return 0;
}
static void collect_one_alternate_ref(const struct ref *ref, void *data)