Skip to content

Commit 78fb457

Browse files
mhaggergitster
authored andcommitted
refs: update some more docs to use "oid" rather than "sha1"
Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4170188 commit 78fb457

File tree

6 files changed

+26
-27
lines changed

6 files changed

+26
-27
lines changed

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,
770770
if (cb->cutoff_cnt)
771771
*cb->cutoff_cnt = cb->reccnt - 1;
772772
/*
773-
* we have not yet updated cb->[n|o]sha1 so they still
773+
* we have not yet updated cb->[n|o]oid so they still
774774
* hold the values for the previous record.
775775
*/
776776
if (!is_null_oid(&cb->ooid)) {

refs.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ int peel_ref(const char *refname, struct object_id *oid);
126126
/**
127127
* Resolve refname in the nested "gitlink" repository in the specified
128128
* submodule (which must be non-NULL). If the resolution is
129-
* successful, return 0 and set sha1 to the name of the object;
129+
* successful, return 0 and set oid to the name of the object;
130130
* otherwise, return a non-zero value.
131131
*/
132132
int resolve_gitlink_ref(const char *submodule, const char *refname,
@@ -260,7 +260,7 @@ struct ref_transaction;
260260

261261
/*
262262
* The signature for the callback function for the for_each_*()
263-
* functions below. The memory pointed to by the refname and sha1
263+
* functions below. The memory pointed to by the refname and oid
264264
* arguments is only guaranteed to be valid for the duration of a
265265
* single callback invocation.
266266
*/
@@ -354,7 +354,7 @@ int reflog_exists(const char *refname);
354354

355355
/*
356356
* Delete the specified reference. If old_oid is non-NULL, then
357-
* verify that the current value of the reference is old_sha1 before
357+
* verify that the current value of the reference is old_oid before
358358
* deleting it. If old_oid is NULL, delete the reference if it
359359
* exists, regardless of its old value. It is an error for old_oid to
360360
* be null_oid. msg and flags are passed through to
@@ -633,7 +633,7 @@ int ref_transaction_abort(struct ref_transaction *transaction,
633633
* It is a bug to call this function when there might be other
634634
* processes accessing the repository or if there are existing
635635
* references that might conflict with the ones being created. All
636-
* old_sha1 values must either be absent or NULL_SHA1.
636+
* old_oid values must either be absent or null_oid.
637637
*/
638638
int initial_ref_transaction_commit(struct ref_transaction *transaction,
639639
struct strbuf *err);

refs/files-backend.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ static void loose_fill_ref_dir(struct ref_store *ref_store,
240240
} else if (is_null_oid(&oid)) {
241241
/*
242242
* It is so astronomically unlikely
243-
* that NULL_SHA1 is the SHA-1 of an
243+
* that null_oid is the OID of an
244244
* actual object that we consider its
245245
* appearance in a loose reference
246246
* file to be repo corruption
@@ -473,7 +473,7 @@ static void unlock_ref(struct ref_lock *lock)
473473
* are passed to refs_verify_refname_available() for this check.
474474
*
475475
* If mustexist is not set and the reference is not found or is
476-
* broken, lock the reference anyway but clear sha1.
476+
* broken, lock the reference anyway but clear old_oid.
477477
*
478478
* Return 0 on success. On failure, write an error message to err and
479479
* return TRANSACTION_NAME_CONFLICT or TRANSACTION_GENERIC_ERROR.
@@ -1648,9 +1648,8 @@ static int files_log_ref_write(struct files_ref_store *refs,
16481648
}
16491649

16501650
/*
1651-
* Write sha1 into the open lockfile, then close the lockfile. On
1652-
* errors, rollback the lockfile, fill in *err and
1653-
* return -1.
1651+
* Write oid into the open lockfile, then close the lockfile. On
1652+
* errors, rollback the lockfile, fill in *err and return -1.
16541653
*/
16551654
static int write_ref_to_lockfile(struct ref_lock *lock,
16561655
const struct object_id *oid, struct strbuf *err)
@@ -2272,7 +2271,7 @@ static int split_symref_update(struct files_ref_store *refs,
22722271

22732272
/*
22742273
* Change the symbolic ref update to log only. Also, it
2275-
* doesn't need to check its old SHA-1 value, as that will be
2274+
* doesn't need to check its old OID value, as that will be
22762275
* done when new_update is processed.
22772276
*/
22782277
update->flags |= REF_LOG_ONLY | REF_NO_DEREF;
@@ -2341,7 +2340,7 @@ static int check_old_oid(struct ref_update *update, struct object_id *oid,
23412340
* Prepare for carrying out update:
23422341
* - Lock the reference referred to by update.
23432342
* - Read the reference under lock.
2344-
* - Check that its old SHA-1 value (if specified) is correct, and in
2343+
* - Check that its old OID value (if specified) is correct, and in
23452344
* any case record it in update->lock->old_oid for later use when
23462345
* writing the reflog.
23472346
* - If it is a symref update without REF_NO_DEREF, split it up into a
@@ -2396,7 +2395,7 @@ static int lock_ref_for_update(struct files_ref_store *refs,
23962395
/*
23972396
* We won't be reading the referent as part of
23982397
* the transaction, so we have to read it here
2399-
* to record and possibly check old_sha1:
2398+
* to record and possibly check old_oid:
24002399
*/
24012400
if (refs_read_ref_full(&refs->base,
24022401
referent.buf, 0,
@@ -2416,7 +2415,7 @@ static int lock_ref_for_update(struct files_ref_store *refs,
24162415
/*
24172416
* Create a new update for the reference this
24182417
* symref is pointing at. Also, we will record
2419-
* and verify old_sha1 for this update as part
2418+
* and verify old_oid for this update as part
24202419
* of processing the split-off update, so we
24212420
* don't have to do it here.
24222421
*/
@@ -2436,7 +2435,7 @@ static int lock_ref_for_update(struct files_ref_store *refs,
24362435

24372436
/*
24382437
* If this update is happening indirectly because of a
2439-
* symref update, record the old SHA-1 in the parent
2438+
* symref update, record the old OID in the parent
24402439
* update:
24412440
*/
24422441
for (parent_update = update->parent_update;

refs/packed-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ static int packed_read_raw_ref(struct ref_store *ref_store,
744744
/*
745745
* This value is set in `base.flags` if the peeled value of the
746746
* current reference is known. In that case, `peeled` contains the
747-
* correct peeled value for the reference, which might be `null_sha1`
747+
* correct peeled value for the reference, which might be `null_oid`
748748
* if the reference is not a tag or if it is broken.
749749
*/
750750
#define REF_KNOWS_PEELED 0x40

refs/ref-cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ int add_ref_entry(struct ref_dir *dir, struct ref_entry *ref)
260260

261261
/*
262262
* Emit a warning and return true iff ref1 and ref2 have the same name
263-
* and the same sha1. Die if they have the same name but different
264-
* sha1s.
263+
* and the same oid. Die if they have the same name but different
264+
* oids.
265265
*/
266266
static int is_dup_ref(const struct ref_entry *ref1, const struct ref_entry *ref2)
267267
{

refs/refs-internal.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
*/
1616

1717
/*
18-
* The reference should be updated to new_sha1.
18+
* The reference should be updated to new_oid.
1919
*/
2020
#define REF_HAVE_NEW (1 << 2)
2121

2222
/*
2323
* The current reference's value should be checked to make sure that
24-
* it agrees with old_sha1.
24+
* it agrees with old_oid.
2525
*/
2626
#define REF_HAVE_OLD (1 << 3)
2727

@@ -86,7 +86,7 @@ enum peel_status {
8686
* tag recursively until a non-tag is found. If successful, store the
8787
* result to oid and return PEEL_PEELED. If the object is not a tag
8888
* or is not valid, return PEEL_NON_TAG or PEEL_INVALID, respectively,
89-
* and leave sha1 unchanged.
89+
* and leave oid unchanged.
9090
*/
9191
enum peel_status peel_object(const struct object_id *name, struct object_id *oid);
9292

@@ -98,11 +98,11 @@ enum peel_status peel_object(const struct object_id *name, struct object_id *oid
9898
int copy_reflog_msg(char *buf, const char *msg);
9999

100100
/**
101-
* Information needed for a single ref update. Set new_sha1 to the new
102-
* value or to null_sha1 to delete the ref. To check the old value
103-
* while the ref is locked, set (flags & REF_HAVE_OLD) and set
104-
* old_sha1 to the old value, or to null_sha1 to ensure the ref does
105-
* not exist before update.
101+
* Information needed for a single ref update. Set new_oid to the new
102+
* value or to null_oid to delete the ref. To check the old value
103+
* while the ref is locked, set (flags & REF_HAVE_OLD) and set old_oid
104+
* to the old value, or to null_oid to ensure the ref does not exist
105+
* before update.
106106
*/
107107
struct ref_update {
108108
/*
@@ -158,7 +158,7 @@ int ref_update_reject_duplicates(struct string_list *refnames,
158158
/*
159159
* Add a ref_update with the specified properties to transaction, and
160160
* return a pointer to the new object. This function does not verify
161-
* that refname is well-formed. new_sha1 and old_sha1 are only
161+
* that refname is well-formed. new_oid and old_oid are only
162162
* dereferenced if the REF_HAVE_NEW and REF_HAVE_OLD bits,
163163
* respectively, are set in flags.
164164
*/

0 commit comments

Comments
 (0)