Skip to content

Commit d5e3b01

Browse files
peffgitster
authored andcommitted
diff_unique_abbrev: rename to diff_aligned_abbrev
The word "align" describes how the function actually differs from find_unique_abbrev, and will make it less confusing when we add more diff-specific abbrevation functions that do not do this alignment. Since this is a globally available function, let's also move its descriptive comment to the header file, where we typically document function interfaces. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ef2ed50 commit d5e3b01

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

combine-diff.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,9 +1203,9 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
12031203

12041204
/* Show sha1's */
12051205
for (i = 0; i < num_parent; i++)
1206-
printf(" %s", diff_unique_abbrev(p->parent[i].oid.hash,
1207-
opt->abbrev));
1208-
printf(" %s ", diff_unique_abbrev(p->oid.hash, opt->abbrev));
1206+
printf(" %s", diff_aligned_abbrev(p->parent[i].oid.hash,
1207+
opt->abbrev));
1208+
printf(" %s ", diff_aligned_abbrev(p->oid.hash, opt->abbrev));
12091209
}
12101210

12111211
if (opt->output_format & (DIFF_FORMAT_RAW | DIFF_FORMAT_NAME_STATUS)) {

diff.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4157,11 +4157,7 @@ void diff_free_filepair(struct diff_filepair *p)
41574157
free(p);
41584158
}
41594159

4160-
/*
4161-
* This is different from find_unique_abbrev() in that
4162-
* it stuffs the result with dots for alignment.
4163-
*/
4164-
const char *diff_unique_abbrev(const unsigned char *sha1, int len)
4160+
const char *diff_aligned_abbrev(const unsigned char *sha1, int len)
41654161
{
41664162
int abblen;
41674163
const char *abbrev;
@@ -4209,9 +4205,9 @@ static void diff_flush_raw(struct diff_filepair *p, struct diff_options *opt)
42094205
fprintf(opt->file, "%s", diff_line_prefix(opt));
42104206
if (!(opt->output_format & DIFF_FORMAT_NAME_STATUS)) {
42114207
fprintf(opt->file, ":%06o %06o %s ", p->one->mode, p->two->mode,
4212-
diff_unique_abbrev(p->one->oid.hash, opt->abbrev));
4208+
diff_aligned_abbrev(p->one->oid.hash, opt->abbrev));
42134209
fprintf(opt->file, "%s ",
4214-
diff_unique_abbrev(p->two->oid.hash, opt->abbrev));
4210+
diff_aligned_abbrev(p->two->oid.hash, opt->abbrev));
42154211
}
42164212
if (p->score) {
42174213
fprintf(opt->file, "%c%03d%c", p->status, similarity_index(p),

diff.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,11 @@ extern void diff_warn_rename_limit(const char *varname, int needed, int degraded
340340
#define DIFF_STATUS_FILTER_AON '*'
341341
#define DIFF_STATUS_FILTER_BROKEN 'B'
342342

343-
extern const char *diff_unique_abbrev(const unsigned char *, int);
343+
/*
344+
* This is different from find_unique_abbrev() in that
345+
* it stuffs the result with dots for alignment.
346+
*/
347+
extern const char *diff_aligned_abbrev(const unsigned char *sha1, int);
344348

345349
/* do not report anything on removed paths */
346350
#define DIFF_SILENT_ON_REMOVED 01

0 commit comments

Comments
 (0)