]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'nd/sha1-name-c-wo-the-repository'
authorJunio C Hamano <gitster@pobox.com>
Wed, 8 May 2019 15:37:24 +0000 (00:37 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 May 2019 15:37:25 +0000 (00:37 +0900)
Further code clean-up to allow the lowest level of name-to-object
mapping layer to work with a passed-in repository other than the
default one.

* nd/sha1-name-c-wo-the-repository: (34 commits)
  sha1-name.c: remove the_repo from get_oid_mb()
  sha1-name.c: remove the_repo from other get_oid_*
  sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_name
  submodule-config.c: use repo_get_oid for reading .gitmodules
  sha1-name.c: add repo_get_oid()
  sha1-name.c: remove the_repo from get_oid_with_context_1()
  sha1-name.c: remove the_repo from resolve_relative_path()
  sha1-name.c: remove the_repo from diagnose_invalid_index_path()
  sha1-name.c: remove the_repo from handle_one_ref()
  sha1-name.c: remove the_repo from get_oid_1()
  sha1-name.c: remove the_repo from get_oid_basic()
  sha1-name.c: remove the_repo from get_describe_name()
  sha1-name.c: remove the_repo from get_oid_oneline()
  sha1-name.c: add repo_interpret_branch_name()
  sha1-name.c: remove the_repo from interpret_branch_mark()
  sha1-name.c: remove the_repo from interpret_nth_prior_checkout()
  sha1-name.c: remove the_repo from get_short_oid()
  sha1-name.c: add repo_for_each_abbrev()
  sha1-name.c: store and use repo in struct disambiguate_state
  sha1-name.c: add repo_find_unique_abbrev_r()
  ...

1  2 
builtin/rebase.c
cache.h
commit-graph.c
commit.h
dir.c
dir.h
merge-recursive.c
packfile.c
packfile.h
sha1-name.c
upload-pack.c

Simple merge
diff --cc cache.h
index 9f2fb7b2ea428a8e747abb92d54811d62a18012b,9a600a8b508dfedd5cd4492a3b1b73500ccf323e..67cc2e1806ab4fabd4b34c0e1b4ca5cd1abafd82
+++ b/cache.h
@@@ -1380,14 -1380,16 +1382,17 @@@ enum get_oid_result 
                       */
  };
  
- extern int get_oid(const char *str, struct object_id *oid);
- extern int get_oidf(struct object_id *oid, const char *fmt, ...);
- extern int get_oid_commit(const char *str, struct object_id *oid);
- extern int get_oid_committish(const char *str, struct object_id *oid);
- extern int get_oid_tree(const char *str, struct object_id *oid);
- extern int get_oid_treeish(const char *str, struct object_id *oid);
- extern int get_oid_blob(const char *str, struct object_id *oid);
- extern void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);
+ int repo_get_oid(struct repository *r, const char *str, struct object_id *oid);
++int get_oidf(struct object_id *oid, const char *fmt, ...);
+ int repo_get_oid_commit(struct repository *r, const char *str, struct object_id *oid);
+ int repo_get_oid_committish(struct repository *r, const char *str, struct object_id *oid);
+ int repo_get_oid_tree(struct repository *r, const char *str, struct object_id *oid);
+ int repo_get_oid_treeish(struct repository *r, const char *str, struct object_id *oid);
+ int repo_get_oid_blob(struct repository *r, const char *str, struct object_id *oid);
+ int repo_get_oid_mb(struct repository *r, const char *str, struct object_id *oid);
+ void maybe_die_on_misspelt_object_name(struct repository *repo,
+                                      const char *name,
+                                      const char *prefix);
  extern enum get_oid_result get_oid_with_context(struct repository *repo, const char *str,
                                unsigned flags, struct object_id *oid,
                                struct object_context *oc);
diff --cc commit-graph.c
Simple merge
diff --cc commit.h
Simple merge
diff --cc dir.c
Simple merge
diff --cc dir.h
Simple merge
Simple merge
diff --cc packfile.c
Simple merge
diff --cc packfile.h
index 12baa6118a86216d76e342740c592802b70936df,f04440f9840f499b7c9163b8ad595cdbb9a5e9c3..b678d35c0b6df11623f2d29f7b7ea7dfe0e1bea1
@@@ -63,12 -57,13 +63,13 @@@ struct packed_git *get_all_packs(struc
   * Give a rough count of objects in the repository. This sacrifices accuracy
   * for speed.
   */
- unsigned long approximate_object_count(void);
+ unsigned long repo_approximate_object_count(struct repository *r);
+ #define approximate_object_count() repo_approximate_object_count(the_repository)
  
 -extern struct packed_git *find_sha1_pack(const unsigned char *sha1,
 -                                       struct packed_git *packs);
 +struct packed_git *find_sha1_pack(const unsigned char *sha1,
 +                                struct packed_git *packs);
  
 -extern void pack_report(void);
 +void pack_report(void);
  
  /*
   * mmap the index file for the specified packfile (if it is not
diff --cc sha1-name.c
index 7754d3a3deb9b92d4c9ac1e62bec9dcbc9aea585,cf314ebb29a71df30d2a1903e1855e66978c31fe..775a73d8adf6748cd67796a6b13ea1c4843d9f6a
@@@ -1524,31 -1577,12 +1589,31 @@@ int strbuf_check_branch_ref(struct strb
   * This is like "get_oid_basic()", except it allows "object ID expressions",
   * notably "xyz^" for "parent of xyz"
   */
- int get_oid(const char *name, struct object_id *oid)
+ int repo_get_oid(struct repository *r, const char *name, struct object_id *oid)
  {
        struct object_context unused;
-       return get_oid_with_context(the_repository, name, 0, oid, &unused);
+       return get_oid_with_context(r, name, 0, oid, &unused);
  }
  
 +/*
 + * This returns a non-zero value if the string (built using printf
 + * format and the given arguments) is not a valid object.
 + */
 +int get_oidf(struct object_id *oid, const char *fmt, ...)
 +{
 +      va_list ap;
 +      int ret;
 +      struct strbuf sb = STRBUF_INIT;
 +
 +      va_start(ap, fmt);
 +      strbuf_vaddf(&sb, fmt, ap);
 +      va_end(ap);
 +
 +      ret = get_oid(sb.buf, oid);
 +      strbuf_release(&sb);
 +
 +      return ret;
 +}
  
  /*
   * Many callers know that the user meant to name a commit-ish by
diff --cc upload-pack.c
Simple merge